Class: Gdk::Cursor

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

A Gdk::Cursor represents a cursor. Its contents are private.

Instance Method Summary collapse

Instance Method Details

#cursor_typeGdk::CursorType

Returns cursor-type.

Returns:

#cursor_type=(cursor_type) ⇒ Gdk::CursorType

Parameters:

Returns:

#displayGdk::Display

Returns display.

Returns:

#display=(display) ⇒ Gdk::Display

Parameters:

Returns:

#get_surface(x_hot, y_hot) ⇒ cairo::Surface

Returns a cairo image surface with the image used to display the cursor.

Note that depending on the capabilities of the windowing system and on the cursor, GDK may not be able to obtain the image data. In this case, nil is returned.

Parameters:

  • x_hot (Float)

    Location to store the hotspot x position, or nil

  • y_hot (Float)

    Location to store the hotspot y position, or nil

Returns:

  • (cairo::Surface)

    a #cairo_surface_t representing cursor, or nil

#imageGdkPixbuf::Pixbuf

Returns a Gdk::Pixbuf with the image used to display the cursor.

Note that depending on the capabilities of the windowing system and on the cursor, GDK may not be able to obtain the image data. In this case, nil is returned.

Returns:

#new(cursor_type) ⇒ Gdk::Cursor

Creates a new cursor from the set of builtin cursors for the default display. See gdk_cursor_new_for_display().

To make the cursor invisible, use %GDK_BLANK_CURSOR.

Parameters:

Returns:

#new_for_display(display, cursor_type) ⇒ Gdk::Cursor

Creates a new cursor from the set of builtin cursors.

Parameters:

Returns:

#new_from_name(display, name) ⇒ Gdk::Cursor

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_cursor.png) “default”

  • ![](help_cursor.png) “help”

  • ![](pointer_cursor.png) “pointer”

  • ![](context_menu_cursor.png) “context-menu”

  • ![](progress_cursor.png) “progress”

  • ![](wait_cursor.png) “wait”

  • ![](cell_cursor.png) “cell”

  • ![](crosshair_cursor.png) “crosshair”

  • ![](text_cursor.png) “text”

  • ![](vertical_text_cursor.png) “vertical-text”

  • ![](alias_cursor.png) “alias”

  • ![](copy_cursor.png) “copy”

  • ![](no_drop_cursor.png) “no-drop”

  • ![](move_cursor.png) “move”

  • ![](not_allowed_cursor.png) “not-allowed”

  • ![](grab_cursor.png) “grab”

  • ![](grabbing_cursor.png) “grabbing”

  • ![](all_scroll_cursor.png) “all-scroll”

  • ![](col_resize_cursor.png) “col-resize”

  • ![](row_resize_cursor.png) “row-resize”

  • ![](n_resize_cursor.png) “n-resize”

  • ![](e_resize_cursor.png) “e-resize”

  • ![](s_resize_cursor.png) “s-resize”

  • ![](w_resize_cursor.png) “w-resize”

  • ![](ne_resize_cursor.png) “ne-resize”

  • ![](nw_resize_cursor.png) “nw-resize”

  • ![](sw_resize_cursor.png) “sw-resize”

  • ![](se_resize_cursor.png) “se-resize”

  • ![](ew_resize_cursor.png) “ew-resize”

  • ![](ns_resize_cursor.png) “ns-resize”

  • ![](nesw_resize_cursor.png) “nesw-resize”

  • ![](nwse_resize_cursor.png) “nwse-resize”

  • ![](zoom_in_cursor.png) “zoom-in”

  • ![](zoom_out_cursor.png) “zoom-out”

Parameters:

  • display (Gdk::Display)

    the Gdk::Display for which the cursor will be created

  • name (String)

    the name of the cursor

Returns:

  • (Gdk::Cursor)

    a new Gdk::Cursor, or nil if there is no cursor with the given name

#new_from_pixbuf(display, pixbuf, x, y) ⇒ Gdk::Cursor

Creates a new cursor from a pixbuf.

Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. The functions gdk_display_supports_cursor_alpha() and gdk_display_supports_cursor_color() can be used to determine whether RGBA cursors are supported; gdk_display_get_default_cursor_size() and gdk_display_get_maximal_cursor_size() give information about cursor sizes.

If x or y are ‘-1`, the pixbuf must have options named “x_hot” and “y_hot”, resp., containing integer values between `0` and the width resp. height of the pixbuf. (Since: 3.0)

On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.

Parameters:

  • display (Gdk::Display)

    the Gdk::Display for which the cursor will be created

  • pixbuf (GdkPixbuf::Pixbuf)

    the Gdk::Pixbuf containing the cursor image

  • x (Integer)

    the horizontal offset of the “hotspot” of the cursor.

  • y (Integer)

    the vertical offset of the “hotspot” of the cursor.

Returns:

#new_from_surface(display, surface, x, y) ⇒ Gdk::Cursor

Creates a new cursor from a cairo image surface.

Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. The functions gdk_display_supports_cursor_alpha() and gdk_display_supports_cursor_color() can be used to determine whether RGBA cursors are supported; gdk_display_get_default_cursor_size() and gdk_display_get_maximal_cursor_size() give information about cursor sizes.

On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.

Parameters:

  • display (Gdk::Display)

    the Gdk::Display for which the cursor will be created

  • surface (cairo::Surface)

    the cairo image surface containing the cursor pixel data

  • x (Float)

    the horizontal offset of the “hotspot” of the cursor

  • y (Float)

    the vertical offset of the “hotspot” of the cursor

Returns:

#refGdk::Cursor

Adds a reference to cursor.

Returns:

#unrefnil

Removes a reference from cursor, deallocating the cursor if no references remain.

Returns:

  • (nil)