Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CHOREOWIDGET_H
  8. #define CHOREOWIDGET_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <mxtk/mx.h>
  13. class CChoreoView;
  14. class CChoreoScene;
  15. class CChoreoWidgetDrawHelper;
  16. //-----------------------------------------------------------------------------
  17. // Purpose: CChoreoWidgets are mxWindows that we show in the Choreography view area
  18. // so that we can manipulate them with the mouse. The widgets follow the scene
  19. // hierarchy of actors/channels/events, without having to hang off of the underlying
  20. // data. They are just for the UI.
  21. //-----------------------------------------------------------------------------
  22. class CChoreoWidget
  23. {
  24. public:
  25. // memory handling, uses calloc so members are zero'd out on instantiation
  26. void *operator new( size_t stAllocateBlock );
  27. void operator delete( void *pMem );
  28. CChoreoWidget( CChoreoWidget *parent );
  29. virtual ~CChoreoWidget( void );
  30. // All widgets implement these pure virtuals
  31. // Called to force a widget to create its children based on the scene data
  32. virtual void Create( void ) = 0;
  33. // Force widget to redo layout of self and any children
  34. virtual void Layout( RECT& rc ) = 0;
  35. // Redraw the widget
  36. virtual void redraw( CChoreoWidgetDrawHelper& drawHelper ) = 0;
  37. // Don't overdraw background
  38. virtual bool PaintBackground( void ) { return false; };
  39. // Determine height to reserver for widget ( Actors can be expanded or collapsed, e.g. )
  40. virtual int GetItemHeight( void );
  41. virtual void LocalToScreen( int& mx, int& my );
  42. virtual bool IsSelected( void );
  43. virtual void SetSelected( bool selected );
  44. virtual void setBounds( int x, int y, int w, int h );
  45. virtual int x( void );
  46. virtual int y( void );
  47. virtual int w( void );
  48. virtual int h( void );
  49. virtual CChoreoWidget *getParent( void );
  50. virtual void setVisible( bool visible );
  51. virtual bool getVisible( void );
  52. virtual void getBounds( RECT& bounds );
  53. virtual RECT &getBounds( void );
  54. // Globally accessible scene and view pointers
  55. static CChoreoScene *m_pScene;
  56. static CChoreoView *m_pView;
  57. private:
  58. bool m_bSelected;
  59. bool m_bVisible;
  60. RECT m_rcBounds;
  61. protected:
  62. CChoreoWidget *m_pParent;
  63. };
  64. #endif // CHOREOWIDGET_H