cursor.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/motif/cursor.h
  3. // Purpose: wxCursor class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 17/09/98
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_CURSOR_H_
  11. #define _WX_CURSOR_H_
  12. #include "wx/gdiobj.h"
  13. #include "wx/gdicmn.h"
  14. class WXDLLIMPEXP_FWD_CORE wxImage;
  15. // Cursor
  16. class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
  17. {
  18. public:
  19. wxCursor();
  20. wxCursor(const char bits[], int width, int height,
  21. int hotSpotX = -1, int hotSpotY = -1,
  22. const char maskBits[] = NULL,
  23. const wxColour* fg = NULL, const wxColour* bg = NULL);
  24. wxCursor(const wxString& name,
  25. wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
  26. int hotSpotX = 0, int hotSpotY = 0);
  27. #if wxUSE_IMAGE
  28. wxCursor(const wxImage& image);
  29. #endif
  30. wxCursor(wxStockCursor id) { InitFromStock(id); }
  31. #if WXWIN_COMPATIBILITY_2_8
  32. wxCursor(int id) { InitFromStock((wxStockCursor)id); }
  33. #endif
  34. virtual ~wxCursor();
  35. // Motif-specific.
  36. // Create/get a cursor for the current display
  37. WXCursor GetXCursor(WXDisplay* display) const;
  38. protected:
  39. virtual wxGDIRefData *CreateGDIRefData() const;
  40. virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
  41. private:
  42. void InitFromStock(wxStockCursor);
  43. void Create(const char bits[], int width, int height,
  44. int hotSpotX = -1, int hotSpotY = -1,
  45. const char maskBits[] = NULL);
  46. void Create(WXPixmap cursor, WXPixmap mask, int hotSpotX, int hotSpotY);
  47. // Make a cursor from standard id
  48. WXCursor MakeCursor(WXDisplay* display, wxStockCursor id) const;
  49. DECLARE_DYNAMIC_CLASS(wxCursor)
  50. };
  51. extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor);
  52. #endif
  53. // _WX_CURSOR_H_