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.

81 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CLASSMENU_H
  8. #define CLASSMENU_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Frame.h>
  13. #include <vgui_controls/Button.h>
  14. #include <vgui_controls/HTML.h>
  15. #include <utlvector.h>
  16. #include <vgui/ILocalize.h>
  17. #include <vgui/KeyCode.h>
  18. #include <game/client/iviewport.h>
  19. #include "mouseoverpanelbutton.h"
  20. namespace vgui
  21. {
  22. class TextEntry;
  23. }
  24. //-----------------------------------------------------------------------------
  25. // Purpose: Draws the class menu
  26. //-----------------------------------------------------------------------------
  27. class CClassMenu : public vgui::Frame, public IViewPortPanel
  28. {
  29. private:
  30. DECLARE_CLASS_SIMPLE( CClassMenu, vgui::Frame );
  31. public:
  32. CClassMenu(IViewPort *pViewPort);
  33. CClassMenu(IViewPort *pViewPort, const char *panelName );
  34. virtual ~CClassMenu();
  35. virtual const char *GetName( void ) { return PANEL_CLASS; }
  36. virtual void SetData(KeyValues *data);
  37. virtual void Reset();
  38. virtual void Update() {};
  39. virtual bool NeedsUpdate( void ) { return false; }
  40. virtual bool HasInputElements( void ) { return true; }
  41. virtual void ShowPanel( bool bShow );
  42. // both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
  43. vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
  44. virtual bool IsVisible() { return BaseClass::IsVisible(); }
  45. virtual void SetParent( vgui::VPANEL parent ) { BaseClass::SetParent( parent ); }
  46. virtual GameActionSet_t GetPreferredActionSet() { return GAME_ACTION_SET_NONE; }
  47. protected:
  48. virtual vgui::Panel *CreateControlByName(const char *controlName);
  49. virtual MouseOverPanelButton* CreateNewMouseOverPanelButton(vgui::EditablePanel *panel);
  50. //vgui2 overrides
  51. virtual void OnKeyCodePressed(vgui::KeyCode code);
  52. // helper functions
  53. void SetLabelText(const char *textEntryName, const char *text);
  54. void SetVisibleButton(const char *textEntryName, bool state);
  55. // command callbacks
  56. void OnCommand( const char *command );
  57. IViewPort *m_pViewPort;
  58. ButtonCode_t m_iScoreBoardKey;
  59. int m_iTeam;
  60. vgui::EditablePanel *m_pPanel;
  61. CUtlVector< MouseOverPanelButton * > m_mouseoverButtons;
  62. };
  63. #endif // CLASSMENU_H