Class: Wx::Cursor

Inherits:
GDIObject show all
Defined in:
lib/wx/doc/gen/cursor.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A cursor is a small bitmap used for denoting where the mouse pointer is, with a picture that indicates the point of a mouse click.

As with icons, cursors in X and MS Windows are created in a different manner. Therefore, separate cursors will be created for the different environments. Platform-specific methods for creating a Cursor object are catered for, and this is an occasion where conditional compilation will probably be required (see Icon for an example). A single cursor object may be used in many windows (any subwindow type). The wxWidgets convention is to set the cursor for a window, as in X, rather than to set it globally as in MS Windows, although a global set_cursor function is also available for MS Windows use.

Category: Graphics Device Interface (GDI) Predefined objects/pointers: - NULL_CURSOR - STANDARD_CURSOR - HOURGLASS_CURSOR - CROSS_CURSOR

Instance Method Summary collapse

Methods inherited from GDIObject

#clone, #dup

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::Cursor #initialize(bitmap, hotSpotX = 0, hotSpotY = 0) ⇒ Wx::Cursor #initialize(bitmap, hotSpot) ⇒ Wx::Cursor #initialize(cursorName, type = Wx::CURSOR_DEFAULT_TYPE, hotSpotX = 0, hotSpotY = 0) ⇒ Wx::Cursor #initialize(name, type, hotSpot) ⇒ Wx::Cursor #initialize(cursorId) ⇒ Wx::Cursor #initialize(image) ⇒ Wx::Cursor #initialize(cursor) ⇒ Wx::Cursor

Returns a new instance of Cursor.

Overloads:

  • #initializeWx::Cursor

    Default constructor.

  • #initialize(bitmap, hotSpotX = 0, hotSpotY = 0) ⇒ Wx::Cursor

    Constructs a cursor from the provided bitmap and hotspot position.

    Parameters:

    • bitmap (Wx::Bitmap)

      The bitmap to use for the cursor, should be valid.

    • hotSpotX (Integer) (defaults to: 0)

      Hotspot x coordinate (relative to the top left of the image).

    • hotSpotY (Integer) (defaults to: 0)

      Hotspot y coordinate (relative to the top left of the image).

  • #initialize(bitmap, hotSpot) ⇒ Wx::Cursor

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

  • #initialize(cursorName, type = Wx::CURSOR_DEFAULT_TYPE, hotSpotX = 0, hotSpotY = 0) ⇒ Wx::Cursor

    Constructs a cursor by passing a string resource name or filename.

    The arguments hotSpotX and hotSpotY are only used when there’s no hotspot info in the resource/image-file to load (e.g. when using BitmapType::BITMAP_TYPE_ICO under WXMSW or BitmapType::BITMAP_TYPE_XPM under WXGTK).

    Parameters:

    • cursorName (String)

      The name of the resource or the image file to load.

    • type (Wx::BitmapType) (defaults to: Wx::CURSOR_DEFAULT_TYPE)

      Icon type to load. It defaults to Wx::CURSOR_DEFAULT_TYPE, which is a #define associated to different values on different platforms:

    • hotSpotX (Integer) (defaults to: 0)

      Hotspot x coordinate (relative to the top left of the image).

    • hotSpotY (Integer) (defaults to: 0)

      Hotspot y coordinate (relative to the top left of the image).

  • #initialize(name, type, hotSpot) ⇒ Wx::Cursor

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

    Parameters:

  • #initialize(cursorId) ⇒ Wx::Cursor

    Constructs a cursor using a cursor identifier.

    Parameters:

  • #initialize(image) ⇒ Wx::Cursor

    Constructs a cursor from a Image.

    If cursor are monochrome on the current platform, colors with the RGB elements all greater than 127 will be foreground, colors less than this background. The mask (if any) will be used to specify the transparent area. In WXMSW the foreground will be white and the background black. If the cursor is larger than 32x32 it is resized. In WXGTK, colour cursors and alpha channel are supported (starting from GTK+ 2.2). Otherwise the two most frequent colors will be used for foreground and background. In any case, the cursor will be displayed at the size of the image. Under WXOSX (Cocoa), large cursors are supported. Notice that the image can define the cursor hot spot. To set it you need to use Image#set_option with IMAGE_OPTION_CUR_HOTSPOT_X or IMAGE_OPTION_CUR_HOTSPOT_Y, e.g.

    image.set_option(Wx::IMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX)
      image.set_option(Wx::IMAGE_OPTION_CUR_HOTSPOT_X, hotSpotY)
    

    Parameters:

  • #initialize(cursor) ⇒ Wx::Cursor

    Copy constructor, uses reference counting.

    Parameters:

    • cursor (Wx::Cursor)

      Pointer or reference to a cursor to copy.



95
# File 'lib/wx/doc/gen/cursor.rb', line 95

def initialize(*args) end

Instance Method Details

#get_hot_spotWx::Point Also known as: hot_spot

Returns the coordinates of the cursor hot spot.

The hot spot is the point at which the mouse is actually considered to be when this cursor is used. This method is currently implemented in WXMSW, WXGTK and WXOSX (since wxWidgets 3.3.0) and returns DEFAULT_POSITION in the other ports.

Returns:



107
# File 'lib/wx/doc/gen/cursor.rb', line 107

def get_hot_spot; end

#is_okBoolean Also known as: ok?

Returns true if cursor data is present.

Returns:

  • (Boolean)


99
# File 'lib/wx/doc/gen/cursor.rb', line 99

def is_ok; end