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.

70 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef CUSTOMGAMES_H
  7. #define CUSTOMGAMES_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #define MAX_TAG_CHARACTERS 128
  12. class TagInfoLabel : public vgui::URLLabel
  13. {
  14. DECLARE_CLASS_SIMPLE( TagInfoLabel, vgui::URLLabel );
  15. public:
  16. TagInfoLabel(Panel *parent, const char *panelName);
  17. TagInfoLabel(Panel *parent, const char *panelName, const char *text, const char *pszURL);
  18. virtual void OnMousePressed(vgui::MouseCode code);
  19. MESSAGE_FUNC( DoOpenCustomServerInfoURL, "DoOpenCustomServerInfoURL" );
  20. };
  21. class TagMenuButton : public vgui::MenuButton
  22. {
  23. DECLARE_CLASS_SIMPLE( TagMenuButton, vgui::MenuButton );
  24. public:
  25. TagMenuButton( Panel *parent, const char *panelName, const char *text);
  26. virtual void OnShowMenu(vgui::Menu *menu);
  27. };
  28. //-----------------------------------------------------------------------------
  29. // Purpose: Internet games with tags
  30. //-----------------------------------------------------------------------------
  31. class CCustomGames : public CInternetGames
  32. {
  33. DECLARE_CLASS_SIMPLE( CCustomGames, CInternetGames );
  34. public:
  35. CCustomGames(vgui::Panel *parent);
  36. ~CCustomGames();
  37. virtual void UpdateDerivedLayouts( void ) OVERRIDE;
  38. virtual void OnLoadFilter(KeyValues *filter) OVERRIDE;
  39. virtual void OnSaveFilter(KeyValues *filter) OVERRIDE;
  40. bool CheckTagFilter( gameserveritem_t &server ) OVERRIDE;
  41. bool CheckWorkshopFilter( gameserveritem_t &server ) OVERRIDE;
  42. virtual void SetRefreshing(bool state) OVERRIDE;
  43. virtual void ServerResponded( int iServer, gameserveritem_t *pServerItem ) OVERRIDE;
  44. MESSAGE_FUNC_PARAMS( OnAddTag, "AddTag", params );
  45. MESSAGE_FUNC( OnTagMenuButtonOpened, "TagMenuButtonOpened" );
  46. void RecalculateCommonTags( void );
  47. void AddTagToFilterList( const char *pszTag );
  48. private:
  49. TagInfoLabel *m_pTagInfoURL;
  50. TagMenuButton *m_pAddTagList;
  51. vgui::Menu *m_pTagListMenu;
  52. vgui::TextEntry *m_pTagFilter;
  53. char m_szTagFilter[MAX_TAG_CHARACTERS];
  54. };
  55. #endif // CUSTOMGAMES_H