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.

117 lines
3.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Quickplay client UI
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef _INCLUDED_TF_QUICKPLAY_UI_H
  8. #define _INCLUDED_TF_QUICKPLAY_UI_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. namespace vgui
  13. {
  14. class Button;
  15. class ComboBox;
  16. class RadioButton;
  17. }
  18. #include "vgui_controls/EditablePanel.h"
  19. #include "tf_quickplay_shared.h"
  20. struct QuickplayItem
  21. {
  22. const char *pTitle;
  23. const char *pDescription;
  24. const char *pMoreInfo;
  25. const char *pComplexity;
  26. const char *pImage;
  27. const char *pBetaImage;
  28. EGameCategory gameType;
  29. };
  30. //-----------------------------------------------------------------------------
  31. // Purpose: Quickplay Dialog
  32. //-----------------------------------------------------------------------------
  33. extern ConVar tf_quickplay_lastviewedmode;
  34. class CQuickplayPanelBase : public vgui::EditablePanel
  35. {
  36. DECLARE_CLASS_SIMPLE( CQuickplayPanelBase, vgui::EditablePanel );
  37. public:
  38. CQuickplayPanelBase( vgui::Panel *parent, const char *name );
  39. virtual ~CQuickplayPanelBase();
  40. virtual void ApplySettings( KeyValues *pInResourceData ) OVERRIDE;
  41. virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
  42. virtual void OnCommand( const char *pCommand );
  43. void ShowItemByGameType( EGameCategory gameType );
  44. void ShowItemByIndex( int iItem );
  45. int GetSelectedItemIndex() const { return m_iCurrentItem; }
  46. void SetPageScrollButtonsVisible( bool bFlag );
  47. protected:
  48. void SetupActionTarget( const char *pPanelName );
  49. void AddItem( EGameCategory gameType, const char *pTitle, const char *pDescription, const char *pMoreInfo, const char *pComplexity, const char *pImage, const char *pBetaImage );
  50. virtual void UpdateSelectableItems();
  51. void SaveSettings();
  52. void SetupMoreOptions();
  53. void ReadOptionCombos();
  54. void WriteOptionCombosAndSummary();
  55. virtual void GetOptionsAndSummaryText( wchar_t *pwszSummary );
  56. void ShowSimplifiedOrAdvancedOptions();
  57. virtual const char *GetItemImage( const QuickplayItem& item ) const;
  58. MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
  59. MESSAGE_FUNC_PTR( OnRadioButtonChecked, "RadioButtonChecked", panel );
  60. virtual void UserSelectItemByIndex( int iNewItem );
  61. protected:
  62. vgui::EditablePanel *m_pContainer;
  63. vgui::EditablePanel *m_pSimplifiedOptionsContainer;
  64. vgui::EditablePanel *m_pAdvOptionsContainer;
  65. vgui::EditablePanel *m_pGameModeInfoContainer;
  66. vgui::Button *m_pPrevPageButton;
  67. vgui::Button *m_pNextPageButton;
  68. vgui::Button *m_pMoreOptionsButton;
  69. vgui::EditablePanel *m_pMoreInfoContainer;
  70. vgui::ComboBox *m_pGameModeCombo;
  71. vgui::Label *m_pOptionsSummaryLabel;
  72. enum EAdvOption
  73. {
  74. kEAdvOption_ServerHost,
  75. kEAdvOption_MaxPlayers,
  76. kEAdvOption_Respawn,
  77. kEAdvOption_RandomCrits,
  78. kEAdvOption_DamageSpread
  79. };
  80. struct AdvOption {
  81. const char *m_pszContainerName;
  82. ConVar *m_pConvar;
  83. CUtlVector<const char *> m_vecOptionNames;
  84. CUtlVector<vgui::RadioButton *> m_vecRadioButtons;
  85. CUtlVector<const char *> m_vecOptionSummaryNames;
  86. int m_nChoice;
  87. };
  88. CUtlVector<AdvOption> m_vecAdvOptions;
  89. //vgui::CheckButton *m_pFavoritesCheckButton;
  90. //vgui::Button *m_pRefreshButton;
  91. CUtlVector< QuickplayItem > m_vecItems;
  92. CUtlVector< QuickplayItem > m_vecAllItems;
  93. int m_iCurrentItem;
  94. bool m_bSetInitialSelection;
  95. bool m_bShowRandomOption;
  96. char m_szEvent247Image[MAX_PATH];
  97. char m_szCommunityUpdateImage[MAX_PATH];
  98. };
  99. #endif // #ifndef _INCLUDED_TF_QUICKPLAY_UI_H