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.

119 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: All matchmaking dialogs inherit from this
  4. //
  5. //=============================================================================//
  6. #ifndef BASEDIALOG_H
  7. #define BASEDIALOG_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "dialogmenu.h"
  12. #include "vgui_controls/Label.h"
  13. #include "vgui_controls/KeyRepeat.h"
  14. #include "KeyValues.h"
  15. #include "BasePanel.h"
  16. #if !defined( _X360 )
  17. #include "xbox/xboxstubs.h"
  18. #endif
  19. class CFooterPanel;
  20. //-----------------------------------------------------------------------------
  21. // Purpose: A Label with an extra string to hold a session property lookup key
  22. //-----------------------------------------------------------------------------
  23. class CPropertyLabel : public vgui::Label
  24. {
  25. DECLARE_CLASS_SIMPLE( CPropertyLabel, vgui::Label );
  26. public:
  27. CPropertyLabel( Panel *parent, const char *panelName, const char *text ) : BaseClass( parent, panelName, text )
  28. {
  29. }
  30. virtual void ApplySettings( KeyValues *pResourceData )
  31. {
  32. BaseClass::ApplySettings( pResourceData );
  33. m_szPropertyString[0] = 0;
  34. const char *pString = pResourceData->GetString( "PropertyString", NULL );
  35. if ( pString )
  36. {
  37. Q_strncpy( m_szPropertyString, pString, sizeof( m_szPropertyString ) );
  38. }
  39. }
  40. char m_szPropertyString[ MAX_PATH ];
  41. };
  42. //--------------------------------
  43. // CBaseDialog
  44. //--------------------------------
  45. class CBaseDialog : public vgui::Frame
  46. {
  47. DECLARE_CLASS_SIMPLE( CBaseDialog, vgui::Frame );
  48. public:
  49. CBaseDialog( vgui::Panel *parent, const char *pName );
  50. ~CBaseDialog();
  51. // IPanel interface
  52. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  53. virtual void ApplySettings( KeyValues *pResourceData );
  54. virtual void PerformLayout();
  55. virtual void Activate();
  56. virtual void OnKeyCodePressed( vgui::KeyCode code );
  57. virtual void OnKeyCodeReleased( vgui::KeyCode code);
  58. virtual void OnCommand( const char *pCommand );
  59. virtual void OnClose();
  60. virtual void OnThink();
  61. virtual void OverrideMenuItem( KeyValues *pKeys );
  62. virtual void SwapMenuItems( int iOne, int iTwo );
  63. virtual void HandleKeyRepeated( vgui::KeyCode code );
  64. protected:
  65. int m_nBorderWidth;
  66. int m_nMinWide;
  67. CDialogMenu m_Menu;
  68. vgui::Label *m_pTitle;
  69. vgui::Panel *m_pParent;
  70. KeyValues *m_pFooterInfo;
  71. int m_nButtonGap;
  72. vgui::CKeyRepeatHandler m_KeyRepeat;
  73. };
  74. //---------------------------------------------------------------------
  75. // Helper object to display the map picture and descriptive text
  76. //---------------------------------------------------------------------
  77. class CScenarioInfoPanel : public vgui::EditablePanel
  78. {
  79. DECLARE_CLASS_SIMPLE( CScenarioInfoPanel, vgui::EditablePanel );
  80. public:
  81. CScenarioInfoPanel( vgui::Panel *parent, const char *pName );
  82. ~CScenarioInfoPanel();
  83. virtual void PerformLayout();
  84. virtual void ApplySettings( KeyValues *pResourceData );
  85. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  86. vgui::ImagePanel *m_pMapImage;
  87. CPropertyLabel *m_pTitle;
  88. CPropertyLabel *m_pSubtitle;
  89. CPropertyLabel *m_pDescOne;
  90. CPropertyLabel *m_pDescTwo;
  91. CPropertyLabel *m_pDescThree;
  92. CPropertyLabel *m_pValueTwo;
  93. CPropertyLabel *m_pValueThree;
  94. };
  95. #endif // BASEDIALOG_H