Cursor.pkg 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. $#include "Cursor.h"
  2. /// %Cursor shapes recognized by the UI subsystem.
  3. enum CursorShape
  4. {
  5. CS_NORMAL = 0,
  6. CS_RESIZEVERTICAL,
  7. CS_RESIZEDIAGONAL_TOPRIGHT,
  8. CS_RESIZEHORIZONTAL,
  9. CS_RESIZEDIAGONAL_TOPLEFT,
  10. CS_ACCEPTDROP,
  11. CS_REJECTDROP,
  12. CS_BUSY,
  13. CS_MAX_SHAPES
  14. };
  15. /// Mouse cursor %UI element.
  16. class Cursor : public BorderImage
  17. {
  18. public:
  19. /// Construct.
  20. Cursor(Context* context);
  21. /// Destruct.
  22. virtual ~Cursor();
  23. /// Define a shape.
  24. void DefineShape(CursorShape shape, Image* image, const IntRect& imageRect, const IntVector2& hotSpot, bool osMouseVisible = false);
  25. /// Set current shape.
  26. void SetShape(CursorShape shape);
  27. /// Get current shape.
  28. CursorShape GetShape() const { return shape_; }
  29. };
  30. /// Create sprite without lua GC.
  31. Cursor* NewCursor(Context* context);
  32. /// Delete sprite.
  33. void Delete(Cursor* cursor);
  34. ${
  35. static Cursor* NewCursor(Context* context)
  36. {
  37. return new Cursor(context);
  38. }
  39. static void Delete(Cursor* cursor)
  40. {
  41. delete cursor;
  42. }
  43. $}