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"
26 /* Cursor for one display, so we can choose the correct one for
27 * the current display.
29 class wxXCursor
: public wxObject
31 DECLARE_DYNAMIC_CLASS(wxXCursor
)
38 class WXDLLEXPORT wxCursorRefData
: public wxBitmapRefData
40 friend class WXDLLEXPORT wxBitmap
;
41 friend class WXDLLEXPORT wxCursor
;
46 wxList m_cursors
; // wxXCursor objects, one per display
47 wxStockCursor m_cursorId
; // wxWindows standard cursor id
50 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
51 #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
54 class WXDLLEXPORT wxCursor
: public wxBitmap
56 DECLARE_DYNAMIC_CLASS(wxCursor
)
62 wxCursor(const wxCursor
& cursor
) { Ref(cursor
); }
64 wxCursor(const char bits
[], int width
, int height
, int hotSpotX
= -1, int hotSpotY
= -1,
65 const char maskBits
[] = NULL
);
67 wxCursor(const wxString
& name
, long flags
= wxBITMAP_TYPE_XBM
,
68 int hotSpotX
= 0, int hotSpotY
= 0);
71 wxCursor(const wxImage
& image
);
74 wxCursor(wxStockCursor id
);
77 virtual bool Ok() const { return ((m_refData
!= NULL
) && M_CURSORDATA
->m_ok
); }
79 wxCursor
& operator = (const wxCursor
& cursor
) { if (*this == cursor
) return (*this); Ref(cursor
); return *this; }
80 bool operator == (const wxCursor
& cursor
) const { return m_refData
== cursor
.m_refData
; }
81 bool operator != (const wxCursor
& cursor
) const { return m_refData
!= cursor
.m_refData
; }
84 // Create/get a cursor for the current display
85 WXCursor
GetXCursor(WXDisplay
* display
) ;
86 // Make a cursor from standard id
87 WXCursor
MakeCursor(WXDisplay
* display
, wxStockCursor id
);
90 extern WXDLLEXPORT
void wxSetCursor(const wxCursor
& cursor
);