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 /game/client/game_controls/navigationpanel.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/game_controls/navigationpanel.h')
| -rw-r--r-- | game/client/game_controls/navigationpanel.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/game/client/game_controls/navigationpanel.h b/game/client/game_controls/navigationpanel.h new file mode 100644 index 0000000..528191b --- /dev/null +++ b/game/client/game_controls/navigationpanel.h @@ -0,0 +1,79 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +//=======================================================================================// + +#ifndef NAVIGATIONPANEL_H +#define NAVIGATIONPANEL_H +#ifdef _WIN32 +#pragma once +#endif + +//----------------------------------------------------------------------------- + +#include "vgui_controls/EditablePanel.h" + +//----------------------------------------------------------------------------- + +namespace vgui +{ + class Panel; + class ImagePanel; +}; +class CNavButton; +class CExImageButton; + +//----------------------------------------------------------------------------- + +// +// A generic panel containing a list of buttons which can be displayed vertically +// or horizontally. One button at a time can be selected, and messages are sent +// to the parent by default. +// +class CNavigationPanel : public vgui::EditablePanel +{ +private: + DECLARE_CLASS_SIMPLE( CNavigationPanel, vgui::EditablePanel ); + +public: + CNavigationPanel( vgui::Panel *pParent, const char *pName, bool bAddParentAsActionSignalTarget = true ); + virtual ~CNavigationPanel(); + + void AddButton( int iUserData, const char *pTextToken ); + int NumButtons() const { return m_vecButtons.Count(); } + CExImageButton *GetButton( int index ); + + void UpdateButtonSelectionStates( int iButton ); + +protected: + virtual void PerformLayout(); + virtual void ApplySettings( KeyValues *pInResourceData ); + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ); + virtual void OnCommand( const char *pCommand ); + virtual void OnThink(); + + CUtlVector< CNavButton * > m_vecButtons; + bool m_bAutoLayout; + bool m_bAutoScale; // Auto-scale buttons to proportionally match height (for horizontal display) or width (for vertical display) + bool m_bDisplayVertical; + int m_iSelectedButton; // The currently selected button + KeyValues *m_pKVButtonSettings; + + /* + enum Alignment_t + { + ALIGN_WEST, // left + ALIGN_CENTER, + }; + + Alignment_t m_nAlignment; + */ + + // For auto-layout mode only + CPanelAnimationVarAliasType( int, m_nHorizontalBuffer, "auto_layout_horizontal_buffer", "5", "proportional_xpos" ); + CPanelAnimationVarAliasType( int, m_nVerticalBuffer, "auto_layout_vertical_buffer", "5", "proportional_ypos" ); + CPanelAnimationVar( int, m_iSelectedButtonDefault, "selected_button_default", "-1" ); +}; + +//----------------------------------------------------------------------------- + +#endif // NAVIGATIONPANEL_H |