]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cursor.h | |
3 | // Purpose: wxCursor class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
d921af51 | 9 | // Licence: wxWindows licence |
0dbd6262 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CURSOR_H_ | |
13 | #define _WX_CURSOR_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
0dbd6262 SC |
16 | #pragma interface "cursor.h" |
17 | #endif | |
18 | ||
19 | #include "wx/bitmap.h" | |
20 | ||
21 | class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData | |
22 | { | |
be52b341 GD |
23 | DECLARE_NO_COPY_CLASS(wxCursorRefData) |
24 | ||
0dbd6262 SC |
25 | friend class WXDLLEXPORT wxBitmap; |
26 | friend class WXDLLEXPORT wxCursor; | |
27 | public: | |
28 | wxCursorRefData(); | |
29 | ~wxCursorRefData(); | |
30 | ||
31 | protected: | |
d921af51 JS |
32 | WXHCURSOR m_hCursor; |
33 | bool m_disposeHandle; | |
34 | bool m_releaseHandle; | |
c6a071d2 | 35 | bool m_isColorCursor ; |
d921af51 | 36 | long m_themeCursor ; |
0dbd6262 SC |
37 | }; |
38 | ||
39 | #define M_CURSORDATA ((wxCursorRefData *)m_refData) | |
40 | #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) | |
41 | ||
42 | // Cursor | |
43 | class WXDLLEXPORT wxCursor: public wxBitmap | |
44 | { | |
45 | DECLARE_DYNAMIC_CLASS(wxCursor) | |
46 | ||
47 | public: | |
48 | wxCursor(); | |
49 | ||
50 | // Copy constructors | |
be52b341 GD |
51 | wxCursor(const wxCursor& cursor) |
52 | : wxBitmap() | |
53 | { Ref(cursor); } | |
0dbd6262 SC |
54 | |
55 | wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, | |
56 | const char maskBits[] = NULL); | |
57 | ||
c6a071d2 | 58 | wxCursor(const wxImage & image) ; |
78e053ec SC |
59 | wxCursor(const char **bits) ; |
60 | wxCursor(char **bits) ; | |
d921af51 | 61 | wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE, |
78e053ec | 62 | int hotSpotX = 0, int hotSpotY = 0); |
0dbd6262 SC |
63 | |
64 | wxCursor(int cursor_type); | |
65 | ~wxCursor(); | |
66 | ||
78e053ec | 67 | bool CreateFromXpm(const char **bits) ; |
c6a071d2 | 68 | virtual bool Ok() const { return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; } |
0dbd6262 SC |
69 | |
70 | inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; } | |
71 | inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; } | |
72 | inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; } | |
73 | ||
d921af51 | 74 | void MacInstall() const ; |
519cb848 | 75 | |
0dbd6262 SC |
76 | void SetHCURSOR(WXHCURSOR cursor); |
77 | inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } | |
c6a071d2 | 78 | private : |
ce72eadb | 79 | void CreateFromImage(const wxImage & image) ; |
0dbd6262 SC |
80 | }; |
81 | ||
82 | extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor); | |
83 | ||
84 | #endif | |
85 | // _WX_CURSOR_H_ |