1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxCursor class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "cursor.h"
19 #include "wx/bitmap.h"
21 /* Cursor for one display, so we can choose the correct one for
22 * the current display.
24 class wxXCursor
: public wxObject
26 DECLARE_DYNAMIC_CLASS(wxXCursor
)
33 class WXDLLEXPORT wxCursorRefData
: public wxBitmapRefData
35 friend class WXDLLEXPORT wxBitmap
;
36 friend class WXDLLEXPORT wxCursor
;
41 wxList m_cursors
; // wxXCursor objects, one per display
42 wxStockCursor m_cursorId
; // wxWindows standard cursor id
45 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
46 #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
49 class WXDLLEXPORT wxCursor
: public wxBitmap
51 DECLARE_DYNAMIC_CLASS(wxCursor
)
57 inline wxCursor(const wxCursor
& cursor
) { Ref(cursor
); }
58 inline wxCursor(const wxCursor
* cursor
) { if (cursor
) Ref(*cursor
); }
60 wxCursor(const char bits
[], int width
, int height
, int hotSpotX
= -1, int hotSpotY
= -1,
61 const char maskBits
[] = NULL
);
63 wxCursor(const wxString
& name
, long flags
= wxBITMAP_TYPE_XBM
,
64 int hotSpotX
= 0, int hotSpotY
= 0);
66 wxCursor(wxStockCursor id
);
69 virtual bool Ok() const { return ((m_refData
!= NULL
) && M_CURSORDATA
->m_ok
); }
71 inline wxCursor
& operator = (const wxCursor
& cursor
) { if (*this == cursor
) return (*this); Ref(cursor
); return *this; }
72 inline bool operator == (const wxCursor
& cursor
) { return m_refData
== cursor
.m_refData
; }
73 inline bool operator != (const wxCursor
& cursor
) { return m_refData
!= cursor
.m_refData
; }
76 // Create/get a cursor for the current display
77 WXCursor
GetXCursor(WXDisplay
* display
) ;
78 // Make a cursor from standard id
79 WXCursor
MakeCursor(WXDisplay
* display
, wxStockCursor id
);
82 extern WXDLLEXPORT
void wxSetCursor(const wxCursor
& cursor
);