wxCursor — wx v2.4.3

Search documentation of wx

# View Source wxCursor (wx v2.4.3)

A cursor is a small bitmap usually used for denoting where the mouse pointer is, with a picture that might indicate the interpretation 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 `wxCursor` object are catered for, and this is an occasion where conditional compilation will probably be required (see `wxIcon` 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 `wx_misc:setCursor/1` function is also available for MS Windows use.

Creating a Custom Cursor

The following is an example of creating a cursor from 32x32 bitmap data (down_bits) and a mask (down_mask) where 1 is black and 0 is white for the bits, and 1 is opaque and 0 is transparent for the mask. It works on Windows and GTK+.

Predefined objects (include wx.hrl):

- ?wxNullCursor

- ?wxSTANDARD_CURSOR

- ?wxHOURGLASS_CURSOR

- ?wxCROSS_CURSOR

See:

- `wxBitmap`

- `wxIcon`

- `wxWindow:setCursor/2`

- `wx_misc:setCursor/1`

- ?wxStockCursor

This class is derived, and can use functions, from:

- `wxBitmap`

wxWidgets docs: wxCursor

# Summary

## Types

wxCursor()

## Functions

destroy(This)

Destroys the object

isOk(This)

Returns true if cursor data is present.

new()

Default constructor.

new/1

Constructs a cursor using a cursor identifier.

new(CursorName, Options)

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

ok(This)

Equivalent to: `isOk/1`

# Types

Link to this type

# wxCursor()

View Source

    -type wxCursor() :: wx:wx_object().

# Functions

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxCursor()) -> ok.

Destroys the object

Link to this function

# isOk(This)

View Source

    -spec isOk(This) -> boolean() when This :: wxCursor().

Returns true if cursor data is present.

Link to this function

# new()

View Source

    -spec new() -> wxCursor().

Default constructor.

Link to this function

# new/1

View Source

    -spec new(CursorName) -> wxCursor() when CursorName :: unicode:chardata();
             (Image) -> wxCursor() when Image :: wxImage:wxImage() | wxCursor:wxCursor();
             (CursorId) -> wxCursor() when CursorId :: wx:wx_enum().

Constructs a cursor using a cursor identifier.

Link to this function

# new(CursorName, Options)

View Source

    -spec new(CursorName, [Option]) -> wxCursor()
                 when
                     CursorName :: unicode:chardata(),
                     Option :: {type, wx:wx_enum()} | {hotSpotX, integer()} | {hotSpotY, integer()}.

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 `wxBITMAP_TYPE_ICO` under wxMSW or `wxBITMAP_TYPE_XPM` under wxGTK).

Link to this function

# ok(This)

View Source

    -spec ok(This) -> boolean() when This :: wxCursor().

Equivalent to: `isOk/1`