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.

99 lines
3.7 KiB

  1. #ifndef FOOTERPANEL_H
  2. #define FOOTERPANEL_H
  3. #ifdef _WIN32
  4. #pragma once
  5. #endif
  6. #include "vgui_controls/EditablePanel.h"
  7. namespace vgui
  8. {
  9. //-----------------------------------------------------------------------------
  10. // Purpose: Panel that acts as background for button icons and help text in the UI
  11. //-----------------------------------------------------------------------------
  12. class CFooterPanel : public vgui::EditablePanel
  13. {
  14. DECLARE_CLASS_SIMPLE( CFooterPanel, vgui::EditablePanel );
  15. public:
  16. CFooterPanel( Panel *parent, const char *panelName );
  17. virtual ~CFooterPanel();
  18. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  19. virtual void ApplySettings( KeyValues *pResourceData );
  20. virtual void Paint( void );
  21. virtual void PaintBackground( void );
  22. // caller tags the current hint, used to assist in ownership
  23. void SetHelpNameAndReset( const char *pName );
  24. const char *GetHelpName();
  25. void AddButtonsFromMap( vgui::Frame *pMenu );
  26. void SetStandardDialogButtons();
  27. void AddNewButtonLabel( const char *text, const char *icon );
  28. void ShowButtonLabel( const char *name, bool show = true );
  29. void SetButtonText( const char *buttonName, const char *text );
  30. void ClearButtons();
  31. void SetButtonGap( int nButtonGap ){ m_nButtonGap = nButtonGap; }
  32. void UseDefaultButtonGap(){ m_nButtonGap = m_nButtonGapDefault; }
  33. void SetButtonPinRight( int nButtonPinRight ) { m_ButtonPinRight = nButtonPinRight; }
  34. //=============================================================================
  35. // HPE_BEGIN:
  36. // [smessick]
  37. //=============================================================================
  38. // Returns the number of button labels.
  39. int GetButtonLabelCount( void ) const { return m_ButtonLabels.Count(); }
  40. // Sets the pin right location with adjustments based on the current
  41. // screen width and height. The given pixel offset is assumed to be based on
  42. // a 640x480 screen.
  43. void SetButtonPinRightProportional( int nButtonPinRight );
  44. // Center the footer horizontally.
  45. void SetCenterHorizontal( bool bCenterHorizontal ) { m_bCenterHorizontal = bCenterHorizontal; }
  46. // Set the y offset from the top of the screen.
  47. // The given pixel offset is assumed to be based on a 640x480 screen.
  48. void SetButtonOffsetFromTopProportional( int yOffset );
  49. //=============================================================================
  50. // HPE_END
  51. //=============================================================================
  52. private:
  53. struct ButtonLabel_t
  54. {
  55. bool bVisible;
  56. char name[MAX_PATH];
  57. wchar_t text[MAX_PATH];
  58. wchar_t icon[2]; // icon is a single character
  59. };
  60. CUtlVector< ButtonLabel_t* > m_ButtonLabels;
  61. vgui::Label *m_pSizingLabel; // used to measure font sizes
  62. bool m_bPaintBackground; // fill the background?
  63. bool m_bCenterHorizontal; // center buttons horizontally?
  64. int m_ButtonPinRight; // if not centered, this is the distance from the right margin that we use to start drawing buttons (right to left)
  65. int m_nButtonGap; // space between buttons when drawing
  66. int m_nButtonGapDefault; // space between buttons (initial value)
  67. int m_FooterTall; // height of the footer
  68. int m_ButtonOffsetFromTop; // how far below the top the buttons should be drawn
  69. int m_ButtonSeparator; // space between the button icon and text
  70. int m_TextAdjust; // extra adjustment for the text (vertically)...text is centered on the button icon and then this value is applied
  71. char m_szTextFont[64]; // font for the button text
  72. char m_szButtonFont[64]; // font for the button icon
  73. char m_szFGColor[64]; // foreground color (text)
  74. char m_szBGColor[64]; // background color (fill color)
  75. vgui::HFont m_hButtonFont;
  76. vgui::HFont m_hTextFont;
  77. char *m_pHelpName;
  78. };
  79. }
  80. #endif //FOOTERPANEL_H