Counter Strike : Global Offensive Source Code
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.

83 lines
2.5 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef BASEATTRIBUTEDOUBLECHOICEPANEL_H
  9. #define BASEATTRIBUTEDOUBLECHOICEPANEL_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "dme_controls/BaseAttributePanel.h"
  14. //-----------------------------------------------------------------------------
  15. // Forward declarations
  16. //-----------------------------------------------------------------------------
  17. class CDmElement;
  18. struct AttributeWidgetInfo_t;
  19. namespace vgui
  20. {
  21. class IScheme;
  22. class Panel;
  23. class Label;
  24. class ComboBox;
  25. }
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Helper to horizontally lay out the two child combo boxes used by
  28. // CBaseAttributeDoubleChoicePanel below
  29. //-----------------------------------------------------------------------------
  30. class CDoubleComboBoxContainerPanel : public vgui::Panel
  31. {
  32. DECLARE_CLASS_SIMPLE( CDoubleComboBoxContainerPanel, vgui::Panel );
  33. public:
  34. CDoubleComboBoxContainerPanel( vgui::Panel *parent, char const *name );
  35. void AddComboBox( int slot, vgui::ComboBox *box );
  36. private:
  37. virtual void PerformLayout();
  38. vgui::ComboBox *m_pBoxes[ 2 ];
  39. };
  40. //-----------------------------------------------------------------------------
  41. // CBaseAttributeDoubleChoicePanel (similar to CBaseAttributeChoicePanel, but with side by side combo boxes)
  42. //-----------------------------------------------------------------------------
  43. class CBaseAttributeDoubleChoicePanel : public CBaseAttributePanel
  44. {
  45. DECLARE_CLASS_SIMPLE( CBaseAttributeDoubleChoicePanel, CBaseAttributePanel );
  46. public:
  47. CBaseAttributeDoubleChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info );
  48. virtual void PostConstructor();
  49. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  50. protected:
  51. virtual void Refresh();
  52. private:
  53. // Derived classes can re-implement this to fill the combo box however they like
  54. virtual void PopulateComboBoxes( vgui::ComboBox *pComboBox[2] ) = 0;
  55. virtual void SetAttributeFromComboBoxes( vgui::ComboBox *pComboBox[2], KeyValues *pKeyValues[ 2 ] ) = 0;
  56. virtual void SetComboBoxesFromAttribute( vgui::ComboBox *pComboBox[2] ) = 0;
  57. MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
  58. virtual void Apply();
  59. virtual vgui::Panel *GetDataPanel();
  60. CDoubleComboBoxContainerPanel *m_pContainerPanel;
  61. vgui::ComboBox *m_pData[2];
  62. };
  63. #endif // BASEATTRIBUTEDOUBLECHOICEPANEL_H