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.

72 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ITEM_QUICKSWITCH_H
  7. #define ITEM_QUICKSWITCH_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/ScrollableEditablePanel.h"
  12. class CLoadoutPresetPanel;
  13. class CItemQuickSwitchPanel : public vgui::EditablePanel, public CHudElement
  14. {
  15. DECLARE_CLASS_SIMPLE( CItemQuickSwitchPanel, vgui::EditablePanel );
  16. public:
  17. CItemQuickSwitchPanel( const char *pElementName );
  18. virtual ~CItemQuickSwitchPanel();
  19. void OpenQS( void );
  20. void CloseQS( void );
  21. bool ShouldDraw( void ) { return IsVisible(); }
  22. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  23. virtual void ApplySettings( KeyValues *inResourceData );
  24. virtual void PerformLayout( void );
  25. virtual void OnTick( void );
  26. void UpdateEquippedItem( void );
  27. bool CalculateClassAndSlot();
  28. void UpdateModelPanels( void );
  29. void SetButtonToItem( int iButton, CEconItemView *pItem );
  30. bool IsValid( void );
  31. virtual void FireGameEvent( IGameEvent *event );
  32. int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  33. MESSAGE_FUNC( OnItemPresetLoaded, "ItemPresetLoaded" );
  34. MESSAGE_FUNC_PTR( OnIPMouseReleased, "ItemPanelMouseReleased", panel );
  35. MESSAGE_FUNC_PTR( OnItemPanelEntered, "ItemPanelEntered", panel );
  36. MESSAGE_FUNC_PTR( OnItemPanelExited, "ItemPanelExited", panel );
  37. private:
  38. int m_iClass; // Class of the player we're selecting an item for
  39. int m_iSlot; // Slot on the player that we're selecting an item for
  40. bool m_bLoadoutHasChanged;
  41. vgui::EditablePanel *m_pItemContainer;
  42. vgui::ScrollableEditablePanel *m_pItemContainerScroller;
  43. vgui::Label *m_pWeaponLabel;
  44. vgui::Label *m_pEquipYourClassLabel;
  45. vgui::Label *m_pNoItemsToEquipLabel;
  46. vgui::Label *m_pEquippedLabel;
  47. CLoadoutPresetPanel *m_pLoadoutPresetPanel;
  48. KeyValues *m_pItemKV;
  49. CUtlVector<CItemModelPanel *> m_pItemPanels;
  50. CPanelAnimationVarAliasType( int, m_iItemPanelXPos, "itempanel_xpos", "0", "proportional_int" );
  51. CPanelAnimationVarAliasType( int, m_iItemPanelYDelta, "itempanel_ydelta", "0", "proportional_int" );
  52. };
  53. #endif // ITEM_QUICKSWITCH_H