diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/dme_controls/BaseAttributeDoubleChoicePanel.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/dme_controls/BaseAttributeDoubleChoicePanel.h')
| -rw-r--r-- | public/dme_controls/BaseAttributeDoubleChoicePanel.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/public/dme_controls/BaseAttributeDoubleChoicePanel.h b/public/dme_controls/BaseAttributeDoubleChoicePanel.h new file mode 100644 index 0000000..28b1859 --- /dev/null +++ b/public/dme_controls/BaseAttributeDoubleChoicePanel.h @@ -0,0 +1,83 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// + +#ifndef BASEATTRIBUTEDOUBLECHOICEPANEL_H +#define BASEATTRIBUTEDOUBLECHOICEPANEL_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "dme_controls/BaseAttributePanel.h" + + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class CDmElement; +struct AttributeWidgetInfo_t; + +namespace vgui +{ + class IScheme; + class Panel; + class Label; + class ComboBox; +} + +//----------------------------------------------------------------------------- +// Purpose: Helper to horizontally lay out the two child combo boxes used by +// CBaseAttributeDoubleChoicePanel below +//----------------------------------------------------------------------------- +class CDoubleComboBoxContainerPanel : public vgui::Panel +{ + DECLARE_CLASS_SIMPLE( CDoubleComboBoxContainerPanel, vgui::Panel ); +public: + CDoubleComboBoxContainerPanel( vgui::Panel *parent, char const *name ); + void AddComboBox( int slot, vgui::ComboBox *box ); + +private: + + virtual void PerformLayout(); + + vgui::ComboBox *m_pBoxes[ 2 ]; +}; + +//----------------------------------------------------------------------------- +// CBaseAttributeDoubleChoicePanel (similar to CBaseAttributeChoicePanel, but with side by side combo boxes) +//----------------------------------------------------------------------------- +class CBaseAttributeDoubleChoicePanel : public CBaseAttributePanel +{ + DECLARE_CLASS_SIMPLE( CBaseAttributeDoubleChoicePanel, CBaseAttributePanel ); + +public: + CBaseAttributeDoubleChoicePanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info ); + + virtual void PostConstructor(); + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ); + +protected: + virtual void Refresh(); + +private: + // Derived classes can re-implement this to fill the combo box however they like + virtual void PopulateComboBoxes( vgui::ComboBox *pComboBox[2] ) = 0; + virtual void SetAttributeFromComboBoxes( vgui::ComboBox *pComboBox[2], KeyValues *pKeyValues[ 2 ] ) = 0; + virtual void SetComboBoxesFromAttribute( vgui::ComboBox *pComboBox[2] ) = 0; + + MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel ); + + virtual void Apply(); + virtual vgui::Panel *GetDataPanel(); + + CDoubleComboBoxContainerPanel *m_pContainerPanel; + vgui::ComboBox *m_pData[2]; +}; + + +#endif // BASEATTRIBUTEDOUBLECHOICEPANEL_H |