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.

67 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef VARLISTPROPERTYPAGE_H
  8. #define VARLISTPROPERTYPAGE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <KeyValues.h>
  13. #include <vgui_controls/PropertyPage.h>
  14. #include "utlvector.h"
  15. #include "RemoteServer.h"
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Property page for use in the server admin tool
  18. // holds a list of variables and manages the editing of them
  19. //-----------------------------------------------------------------------------
  20. class CVarListPropertyPage : public vgui::PropertyPage, public IServerDataResponse
  21. {
  22. DECLARE_CLASS_SIMPLE( CVarListPropertyPage, vgui::PropertyPage );
  23. public:
  24. CVarListPropertyPage(vgui::Panel *parent, const char *name);
  25. ~CVarListPropertyPage();
  26. // loads the var list description from the specified file
  27. bool LoadVarList(const char *varfile);
  28. // sets the value of a variable
  29. void SetVarString(const char *varName, const char *value);
  30. // gets back the value of a variable
  31. const char *GetVarString(const char *varName);
  32. // refreshes all the values of cvars in the list
  33. virtual void RefreshVarList();
  34. // sets a custom string list for a combobox edit
  35. // stringList is a newline-delimited set of strings
  36. void SetCustomStringList(const char *varName, const char *stringList);
  37. protected:
  38. // override to change how a variable is edited
  39. virtual void OnEditVariable(KeyValues *rule);
  40. // handles responses from the server
  41. virtual void OnServerDataResponse(const char *value, const char *response);
  42. // vgui overrides
  43. virtual void PerformLayout();
  44. virtual void OnKeyCodeTyped(vgui::KeyCode code);
  45. MESSAGE_FUNC_CHARPTR( OnVarChanged, "VarChanged", var );
  46. private:
  47. MESSAGE_FUNC( EditVariable, "EditVariable" );
  48. MESSAGE_FUNC( OnItemSelected, "ItemSelected" );
  49. vgui::ListPanel *m_pRulesList;
  50. vgui::Button *m_pEditButton;
  51. };
  52. #endif // VARLISTPROPERTYPAGE_H