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.

96 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef BASEANIMSETCONTROLGROUPPANEL_H
  7. #define BASEANIMSETCONTROLGROUPPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/EditablePanel.h"
  12. #include "datamodel/dmehandle.h"
  13. #include "tier1/utlntree.h"
  14. //-----------------------------------------------------------------------------
  15. // Forward declarations
  16. //-----------------------------------------------------------------------------
  17. class CBaseAnimationSetEditor;
  18. class CDmeAnimationSet;
  19. namespace vgui
  20. {
  21. class TreeView;
  22. class IScheme;
  23. class Menu;
  24. };
  25. //-----------------------------------------------------------------------------
  26. // Panel which shows a tree of controls
  27. //-----------------------------------------------------------------------------
  28. class CBaseAnimSetControlGroupPanel : public vgui::EditablePanel
  29. {
  30. DECLARE_CLASS_SIMPLE( CBaseAnimSetControlGroupPanel, EditablePanel );
  31. public:
  32. CBaseAnimSetControlGroupPanel( vgui::Panel *parent, char const *className, CBaseAnimationSetEditor *editor );
  33. virtual ~CBaseAnimSetControlGroupPanel();
  34. void ChangeAnimationSet( CDmeAnimationSet *newAnimSet );
  35. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  36. protected:
  37. MESSAGE_FUNC_INT( OnTreeViewItemSelected, "TreeViewItemSelected", itemIndex );
  38. MESSAGE_FUNC_INT( OnTreeViewItemDeselected, "TreeViewItemDeselected", itemIndex );
  39. MESSAGE_FUNC( OnTreeViewItemSelectionCleared, "TreeViewItemSelectionCleared" );
  40. protected:
  41. enum
  42. {
  43. EP_EXPANDED = (1<<0),
  44. EP_SELECTED = (1<<1),
  45. };
  46. struct TreeItem_t
  47. {
  48. TreeItem_t() : m_pAttributeName() {}
  49. CUtlString m_pAttributeName;
  50. };
  51. // Used to build a list of open element for refresh
  52. struct TreeInfo_t
  53. {
  54. TreeInfo_t() : m_nFlags( 0 ) {}
  55. TreeItem_t m_Item; // points to the element referenced in an element array
  56. int m_nFlags;
  57. };
  58. typedef CUtlNTree< TreeInfo_t, int > OpenItemTree_t;
  59. // Expands all items in the open item tree if they exist
  60. void ExpandOpenItems( OpenItemTree_t &tree, int nOpenTreeIndex, int nItemIndex, bool makeVisible );
  61. // Builds a list of open items
  62. void BuildOpenItemList( OpenItemTree_t &tree, int nParent, int nItemIndex );
  63. void FillInDataForItem( TreeItem_t &item, int nItemIndex );
  64. // Finds the tree index of a child matching the particular element + attribute
  65. int FindTreeItem( int nParentIndex, const TreeItem_t &info );
  66. vgui::DHANDLE< CBaseAnimationSetEditor > m_hEditor;
  67. vgui::DHANDLE< vgui::TreeView > m_hGroups;
  68. CUtlVector< int > m_hSelectableIndices;
  69. CDmeHandle< CDmeAnimationSet > m_AnimSet;
  70. bool m_bStartItemWasSelected;
  71. CUtlVector< int > m_SavedSelectedGroups;
  72. CUtlSymbolTable m_SliderNames;
  73. CUtlVector< CDmeHandle< CDmElement > > m_GroupList;
  74. friend class CAnimGroupTree;
  75. };
  76. #endif // BASEANIMSETCONTROLGROUPPANEL_H