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.

68 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef ATTRIBUTESTRINGCHOICEPANEL_h
  9. #define ATTRIBUTESTRINGCHOICEPANEL_h
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "dme_controls/BaseAttributeChoicePanel.h"
  14. #include "movieobjects/dmeeditortypedictionary.h"
  15. #include "vgui_controls/MessageMap.h"
  16. //-----------------------------------------------------------------------------
  17. // Forward declarations
  18. //-----------------------------------------------------------------------------
  19. struct AttributeWidgetInfo_t;
  20. namespace vgui
  21. {
  22. class Panel;
  23. class ComboBox;
  24. }
  25. //-----------------------------------------------------------------------------
  26. // Configuration for string choices
  27. //-----------------------------------------------------------------------------
  28. class CDmeEditorStringChoicesInfo : public CDmeEditorChoicesInfo
  29. {
  30. DEFINE_ELEMENT( CDmeEditorStringChoicesInfo, CDmeEditorChoicesInfo );
  31. public:
  32. // Add a choice
  33. CDmElement *AddChoice( const char *pValueString, const char *pChoiceString );
  34. // Gets the choices
  35. const char *GetChoiceValue( int nIndex ) const;
  36. };
  37. //-----------------------------------------------------------------------------
  38. // CAttributeStringChoicePanel
  39. //-----------------------------------------------------------------------------
  40. class CAttributeStringChoicePanel : public CBaseAttributeChoicePanel
  41. {
  42. DECLARE_CLASS_SIMPLE( CAttributeStringChoicePanel, CBaseAttributeChoicePanel );
  43. public:
  44. CAttributeStringChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
  45. private:
  46. // Derived classes can re-implement this to fill the combo box however they like
  47. virtual void PopulateComboBox( vgui::ComboBox *pComboBox );
  48. virtual void SetAttributeFromComboBox( vgui::ComboBox *pComboBox, KeyValues *pKeyValues );
  49. virtual void SetComboBoxFromAttribute( vgui::ComboBox *pComboBox );
  50. };
  51. // ----------------------------------------------------------------------------
  52. #endif // ATTRIBUTESTRINGCHOICEPANEL_h