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.

64 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef LOADOUT_PRESET_PANEL_H
  5. #define LOADOUT_PRESET_PANEL_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. #include "vgui_controls/EditablePanel.h"
  10. #include "vgui_controls/PHandle.h"
  11. #include "class_loadout_panel.h"
  12. class CExButton;
  13. class CSelectedItemPreset;
  14. //-----------------------------------------------------------------------------
  15. // A loadout preset panel, which allows combinations of items to be saved and
  16. // restored via the GC.
  17. //-----------------------------------------------------------------------------
  18. class CLoadoutPresetPanel : public vgui::EditablePanel
  19. {
  20. DECLARE_CLASS_SIMPLE( CLoadoutPresetPanel, vgui::EditablePanel );
  21. public:
  22. CLoadoutPresetPanel( vgui::Panel *pParent, const char *pName ); // name is ignored but needed for DECLARE_BUILD_FACTORY()
  23. void SetClass( int iClass );
  24. void EnableVerticalDisplay( bool bVertical );
  25. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  26. virtual void ApplySettings( KeyValues *pInResourceData );
  27. virtual void PerformLayout();
  28. virtual void OnCommand( const char *command );
  29. virtual void OnTick() OVERRIDE;
  30. bool HandlePresetKeyPressed( vgui::KeyCode code );
  31. private:
  32. equipped_preset_t GetSelectedPresetID() const;
  33. void UpdatePresetButtonStates();
  34. void LoadPreset( int iPresetIndex );
  35. enum PresetsConsts_t
  36. {
  37. MAX_PRESETS = 4,
  38. };
  39. int m_iClass;
  40. KeyValues *m_pPresetButtonKv;
  41. CExButton *m_pPresetButtons[ MAX_PRESETS ];
  42. bool m_bDisplayVertical;
  43. enum PresetButtonColors_t
  44. {
  45. LOADED = 0, NOTLOADED,
  46. FG = 0, BG,
  47. DEFAULT = 0, ARMED, DEPRESSED
  48. };
  49. Color m_aDefaultColors[2][2][3]; // [LOADED|NOTLOADED][FG|BG][DEFAULT|ARMED|DEPRESSED]
  50. };
  51. #endif // LOADOUT_PRESET_PANEL_H