]>
Commit | Line | Data |
---|---|---|
99d80019 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cursor.h | |
3 | // Purpose: wxCursor base header | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Julian Smart | |
99d80019 JS |
8 | // Licence: wxWindows Licence |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
34138703 JS |
11 | #ifndef _WX_CURSOR_H_BASE_ |
12 | #define _WX_CURSOR_H_BASE_ | |
c801d85f | 13 | |
86d2c809 VZ |
14 | #include "wx/defs.h" |
15 | ||
d6764050 FM |
16 | /* |
17 | wxCursor classes should have the following public API: | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject | |
20 | { | |
21 | public: | |
22 | wxCursor(); | |
23 | wxCursor(const wxImage& image); | |
24 | wxCursor(const wxString& name, | |
25 | wxBitmapType type = wxCURSOR_DEFAULT_TYPE, | |
26 | int hotSpotX = 0, int hotSpotY = 0); | |
27 | wxCursor(wxStockCursor id) { InitFromStock(id); } | |
28 | #if WXWIN_COMPATIBILITY_2_8 | |
29 | wxCursor(int id) { InitFromStock((wxStockCursor)id); } | |
30 | #endif | |
31 | virtual ~wxCursor(); | |
32 | }; | |
33 | ||
34 | */ | |
35 | ||
bd362275 | 36 | #if defined(__WXMSW__) |
0ef5b1da | 37 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
86d2c809 | 38 | #include "wx/msw/cursor.h" |
2049ba38 | 39 | #elif defined(__WXMOTIF__) |
0ef5b1da | 40 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM |
86d2c809 | 41 | #include "wx/motif/cursor.h" |
1be7a35c | 42 | #elif defined(__WXGTK20__) |
327972e7 VZ |
43 | #ifdef __WINDOWS__ |
44 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE | |
45 | #else | |
46 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM | |
47 | #endif | |
86d2c809 | 48 | #include "wx/gtk/cursor.h" |
1be7a35c | 49 | #elif defined(__WXGTK__) |
0ef5b1da | 50 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM |
1be7a35c | 51 | #include "wx/gtk1/cursor.h" |
83df96d6 | 52 | #elif defined(__WXX11__) |
0ef5b1da | 53 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM |
86d2c809 | 54 | #include "wx/x11/cursor.h" |
b3c86150 | 55 | #elif defined(__WXDFB__) |
0ef5b1da | 56 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
b3c86150 | 57 | #include "wx/dfb/cursor.h" |
34138703 | 58 | #elif defined(__WXMAC__) |
0ef5b1da | 59 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE |
ef0e9220 | 60 | #include "wx/osx/cursor.h" |
e64df9bc | 61 | #elif defined(__WXCOCOA__) |
167d0cb3 | 62 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE |
86d2c809 | 63 | #include "wx/cocoa/cursor.h" |
1777b9bb | 64 | #elif defined(__WXPM__) |
0ef5b1da | 65 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
86d2c809 | 66 | #include "wx/os2/cursor.h" |
c801d85f KB |
67 | #endif |
68 | ||
eebe4016 | 69 | #include "wx/utils.h" |
83141d3a | 70 | |
eebe4016 KB |
71 | /* This is a small class which can be used by all ports |
72 | to temporarily suspend the busy cursor. Useful in modal | |
73 | dialogs. | |
f6bcfd97 BP |
74 | |
75 | Actually that is not (any longer) quite true.. currently it is | |
76 | only used in wxGTK Dialog::ShowModal() and now uses static | |
77 | wxBusyCursor methods that are only implemented for wxGTK so far. | |
78 | The BusyCursor handling code should probably be implemented in | |
79 | common code somewhere instead of the separate implementations we | |
80 | currently have. Also the name BusyCursorSuspender is a little | |
81 | misleading since it doesn't actually suspend the BusyCursor, just | |
82 | masks one that is already showing. | |
83 | If another call to wxBeginBusyCursor is made while this is active | |
84 | the Busy Cursor will again be shown. But at least now it doesn't | |
85 | interfere with the state of wxIsBusy() -- RL | |
86 | ||
eebe4016 KB |
87 | */ |
88 | class wxBusyCursorSuspender | |
89 | { | |
90 | public: | |
f6bcfd97 BP |
91 | wxBusyCursorSuspender() |
92 | { | |
93 | if( wxIsBusy() ) | |
94 | { | |
95 | wxSetCursor( wxBusyCursor::GetStoredCursor() ); | |
f6bcfd97 BP |
96 | } |
97 | } | |
98 | ~wxBusyCursorSuspender() | |
99 | { | |
100 | if( wxIsBusy() ) | |
101 | { | |
102 | wxSetCursor( wxBusyCursor::GetBusyCursor() ); | |
f6bcfd97 BP |
103 | } |
104 | } | |
eebe4016 | 105 | }; |
c801d85f | 106 | #endif |
34138703 | 107 | // _WX_CURSOR_H_BASE_ |