]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cursor.h | |
3 | // Purpose: wxCursor class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CURSOR_H_ | |
13 | #define _WX_CURSOR_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "cursor.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/bitmap.h" | |
00dd3b18 | 20 | #include "wx/list.h" |
9b6dbb09 | 21 | |
f97c9854 | 22 | /* Cursor for one display, so we can choose the correct one for |
83df96d6 JS |
23 | * the current display. |
24 | */ | |
f97c9854 JS |
25 | class wxXCursor : public wxObject |
26 | { | |
83df96d6 JS |
27 | DECLARE_DYNAMIC_CLASS(wxXCursor) |
28 | ||
29 | public: | |
30 | WXDisplay* m_display; | |
31 | WXCursor m_cursor; | |
f97c9854 JS |
32 | }; |
33 | ||
9b6dbb09 JS |
34 | class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData |
35 | { | |
36 | friend class WXDLLEXPORT wxBitmap; | |
37 | friend class WXDLLEXPORT wxCursor; | |
38 | public: | |
39 | wxCursorRefData(); | |
40 | ~wxCursorRefData(); | |
83df96d6 | 41 | |
f97c9854 JS |
42 | wxList m_cursors; // wxXCursor objects, one per display |
43 | wxStockCursor m_cursorId; // wxWindows standard cursor id | |
9b6dbb09 JS |
44 | }; |
45 | ||
46 | #define M_CURSORDATA ((wxCursorRefData *)m_refData) | |
47 | #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) | |
48 | ||
49 | // Cursor | |
50 | class WXDLLEXPORT wxCursor: public wxBitmap | |
51 | { | |
83df96d6 JS |
52 | DECLARE_DYNAMIC_CLASS(wxCursor) |
53 | ||
9b6dbb09 | 54 | public: |
83df96d6 JS |
55 | wxCursor(); |
56 | ||
57 | // Copy constructors | |
58 | wxCursor(const wxCursor& cursor) { Ref(cursor); } | |
59 | ||
60 | wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, | |
61 | const char maskBits[] = NULL); | |
62 | ||
63 | wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_XBM, | |
64 | int hotSpotX = 0, int hotSpotY = 0); | |
4daa4d66 CE |
65 | |
66 | #if wxUSE_IMAGE | |
67 | wxCursor(const wxImage& image); | |
68 | #endif | |
69 | ||
83df96d6 JS |
70 | wxCursor(wxStockCursor id); |
71 | ~wxCursor(); | |
72 | ||
73 | virtual bool Ok() const { return ((m_refData != NULL) && M_CURSORDATA->m_ok); } | |
74 | ||
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; } | |
78 | ||
79 | // Motif-specific. | |
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); | |
9b6dbb09 JS |
84 | }; |
85 | ||
86 | extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor); | |
87 | ||
88 | #endif | |
83df96d6 | 89 | // _WX_CURSOR_H_ |