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.

111 lines
2.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef SEQUENCEPICKER_H
  7. #define SEQUENCEPICKER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/utlstring.h"
  12. #include "vgui_controls/Frame.h"
  13. #include "vgui_controls/EditablePanel.h"
  14. #include "vgui_controls/ImageList.h"
  15. #include "datacache/imdlcache.h"
  16. #include "matsys_controls/mdlpanel.h"
  17. //-----------------------------------------------------------------------------
  18. // Forward declarations
  19. //-----------------------------------------------------------------------------
  20. namespace vgui
  21. {
  22. class Splitter;
  23. }
  24. //-----------------------------------------------------------------------------
  25. // Purpose: Sequence picker panel
  26. //-----------------------------------------------------------------------------
  27. class CSequencePicker : public vgui::EditablePanel
  28. {
  29. DECLARE_CLASS_SIMPLE( CSequencePicker, vgui::EditablePanel );
  30. public:
  31. enum PickType_t
  32. {
  33. PICK_NONE = 0,
  34. PICK_SEQUENCES = 0x1,
  35. PICK_ACTIVITIES = 0x2,
  36. PICK_ALL = 0xFFFFFFFF,
  37. };
  38. // Flags come from PickType_t
  39. CSequencePicker( vgui::Panel *pParent, int nFlags = PICK_ALL );
  40. ~CSequencePicker();
  41. // overridden frame functions
  42. virtual void PerformLayout();
  43. // Sets the MDL to preview sequences for
  44. void SetMDL( const char *pMDLName );
  45. // Gets the selected activity/sequence
  46. PickType_t GetSelectedSequenceType();
  47. const char *GetSelectedSequenceName( );
  48. private:
  49. void RefreshActivitiesAndSequencesList();
  50. // Plays the selected activity
  51. void PlayActivity( const char *pActivityName );
  52. // Plays the selected sequence
  53. void PlaySequence( const char *pSequenceName );
  54. MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
  55. MESSAGE_FUNC( OnPageChanged, "PageChanged" );
  56. CMDLPanel *m_pMDLPreview;
  57. vgui::Splitter* m_pPreviewSplitter;
  58. vgui::PropertySheet *m_pViewsSheet;
  59. vgui::PropertyPage *m_pSequencesPage;
  60. vgui::PropertyPage *m_pActivitiesPage;
  61. vgui::ListPanel *m_pSequencesList;
  62. vgui::ListPanel *m_pActivitiesList;
  63. MDLHandle_t m_hSelectedMDL;
  64. CUtlString m_Filter;
  65. friend class CSequencePickerFrame;
  66. };
  67. //-----------------------------------------------------------------------------
  68. // Purpose: Main app window
  69. //-----------------------------------------------------------------------------
  70. class CSequencePickerFrame : public vgui::Frame
  71. {
  72. DECLARE_CLASS_SIMPLE( CSequencePickerFrame, vgui::Frame );
  73. public:
  74. CSequencePickerFrame( vgui::Panel *pParent, int nFlags );
  75. // Inherited from Frame
  76. virtual void OnCommand( const char *pCommand );
  77. // Purpose: Activate the dialog
  78. void DoModal( const char *pMDLName );
  79. private:
  80. MESSAGE_FUNC_PARAMS( OnSequencePreviewChanged, "SequencePreviewChanged", kv );
  81. CSequencePicker *m_pPicker;
  82. vgui::Button *m_pOpenButton;
  83. vgui::Button *m_pCancelButton;
  84. };
  85. #endif // SEQUENCEPICKER_H