]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/cursor.h
avoid warning for duplicate defined wxEntry when compiling with the Apple
[wxWidgets.git] / include / wx / motif / cursor.h
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 #if wxUSE_IMAGE
21 #include "wx/image.h"
22 #endif
23
24
25
26 /* Cursor for one display, so we can choose the correct one for
27 * the current display.
28 */
29 class wxXCursor : public wxObject
30 {
31 DECLARE_DYNAMIC_CLASS(wxXCursor)
32
33 public:
34 WXDisplay* m_display;
35 WXCursor m_cursor;
36 };
37
38 class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
39 {
40 friend class WXDLLEXPORT wxBitmap;
41 friend class WXDLLEXPORT wxCursor;
42 public:
43 wxCursorRefData();
44 ~wxCursorRefData();
45
46 wxList m_cursors; // wxXCursor objects, one per display
47 wxStockCursor m_cursorId; // wxWindows standard cursor id
48 };
49
50 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
51 #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
52
53 // Cursor
54 class WXDLLEXPORT wxCursor: public wxBitmap
55 {
56 DECLARE_DYNAMIC_CLASS(wxCursor)
57
58 public:
59 wxCursor();
60
61 // Copy constructors
62 wxCursor(const wxCursor& cursor) { Ref(cursor); }
63
64 wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
65 const char maskBits[] = NULL);
66
67 wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_XBM,
68 int hotSpotX = 0, int hotSpotY = 0);
69
70 #if wxUSE_IMAGE
71 wxCursor(const wxImage& image);
72 #endif
73
74 wxCursor(wxStockCursor id);
75 ~wxCursor();
76
77 virtual bool Ok() const { return ((m_refData != NULL) && M_CURSORDATA->m_ok); }
78
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; }
82
83 // Motif-specific.
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);
88 };
89
90 extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);
91
92 #endif
93 // _WX_CURSOR_H_