VTimeLineControl.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //-----------------------------------------------------------------------------
  2. // Verve
  3. // Copyright (C) 2014 - Violent Tulip
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //-----------------------------------------------------------------------------
  23. #ifndef _VT_VTIMELINECONTROL_H_
  24. #define _VT_VTIMELINECONTROL_H_
  25. #ifndef _GUICONTROL_H_
  26. #include "gui/core/guiControl.h"
  27. #endif
  28. #ifndef _VT_VCONTROLLER_H_
  29. #include "Verve/Core/VController.h"
  30. #endif
  31. //-----------------------------------------------------------------------------
  32. class VTimeLineControl : public GuiControl
  33. {
  34. typedef GuiControl Parent;
  35. public:
  36. struct sSelection
  37. {
  38. bool Active;
  39. S32 StartTime;
  40. S32 EndTime;
  41. };
  42. bool mIsController;
  43. VController *mController;
  44. S32 mDurationOffset;
  45. sSelection mSelection;
  46. public:
  47. VTimeLineControl( void );
  48. static void initPersistFields( void );
  49. // Mouse.
  50. virtual void onMouseDown( const GuiEvent &pEvent );
  51. virtual void onMouseUp( const GuiEvent &pEvent );
  52. virtual void onMouseDragged( const GuiEvent &pEvent );
  53. virtual void onRightMouseDown( const GuiEvent &pEvent );
  54. void onMouseEvent( const char *pEventName, const GuiEvent &pEvent );
  55. // Rendering.
  56. void onPreRender( void );
  57. void onRender( Point2I offset, const RectI &updateRect );
  58. // Console Declaration.
  59. DECLARE_CONOBJECT( VTimeLineControl );
  60. public:
  61. S32 toTime( const S32 &pPoint );
  62. S32 toPoint( const S32 &pTime );
  63. void updateDuration( void );
  64. };
  65. //-----------------------------------------------------------------------------
  66. #endif // _VT_VTIMELINECONTROL_H_