| 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 |
| 8 | // RCS-ID: $Id$ |
| 9 | // Licence: wxWindows Licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_CURSOR_H_BASE_ |
| 13 | #define _WX_CURSOR_H_BASE_ |
| 14 | |
| 15 | #include "wx/defs.h" |
| 16 | |
| 17 | #if defined(__WXPALMOS__) |
| 18 | #include "wx/palmos/cursor.h" |
| 19 | #elif defined(__WXMSW__) |
| 20 | #include "wx/msw/cursor.h" |
| 21 | #elif defined(__WXMOTIF__) |
| 22 | #include "wx/motif/cursor.h" |
| 23 | #elif defined(__WXGTK20__) |
| 24 | #include "wx/gtk/cursor.h" |
| 25 | #elif defined(__WXGTK__) |
| 26 | #include "wx/gtk1/cursor.h" |
| 27 | #elif defined(__WXX11__) |
| 28 | #include "wx/x11/cursor.h" |
| 29 | #elif defined(__WXMGL__) |
| 30 | #include "wx/mgl/cursor.h" |
| 31 | #elif defined(__WXMAC__) |
| 32 | #include "wx/mac/cursor.h" |
| 33 | #elif defined(__WXCOCOA__) |
| 34 | #include "wx/cocoa/cursor.h" |
| 35 | #elif defined(__WXPM__) |
| 36 | #include "wx/os2/cursor.h" |
| 37 | #endif |
| 38 | |
| 39 | #include "wx/utils.h" |
| 40 | |
| 41 | /* This is a small class which can be used by all ports |
| 42 | to temporarily suspend the busy cursor. Useful in modal |
| 43 | dialogs. |
| 44 | |
| 45 | Actually that is not (any longer) quite true.. currently it is |
| 46 | only used in wxGTK Dialog::ShowModal() and now uses static |
| 47 | wxBusyCursor methods that are only implemented for wxGTK so far. |
| 48 | The BusyCursor handling code should probably be implemented in |
| 49 | common code somewhere instead of the separate implementations we |
| 50 | currently have. Also the name BusyCursorSuspender is a little |
| 51 | misleading since it doesn't actually suspend the BusyCursor, just |
| 52 | masks one that is already showing. |
| 53 | If another call to wxBeginBusyCursor is made while this is active |
| 54 | the Busy Cursor will again be shown. But at least now it doesn't |
| 55 | interfere with the state of wxIsBusy() -- RL |
| 56 | |
| 57 | */ |
| 58 | class wxBusyCursorSuspender |
| 59 | { |
| 60 | public: |
| 61 | wxBusyCursorSuspender() |
| 62 | { |
| 63 | if( wxIsBusy() ) |
| 64 | { |
| 65 | wxSetCursor( wxBusyCursor::GetStoredCursor() ); |
| 66 | } |
| 67 | } |
| 68 | ~wxBusyCursorSuspender() |
| 69 | { |
| 70 | if( wxIsBusy() ) |
| 71 | { |
| 72 | wxSetCursor( wxBusyCursor::GetBusyCursor() ); |
| 73 | } |
| 74 | } |
| 75 | }; |
| 76 | #endif |
| 77 | // _WX_CURSOR_H_BASE_ |