platformCursorController.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _PLATFORMCURSORCONTROLLER_H_
  23. #define _PLATFORMCURSORCONTROLLER_H_
  24. #ifndef _TVECTOR_H_
  25. #include "core/util/tVector.h"
  26. #endif
  27. class PlatformWindow;
  28. class PlatformCursorController
  29. {
  30. protected:
  31. struct Cursor_Shape
  32. {
  33. enum Type
  34. {
  35. TYPE_RESOURCE,
  36. TYPE_FILE,
  37. };
  38. Type mCursorType;
  39. S32 mCursorID; // Points to a platform specific cursor ID
  40. String mCursorFile; // Points to a custom cursor file
  41. };
  42. Vector<Cursor_Shape> mCursors;
  43. /// The PlatformWindow that owns this Cursor Controller
  44. PlatformWindow *mOwner;
  45. public:
  46. PlatformCursorController( PlatformWindow *owner ) :
  47. mOwner( owner )
  48. {
  49. VECTOR_SET_ASSOCIATION( mCursors );
  50. };
  51. virtual ~PlatformCursorController()
  52. {
  53. mOwner = NULL;
  54. };
  55. enum
  56. {
  57. curArrow = 0,
  58. curWait,
  59. curPlus,
  60. curResizeVert,
  61. curResizeHorz,
  62. curResizeAll,
  63. curIBeam,
  64. curResizeNESW,
  65. curResizeNWSE,
  66. curHand,
  67. curWaitArrow,
  68. curNoNo,
  69. numPlatformCursors
  70. };
  71. public:
  72. virtual void setCursorPosition(S32 x, S32 y) = 0;
  73. virtual void getCursorPosition( Point2I &point ) = 0;
  74. virtual void setCursorVisible( bool visible ) = 0;
  75. virtual bool isCursorVisible() = 0;
  76. virtual void setCursorShape( const Cursor_Shape &shape, bool reload );
  77. virtual void setCursorShape( U32 cursorID ) = 0;
  78. virtual void setCursorShape( const UTF8 *filename, bool reload ) = 0;
  79. virtual void pushCursor( S32 cursorID );
  80. virtual void pushCursor( const UTF8 *fileName );
  81. virtual void popCursor();
  82. virtual void refreshCursor();
  83. virtual U32 getDoubleClickTime() = 0;
  84. virtual S32 getDoubleClickWidth() = 0;
  85. virtual S32 getDoubleClickHeight() = 0;
  86. };
  87. #endif