cursor.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/cursor.h
  3. // Purpose: wxCursor class
  4. // Author: David Elliott <dfe@cox.net>
  5. // Modified by:
  6. // Created: 2002/11/27
  7. // Copyright: (c) David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COCOA_CURSOR_H_
  11. #define _WX_COCOA_CURSOR_H_
  12. #include "wx/bitmap.h"
  13. class WXDLLIMPEXP_CORE wxCursorRefData : public wxGDIRefData
  14. {
  15. public:
  16. wxCursorRefData();
  17. virtual ~wxCursorRefData();
  18. protected:
  19. int m_width, m_height;
  20. WX_NSCursor m_hCursor;
  21. friend class WXDLLIMPEXP_FWD_CORE wxBitmap;
  22. friend class WXDLLIMPEXP_FWD_CORE wxCursor;
  23. wxDECLARE_NO_COPY_CLASS(wxCursorRefData);
  24. };
  25. #define M_CURSORDATA ((wxCursorRefData *)m_refData)
  26. #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
  27. // Cursor
  28. class WXDLLIMPEXP_CORE wxCursor: public wxBitmap
  29. {
  30. public:
  31. wxCursor();
  32. wxCursor(const wxString& name, wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
  33. int hotSpotX = 0, int hotSpotY = 0);
  34. wxCursor(wxStockCursor id) { InitFromStock(id); }
  35. #if WXWIN_COMPATIBILITY_2_8
  36. wxCursor(int id) { InitFromStock((wxStockCursor)id); }
  37. #endif
  38. virtual ~wxCursor();
  39. // FIXME: operator==() is wrong!
  40. bool operator==(const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
  41. bool operator!=(const wxCursor& cursor) const { return !(*this == cursor); }
  42. WX_NSCursor GetNSCursor() const { return M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0; }
  43. private:
  44. void InitFromStock(wxStockCursor);
  45. DECLARE_DYNAMIC_CLASS(wxCursor)
  46. };
  47. extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor);
  48. #endif
  49. // _WX_COCOA_CURSOR_H_