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.

79 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef NAVIGATIONPANEL_H
  5. #define NAVIGATIONPANEL_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //-----------------------------------------------------------------------------
  10. #include "vgui_controls/EditablePanel.h"
  11. //-----------------------------------------------------------------------------
  12. namespace vgui
  13. {
  14. class Panel;
  15. class ImagePanel;
  16. };
  17. class CNavButton;
  18. class CExImageButton;
  19. //-----------------------------------------------------------------------------
  20. //
  21. // A generic panel containing a list of buttons which can be displayed vertically
  22. // or horizontally. One button at a time can be selected, and messages are sent
  23. // to the parent by default.
  24. //
  25. class CNavigationPanel : public vgui::EditablePanel
  26. {
  27. private:
  28. DECLARE_CLASS_SIMPLE( CNavigationPanel, vgui::EditablePanel );
  29. public:
  30. CNavigationPanel( vgui::Panel *pParent, const char *pName, bool bAddParentAsActionSignalTarget = true );
  31. virtual ~CNavigationPanel();
  32. void AddButton( int iUserData, const char *pTextToken );
  33. int NumButtons() const { return m_vecButtons.Count(); }
  34. CExImageButton *GetButton( int index );
  35. void UpdateButtonSelectionStates( int iButton );
  36. protected:
  37. virtual void PerformLayout();
  38. virtual void ApplySettings( KeyValues *pInResourceData );
  39. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  40. virtual void OnCommand( const char *pCommand );
  41. virtual void OnThink();
  42. CUtlVector< CNavButton * > m_vecButtons;
  43. bool m_bAutoLayout;
  44. bool m_bAutoScale; // Auto-scale buttons to proportionally match height (for horizontal display) or width (for vertical display)
  45. bool m_bDisplayVertical;
  46. int m_iSelectedButton; // The currently selected button
  47. KeyValues *m_pKVButtonSettings;
  48. /*
  49. enum Alignment_t
  50. {
  51. ALIGN_WEST, // left
  52. ALIGN_CENTER,
  53. };
  54. Alignment_t m_nAlignment;
  55. */
  56. // For auto-layout mode only
  57. CPanelAnimationVarAliasType( int, m_nHorizontalBuffer, "auto_layout_horizontal_buffer", "5", "proportional_xpos" );
  58. CPanelAnimationVarAliasType( int, m_nVerticalBuffer, "auto_layout_vertical_buffer", "5", "proportional_ypos" );
  59. CPanelAnimationVar( int, m_iSelectedButtonDefault, "selected_button_default", "-1" );
  60. };
  61. //-----------------------------------------------------------------------------
  62. #endif // NAVIGATIONPANEL_H