| 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 | /* |
| 18 | wxCursor classes should have the following public API: |
| 19 | |
| 20 | class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject |
| 21 | { |
| 22 | public: |
| 23 | wxCursor(); |
| 24 | wxCursor(const wxImage& image); |
| 25 | wxCursor(const wxString& name, |
| 26 | wxBitmapType type = wxCURSOR_DEFAULT_TYPE, |
| 27 | int hotSpotX = 0, int hotSpotY = 0); |
| 28 | wxCursor(wxStockCursor id) { InitFromStock(id); } |
| 29 | #if WXWIN_COMPATIBILITY_2_8 |
| 30 | wxCursor(int id) { InitFromStock((wxStockCursor)id); } |
| 31 | #endif |
| 32 | virtual ~wxCursor(); |
| 33 | }; |
| 34 | |
| 35 | */ |
| 36 | |
| 37 | #if defined(__WXPALMOS__) |
| 38 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
| 39 | #include "wx/palmos/cursor.h" |
| 40 | #elif defined(__WXMSW__) |
| 41 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
| 42 | #include "wx/msw/cursor.h" |
| 43 | #elif defined(__WXMOTIF__) |
| 44 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM |
| 45 | #include "wx/motif/cursor.h" |
| 46 | #elif defined(__WXGTK20__) |
| 47 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM |
| 48 | #include "wx/gtk/cursor.h" |
| 49 | #elif defined(__WXGTK__) |
| 50 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM |
| 51 | #include "wx/gtk1/cursor.h" |
| 52 | #elif defined(__WXX11__) |
| 53 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM |
| 54 | #include "wx/x11/cursor.h" |
| 55 | #elif defined(__WXMGL__) |
| 56 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
| 57 | #include "wx/mgl/cursor.h" |
| 58 | #elif defined(__WXDFB__) |
| 59 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
| 60 | #include "wx/dfb/cursor.h" |
| 61 | #elif defined(__WXMAC__) |
| 62 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE |
| 63 | #include "wx/osx/cursor.h" |
| 64 | #elif defined(__WXCOCOA__) |
| 65 | #define wxCURSOR_DEFAULT_TYPE 0 |
| 66 | #include "wx/cocoa/cursor.h" |
| 67 | #elif defined(__WXPM__) |
| 68 | #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE |
| 69 | #include "wx/os2/cursor.h" |
| 70 | #endif |
| 71 | |
| 72 | #include "wx/utils.h" |
| 73 | |
| 74 | /* This is a small class which can be used by all ports |
| 75 | to temporarily suspend the busy cursor. Useful in modal |
| 76 | dialogs. |
| 77 | |
| 78 | Actually that is not (any longer) quite true.. currently it is |
| 79 | only used in wxGTK Dialog::ShowModal() and now uses static |
| 80 | wxBusyCursor methods that are only implemented for wxGTK so far. |
| 81 | The BusyCursor handling code should probably be implemented in |
| 82 | common code somewhere instead of the separate implementations we |
| 83 | currently have. Also the name BusyCursorSuspender is a little |
| 84 | misleading since it doesn't actually suspend the BusyCursor, just |
| 85 | masks one that is already showing. |
| 86 | If another call to wxBeginBusyCursor is made while this is active |
| 87 | the Busy Cursor will again be shown. But at least now it doesn't |
| 88 | interfere with the state of wxIsBusy() -- RL |
| 89 | |
| 90 | */ |
| 91 | class wxBusyCursorSuspender |
| 92 | { |
| 93 | public: |
| 94 | wxBusyCursorSuspender() |
| 95 | { |
| 96 | if( wxIsBusy() ) |
| 97 | { |
| 98 | wxSetCursor( wxBusyCursor::GetStoredCursor() ); |
| 99 | } |
| 100 | } |
| 101 | ~wxBusyCursorSuspender() |
| 102 | { |
| 103 | if( wxIsBusy() ) |
| 104 | { |
| 105 | wxSetCursor( wxBusyCursor::GetBusyCursor() ); |
| 106 | } |
| 107 | } |
| 108 | }; |
| 109 | #endif |
| 110 | // _WX_CURSOR_H_BASE_ |