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"
22 /* Cursor for one display, so we can choose the correct one for
23 * the current display.
25 class wxXCursor
: public wxObject
27 DECLARE_DYNAMIC_CLASS(wxXCursor
)
34 class WXDLLEXPORT wxCursorRefData
: public wxBitmapRefData
36 friend class WXDLLEXPORT wxBitmap
;
37 friend class WXDLLEXPORT wxCursor
;
42 wxList m_cursors
; // wxXCursor objects, one per display
43 wxStockCursor m_cursorId
; // wxWindows standard cursor id
46 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
47 #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
50 class WXDLLEXPORT wxCursor
: public wxBitmap
52 DECLARE_DYNAMIC_CLASS(wxCursor
)
58 wxCursor(const wxCursor
& 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);
67 wxCursor(const wxImage
& image
);
70 wxCursor(wxStockCursor id
);
73 virtual bool Ok() const { return ((m_refData
!= NULL
) && M_CURSORDATA
->m_ok
); }
75 wxCursor
& operator = (const wxCursor
& cursor
) { if (*this == cursor
) return (*this); Ref(cursor
); return *this; }
76 bool operator == (const wxCursor
& cursor
) const { return m_refData
== cursor
.m_refData
; }
77 bool operator != (const wxCursor
& cursor
) const { return m_refData
!= cursor
.m_refData
; }
80 // Create/get a cursor for the current display
81 WXCursor
GetXCursor(WXDisplay
* display
) ;
82 // Make a cursor from standard id
83 WXCursor
MakeCursor(WXDisplay
* display
, wxStockCursor id
);
86 extern WXDLLEXPORT
void wxSetCursor(const wxCursor
& cursor
);