cursor.h 1.7 KB

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