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.

120 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CHOREOCHANNELWIDGET_H
  8. #define CHOREOCHANNELWIDGET_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "choreowidget.h"
  13. #include "utlvector.h"
  14. class CChoreoEventWidget;
  15. class CChoreoActorWidget;
  16. class CChoreoChannel;
  17. class CChoreoChannelWidget;
  18. //-----------------------------------------------------------------------------
  19. // Purpose: The channel container
  20. //-----------------------------------------------------------------------------
  21. class CChoreoChannelWidget : public CChoreoWidget
  22. {
  23. public:
  24. typedef CChoreoWidget BaseClass;
  25. enum
  26. {
  27. FULLMENU = 0,
  28. NEWEVENTMENU
  29. };
  30. enum
  31. {
  32. CLOSECAPTION_NONE = 0,
  33. CLOSECAPTION_EXPANDCOLLAPSE,
  34. CLOSECAPTION_PREVLANGUAGE,
  35. CLOSECAPTION_NEXTLANGUAGE,
  36. CLOSECAPTION_SELECTOR,
  37. CLOSECAPTION_CAPTION,
  38. };
  39. // Construction
  40. CChoreoChannelWidget( CChoreoActorWidget *parent );
  41. virtual ~CChoreoChannelWidget( void );
  42. virtual void Create( void );
  43. virtual void Layout( RECT& rc );
  44. virtual int GetItemHeight( void );
  45. virtual void redraw(CChoreoWidgetDrawHelper& drawHelper);
  46. virtual void redrawStatus( CChoreoWidgetDrawHelper& drawHelper, RECT& rcClient, int areaUnderMouse );
  47. // Accessors
  48. CChoreoChannel *GetChannel( void );
  49. void SetChannel( CChoreoChannel *channel );
  50. // Manipulate child events
  51. void AddEvent( CChoreoEventWidget *event );
  52. void RemoveEvent( CChoreoEventWidget *event );
  53. void MoveEventToTail( CChoreoEventWidget *event );
  54. CChoreoEventWidget *GetEvent( int num );
  55. int GetNumEvents( void );
  56. // Determine time for click position
  57. float GetTimeForMousePosition( int mx );
  58. int GetChannelItemUnderMouse( int mx, int my );
  59. CChoreoEvent *GetCaptionClickedEvent();
  60. void GetMasterAndSlaves( CChoreoEvent *master, CUtlVector< CChoreoEvent * >& fulllist );
  61. void HandleSelectorClicked();
  62. private:
  63. struct CloseCaptionInfo
  64. {
  65. bool isSelector;
  66. RECT rcSelector;
  67. RECT rcCaption;
  68. int eventindex;
  69. };
  70. void GetCloseCaptionExpandCollapseRect( RECT& rc );
  71. void GetCloseCaptionLanguageRect( RECT& rc, bool previous );
  72. void GetCloseCaptions( CUtlVector< CloseCaptionInfo >& selectors );
  73. int GetVerticalStackingCount( bool dolayout, RECT* rc );
  74. void LayoutEventInRow( CChoreoEventWidget *event, int row, RECT& rc );
  75. void RenderCloseCaptionInfo( CChoreoWidgetDrawHelper& drawHelper, RECT& rcEventArea );
  76. void RenderCloseCaptions( CChoreoWidgetDrawHelper& drawHelper, RECT& rcEventArea );
  77. void RenderCloseCaptionExpandCollapseRect( CChoreoWidgetDrawHelper& drawHelper, RECT& rcEventArea );
  78. void RenderCloseCaptionSelectors( CChoreoWidgetDrawHelper& drawHelper, RECT& rcEventArea );
  79. void SetUsingCombinedFieldByTokenName( char const *token, bool usingcombinedfile );
  80. bool CheckHasAudio();
  81. // The actor to whom we belong
  82. CChoreoActorWidget *m_pParent;
  83. // The underlying scene object
  84. CChoreoChannel *m_pChannel;
  85. // Children
  86. CUtlVector < CChoreoEventWidget * > m_Events;
  87. bool m_bHasAudio;
  88. int m_nBaseHeight;
  89. int m_nSelectorEventIndex;
  90. };
  91. #endif // CHOREOCHANNELWIDGET_H