gtkmm  4.8.0
Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gdk::Cursor Class Reference

This represents a cursor. More...

#include <gdkmm/cursor.h>

Inherits Glib::Object.

Public Member Functions

 Cursor (Cursor && src) noexcept
 
Cursoroperator= (Cursor && src) noexcept
 
 ~Cursor () noexcept override
 
GdkCursor * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkCursor * gobj () const
 Provides access to the underlying C GObject. More...
 
GdkCursor * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< Cursorget_fallback ()
 Returns the fallback for this cursor. More...
 
Glib::RefPtr< const Cursorget_fallback () const
 Returns the fallback for this cursor. More...
 
Glib::ustring get_name () const
 Returns the name of the cursor. More...
 
Glib::RefPtr< Textureget_texture ()
 Returns the texture for the cursor. More...
 
Glib::RefPtr< const Textureget_texture () const
 Returns the texture for the cursor. More...
 
int get_hotspot_x () const
 Returns the horizontal offset of the hotspot. More...
 
int get_hotspot_y () const
 Returns the vertical offset of the hotspot. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Cursor > > property_fallback () const
 Cursor to fall back to if this cursor cannot be displayed. More...
 
Glib::PropertyProxy_ReadOnly< int > property_hotspot_x () const
 X position of the cursor hotspot in the cursor image. More...
 
Glib::PropertyProxy_ReadOnly< int > property_hotspot_y () const
 Y position of the cursor hotspot in the cursor image. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_name () const
 Name of this this cursor. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Texture > > property_texture () const
 The texture displayed by this cursor. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< Cursorcreate (const Glib::RefPtr< const Texture > & texture, int hotspot_x, int hotspot_y, const Glib::RefPtr< Cursor > & fallback={})
 Creates a new cursor from a Gdk::Texture. More...
 
static Glib::RefPtr< Cursorcreate (const Glib::ustring & name, const Glib::RefPtr< Cursor > & fallback={})
 Creates a new cursor by looking up name in the current cursor theme. More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::Cursorwrap (GdkCursor * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

This represents a cursor.

Constructor & Destructor Documentation

◆ Cursor()

Gdk::Cursor::Cursor ( Cursor &&  src)
noexcept

◆ ~Cursor()

Gdk::Cursor::~Cursor ( )
overridenoexcept

Member Function Documentation

◆ create() [1/2]

static Glib::RefPtr<Cursor> Gdk::Cursor::create ( const Glib::RefPtr< const Texture > &  texture,
int  hotspot_x,
int  hotspot_y,
const Glib::RefPtr< Cursor > &  fallback = {} 
)
static

Creates a new cursor from a Gdk::Texture.

Parameters
textureThe texture providing the pixel data.
hotspot_xThe horizontal offset of the “hotspot” of the cursor.
hotspot_yThe vertical offset of the “hotspot” of the cursor.
fallbackThe Gdk::Cursor to fall back to when this one cannot be supported.
Returns
A new Gdk::Cursor.

◆ create() [2/2]

static Glib::RefPtr<Cursor> Gdk::Cursor::create ( const Glib::ustring &  name,
const Glib::RefPtr< Cursor > &  fallback = {} 
)
static

Creates a new cursor by looking up name in the current cursor theme.

A recommended set of cursor names that will work across different platforms can be found in the CSS specification:

"none" "default" "help" "pointer"
"context-menu" "progress" "wait" "cell"
"crosshair" "text" "vertical-text" "alias"
"copy" "no-drop" "move" "not-allowed"
"grab" "grabbing" "all-scroll" "col-resize"
"row-resize" "n-resize" "e-resize" "s-resize"
"w-resize" "ne-resize" "nw-resize" "sw-resize"
"se-resize" "ew-resize" "ns-resize" "nesw-resize"
"nwse-resize" "zoom-in" "zoom-out"
Parameters
nameThe name of the cursor.
fallbacknullptr or the Gdk::Cursor to fall back to when this one cannot be supported.
Returns
A new Gdk::Cursor, or nullptr if there is no cursor with the given name.

◆ get_fallback() [1/2]

Glib::RefPtr<Cursor> Gdk::Cursor::get_fallback ( )

Returns the fallback for this cursor.

The fallback will be used if this cursor is not available on a given Gdk::Display. For named cursors, this can happen when using nonstandard names or when using an incomplete cursor theme. For textured cursors, this can happen when the texture is too large or when the Gdk::Display it is used on does not support textured cursors.

Returns
The fallback of the cursor or nullptr to use the default cursor as fallback.

◆ get_fallback() [2/2]

Glib::RefPtr<const Cursor> Gdk::Cursor::get_fallback ( ) const

Returns the fallback for this cursor.

The fallback will be used if this cursor is not available on a given Gdk::Display. For named cursors, this can happen when using nonstandard names or when using an incomplete cursor theme. For textured cursors, this can happen when the texture is too large or when the Gdk::Display it is used on does not support textured cursors.

Returns
The fallback of the cursor or nullptr to use the default cursor as fallback.

◆ get_hotspot_x()

int Gdk::Cursor::get_hotspot_x ( ) const

Returns the horizontal offset of the hotspot.

The hotspot indicates the pixel that will be directly above the cursor.

Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with new_from_texture().

Returns
The horizontal offset of the hotspot or 0 for named cursors.

◆ get_hotspot_y()

int Gdk::Cursor::get_hotspot_y ( ) const

Returns the vertical offset of the hotspot.

The hotspot indicates the pixel that will be directly above the cursor.

Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with new_from_texture().

Returns
The vertical offset of the hotspot or 0 for named cursors.

◆ get_name()

Glib::ustring Gdk::Cursor::get_name ( ) const

Returns the name of the cursor.

If the cursor is not a named cursor, nullptr will be returned.

Returns
The name of the cursor or nullptr if it is not a named cursor.

◆ get_texture() [1/2]

Glib::RefPtr<Texture> Gdk::Cursor::get_texture ( )

Returns the texture for the cursor.

If the cursor is a named cursor, nullptr will be returned.

Returns
The texture for cursor or nullptr if it is a named cursor.

◆ get_texture() [2/2]

Glib::RefPtr<const Texture> Gdk::Cursor::get_texture ( ) const

Returns the texture for the cursor.

If the cursor is a named cursor, nullptr will be returned.

Returns
The texture for cursor or nullptr if it is a named cursor.

◆ get_type()

static GType Gdk::Cursor::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GdkCursor* Gdk::Cursor::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkCursor* Gdk::Cursor::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GdkCursor* Gdk::Cursor::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ operator=()

Cursor& Gdk::Cursor::operator= ( Cursor &&  src)
noexcept

◆ property_fallback()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Cursor> > Gdk::Cursor::property_fallback ( ) const

Cursor to fall back to if this cursor cannot be displayed.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_hotspot_x()

Glib::PropertyProxy_ReadOnly< int > Gdk::Cursor::property_hotspot_x ( ) const

X position of the cursor hotspot in the cursor image.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_hotspot_y()

Glib::PropertyProxy_ReadOnly< int > Gdk::Cursor::property_hotspot_y ( ) const

Y position of the cursor hotspot in the cursor image.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_name()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Cursor::property_name ( ) const

Name of this this cursor.

The name will be nullptr if the cursor was created from a texture.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_texture()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Texture> > Gdk::Cursor::property_texture ( ) const

The texture displayed by this cursor.

The texture will be nullptr if the cursor was created from a name.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::Cursor > wrap ( GdkCursor *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.