| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/os2/cursor.h |
| 3 | // Purpose: wxCursor class |
| 4 | // Author: David Webster |
| 5 | // Modified by: |
| 6 | // Created: 10/13/99 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) David Webster |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_CURSOR_H_ |
| 13 | #define _WX_CURSOR_H_ |
| 14 | |
| 15 | #include "wx/bitmap.h" |
| 16 | |
| 17 | class WXDLLIMPEXP_CORE wxCursorRefData: public wxGDIImageRefData |
| 18 | { |
| 19 | public: |
| 20 | wxCursorRefData(); |
| 21 | virtual ~wxCursorRefData() { Free(); } |
| 22 | virtual void Free(void); |
| 23 | bool m_bDestroyCursor; |
| 24 | }; // end of CLASS wxCursorRefData |
| 25 | |
| 26 | #define M_CURSORDATA ((wxCursorRefData *)m_refData) |
| 27 | #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) |
| 28 | |
| 29 | // Cursor |
| 30 | class WXDLLIMPEXP_CORE wxCursor: public wxBitmap |
| 31 | { |
| 32 | public: |
| 33 | wxCursor(); |
| 34 | |
| 35 | wxCursor(const wxImage& rImage); |
| 36 | |
| 37 | wxCursor( const wxString& rsName |
| 38 | ,wxBitmapType lType = wxCURSOR_DEFAULT_TYPE |
| 39 | ,int nHotSpotX = 0 |
| 40 | ,int nHotSpotY = 0 |
| 41 | ); |
| 42 | wxCursor(wxStockCursor id) { InitFromStock(id); } |
| 43 | #if WXWIN_COMPATIBILITY_2_8 |
| 44 | wxCursor(int id) { InitFromStock((wxStockCursor)id); } |
| 45 | #endif |
| 46 | inline ~wxCursor() { } |
| 47 | |
| 48 | inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } |
| 49 | inline void SetHCURSOR(WXHCURSOR hCursor) { SetHandle((WXHANDLE)hCursor); } |
| 50 | |
| 51 | protected: |
| 52 | void InitFromStock(wxStockCursor); |
| 53 | inline virtual wxGDIImageRefData* CreateData(void) const { return (new wxCursorRefData); } |
| 54 | |
| 55 | private: |
| 56 | DECLARE_DYNAMIC_CLASS(wxCursor) |
| 57 | }; // end of CLASS wxCursor |
| 58 | |
| 59 | #endif |
| 60 | // _WX_CURSOR_H_ |