]>
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" | |
20 | ||
f97c9854 JS |
21 | /* Cursor for one display, so we can choose the correct one for |
22 | * the current display. | |
23 | */ | |
24 | class wxXCursor : public wxObject | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxXCursor) | |
27 | ||
28 | public: | |
29 | WXDisplay* m_display; | |
30 | WXCursor m_cursor; | |
31 | }; | |
32 | ||
9b6dbb09 JS |
33 | class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData |
34 | { | |
35 | friend class WXDLLEXPORT wxBitmap; | |
36 | friend class WXDLLEXPORT wxCursor; | |
37 | public: | |
38 | wxCursorRefData(); | |
39 | ~wxCursorRefData(); | |
40 | ||
f97c9854 JS |
41 | wxList m_cursors; // wxXCursor objects, one per display |
42 | wxStockCursor m_cursorId; // wxWindows standard cursor id | |
9b6dbb09 JS |
43 | }; |
44 | ||
45 | #define M_CURSORDATA ((wxCursorRefData *)m_refData) | |
46 | #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) | |
47 | ||
48 | // Cursor | |
49 | class WXDLLEXPORT wxCursor: public wxBitmap | |
50 | { | |
51 | DECLARE_DYNAMIC_CLASS(wxCursor) | |
52 | ||
53 | public: | |
54 | wxCursor(); | |
55 | ||
56 | // Copy constructors | |
72cdf4c9 | 57 | wxCursor(const wxCursor& cursor) { Ref(cursor); } |
9b6dbb09 JS |
58 | |
59 | wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, | |
60 | const char maskBits[] = NULL); | |
61 | ||
f97c9854 | 62 | wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_XBM, |
9b6dbb09 JS |
63 | int hotSpotX = 0, int hotSpotY = 0); |
64 | ||
f97c9854 | 65 | wxCursor(wxStockCursor id); |
9b6dbb09 JS |
66 | ~wxCursor(); |
67 | ||
f97c9854 | 68 | virtual bool Ok() const { return ((m_refData != NULL) && M_CURSORDATA->m_ok); } |
9b6dbb09 | 69 | |
72cdf4c9 VZ |
70 | wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; } |
71 | bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; } | |
72 | bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; } | |
9b6dbb09 | 73 | |
f97c9854 JS |
74 | // Motif-specific. |
75 | // Create/get a cursor for the current display | |
76 | WXCursor GetXCursor(WXDisplay* display) ; | |
77 | // Make a cursor from standard id | |
78 | WXCursor MakeCursor(WXDisplay* display, wxStockCursor id); | |
9b6dbb09 JS |
79 | }; |
80 | ||
81 | extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor); | |
82 | ||
83 | #endif | |
84 | // _WX_CURSOR_H_ |