// Name: cursor.h
// Purpose: interface of wxCursor
// Author: wxWidgets team
-// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@see wxBitmap, wxIcon, wxWindow::SetCursor(), wxSetCursor(), ::wxStockCursor
*/
-class wxCursor : public wxBitmap
+class wxCursor : public wxGDIObject
{
public:
/**
@param height
Cursor height.
@param hotSpotX
- Hotspot x coordinate.
+ Hotspot x coordinate (relative to the top left of the image).
@param hotSpotY
- Hotspot y coordinate.
+ Hotspot y coordinate (relative to the top left of the image).
@param maskBits
Bits for a mask bitmap.
@onlyfor{wxgtk,wxmotif}
+
+ @beginWxPerlOnly
+ In wxPerl use Wx::Cursor->newData(bits, width, height, hotSpotX = -1, hotSpotY = -1, maskBits = 0).
+ @endWxPerlOnly
*/
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
/**
Constructs a cursor by passing a string resource name or filename.
- @note
- On MacOS when specifying a string resource name, first the color
- cursors 'crsr' and then the black/white cursors 'CURS' in the resource
- chain are scanned through.
-
- @a hotSpotX and @a hotSpotY are currently only used under Windows when
- loading from an icon file, to specify the cursor hotspot relative to
- the top left of the image.
+ The arguments @a hotSpotX and @a hotSpotY are only used when there's no
+ hotspot info in the resource/image-file to load (e.g. when using
+ @c wxBITMAP_TYPE_ICO under wxMSW or @c wxBITMAP_TYPE_XPM under wxGTK).
@param cursorName
The name of the resource or the image file to load.
@param type
- Icon type to load. It defaults to wxCURSOR_DEFAULT_TYPE,
+ Icon type to load. It defaults to @c wxCURSOR_DEFAULT_TYPE,
which is a @#define associated to different values on different
platforms:
- - under Windows, it defaults to wxBITMAP_TYPE_CUR_RESOURCE.
- - under MacOS, it defaults to wxBITMAP_TYPE_MACCURSOR_RESOURCE.
- - under GTK, it defaults to wxBITMAP_TYPE_XPM.
- - under X11, it defaults to wxBITMAP_TYPE_XPM.
- - under Motif, type defaults to wxBITMAP_TYPE_XBM.
- Under Windows, the permitted types are:
- - wxBITMAP_TYPE_CUR - Load a cursor from a .cur cursor file (only
- if USE_RESOURCE_LOADING_IN_MSW is enabled in
- setup.h).
- - wxBITMAP_TYPE_CUR_RESOURCE - Load a Windows resource
- (as specified in the .rc file).
- - wxBITMAP_TYPE_ICO - Load a cursor from a .ico icon file (only if
- USE_RESOURCE_LOADING_IN_MSW is enabled in
- setup.h). Specify @a hotSpotX and @a hotSpotY.
+ - under Windows, it defaults to @c wxBITMAP_TYPE_CUR_RESOURCE.
+ Other permitted types under Windows are @c wxBITMAP_TYPE_CUR
+ (to load a cursor from a .cur cursor file), @c wxBITMAP_TYPE_ICO
+ (to load a cursor from a .ico icon file) and @c wxBITMAP_TYPE_ANI
+ (to load a cursor from a .ani icon file).
+ - under MacOS, it defaults to @c wxBITMAP_TYPE_MACCURSOR_RESOURCE;
+ when specifying a string resource name, first the color cursors 'crsr'
+ and then the black/white cursors 'CURS' in the resource chain are scanned
+ through. Note that resource forks are deprecated on OS X so this
+ is only available for legacy reasons and should not be used in
+ new code.
+ - under GTK, it defaults to @c wxBITMAP_TYPE_XPM.
+ See the wxCursor(const wxImage& image) ctor for more info.
+ - under X11, it defaults to @c wxBITMAP_TYPE_XPM.
+ - under Motif, it defaults to @c wxBITMAP_TYPE_XBM.
@param hotSpotX
- Hotspot x coordinate.
+ Hotspot x coordinate (relative to the top left of the image).
@param hotSpotY
- Hotspot y coordinate.
+ Hotspot y coordinate (relative to the top left of the image).
*/
wxCursor(const wxString& cursorName,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
foreground and background. In any case, the cursor will be displayed
at the size of the image.
- In wxMac, if the cursor is larger than 16x16 it is resized and
- currently only shown as black/white (mask respected).
+ Under wxMac (Cocoa), large cursors are supported.
+
+ Notice that the @a image can define the cursor hot spot. To set it you
+ need to use wxImage::SetOption() with @c wxIMAGE_OPTION_CUR_HOTSPOT_X
+ or @c wxIMAGE_OPTION_CUR_HOTSPOT_Y, e.g.
+ @code
+ image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX);
+ image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotY);
+ @endcode
*/
wxCursor(const wxImage& image);