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.

122 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef ENTITYREPORTPANEL_H
  7. #define ENTITYREPORTPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/editablepanel.h"
  12. #include "tier1/utlstring.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. class CFoundryDoc;
  17. class CDmeVMFEntity;
  18. namespace vgui
  19. {
  20. class ComboBox;
  21. class Button;
  22. class TextEntry;
  23. class ListPanel;
  24. class CheckButton;
  25. class RadioButton;
  26. }
  27. //-----------------------------------------------------------------------------
  28. // Panel that shows all entities in the level
  29. //-----------------------------------------------------------------------------
  30. class CEntityReportPanel : public vgui::EditablePanel
  31. {
  32. DECLARE_CLASS_SIMPLE( CEntityReportPanel, vgui::EditablePanel );
  33. public:
  34. CEntityReportPanel( CFoundryDoc *pDoc, vgui::Panel* pParent, const char *pName ); // standard constructor
  35. // Inherited from Panel
  36. virtual void OnTick();
  37. virtual void OnCommand( const char *pCommand );
  38. private:
  39. enum FilterType_t
  40. {
  41. FILTER_SHOW_EVERYTHING = 0,
  42. FILTER_SHOW_POINT_ENTITIES = 1,
  43. FILTER_SHOW_BRUSH_ENTITIES = 2
  44. };
  45. // Messages handled
  46. MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
  47. MESSAGE_FUNC_PARAMS( OnButtonToggled, "ButtonToggled", kv );
  48. MESSAGE_FUNC( OnDeleteEntities, "DeleteEntities" );
  49. // FIXME: Necessary because SetSelected doesn't cause a ButtonToggled message to trigger
  50. MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
  51. MESSAGE_FUNC_PARAMS( OnRadioButtonChecked, "RadioButtonChecked", kv );
  52. // Methods related to filtering
  53. void OnFilterByHidden( bool bState );
  54. void OnFilterByKeyvalue( bool bState );
  55. void OnFilterByClass( bool bState );
  56. void OnFilterKeyValueExact( bool bState );
  57. void OnFilterByType( FilterType_t type );
  58. void OnChangeFilterkey( const char *pText );
  59. void OnChangeFiltervalue( const char *pText );
  60. void OnChangeFilterclass( const char *pText );
  61. // Methods related to updating the listpanel
  62. void UpdateEntityList();
  63. bool ShouldAddEntityToList( CDmeVMFEntity *pEntity );
  64. // Methods related to saving settings
  65. void ReadSettingsFromRegistry();
  66. void SaveSettingsToRegistry();
  67. // Call this when our settings are dirty
  68. void MarkDirty( bool bFilterDirty );
  69. // Shows the most recent selected object in properties window
  70. void OnProperties();
  71. CFoundryDoc *m_pDoc;
  72. FilterType_t m_iFilterByType;
  73. bool m_bFilterByClass;
  74. bool m_bFilterByHidden;
  75. bool m_bFilterByKeyvalue;
  76. bool m_bExact;
  77. bool m_bSuppressEntityListUpdate;
  78. CUtlString m_szFilterKey;
  79. CUtlString m_szFilterValue;
  80. CUtlString m_szFilterClass;
  81. bool m_bFilterTextChanged;
  82. float m_flFilterTime;
  83. bool m_bRegistrySettingsChanged;
  84. float m_flRegistryTime;
  85. vgui::CheckButton *m_pExact;
  86. vgui::ComboBox *m_pFilterClass;
  87. vgui::CheckButton *m_pFilterByClass;
  88. vgui::ListPanel *m_pEntities;
  89. vgui::TextEntry *m_pFilterKey;
  90. vgui::TextEntry *m_pFilterValue;
  91. vgui::CheckButton *m_pFilterByKeyvalue;
  92. vgui::CheckButton *m_pFilterByHidden;
  93. vgui::RadioButton *m_pFilterEverything;
  94. vgui::RadioButton *m_pFilterPointEntities;
  95. vgui::RadioButton *m_pFilterBrushModels;
  96. };
  97. #endif // ENTITYREPORTPANEL_H