Counter Strike : Global Offensive Source Code
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.

139 lines
4.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef VGUITEXTWINDOW_H
  8. #define VGUITEXTWINDOW_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Frame.h>
  13. #include <vgui_controls/Button.h>
  14. #include <vgui_controls/HTML.h>
  15. #include <game/client/iviewport.h>
  16. #include "shareddefs.h"
  17. #include "GameEventListener.h"
  18. namespace vgui
  19. {
  20. class TextEntry;
  21. }
  22. enum
  23. {
  24. FADE_STATUS_IN = 0,
  25. FADE_STATUS_HOLD,
  26. FADE_STATUS_OUT,
  27. FADE_STATUS_OFF
  28. };
  29. //-----------------------------------------------------------------------------
  30. // Purpose: displays the MOTD
  31. //-----------------------------------------------------------------------------
  32. class CTextWindow : public vgui::Frame, public IViewPortPanel, public CGameEventListener
  33. {
  34. private:
  35. DECLARE_CLASS_SIMPLE( CTextWindow, vgui::Frame );
  36. public:
  37. CTextWindow(IViewPort *pViewPort);
  38. virtual ~CTextWindow();
  39. virtual const char *GetName( void ) { return PANEL_INFO; }
  40. virtual void SetData(KeyValues *data);
  41. virtual void Reset();
  42. virtual void Update();
  43. // virtual void UpdateContents( void );
  44. virtual bool NeedsUpdate( void ) { return false; }
  45. virtual bool HasInputElements( void ) { return true; }
  46. virtual void ShowPanel( bool bShow );
  47. void ShowPanel2( bool bShow );
  48. bool HasMotd();
  49. virtual void PaintBackground();
  50. // both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
  51. vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
  52. virtual bool IsVisible() { return BaseClass::IsVisible(); }
  53. virtual void SetParent( vgui::VPANEL parent ) { BaseClass::SetParent( parent ); }
  54. virtual void FireGameEvent( IGameEvent *event ) { return; };
  55. virtual bool WantsBackgroundBlurred( void ) { return false; };
  56. public:
  57. //=============================================================================
  58. // HPE_BEGIN:
  59. // [Forrest] Replaced text window command string with TEXTWINDOW_CMD enumeration
  60. // of options. Passing a command string is dangerous and allowed a server network
  61. // message to run arbitrary commands on the client.
  62. //=============================================================================
  63. virtual void SetData( int type, const char *title, const char *message, const char *message_fallback, int command );
  64. //=============================================================================
  65. // HPE_END
  66. //=============================================================================
  67. virtual void ShowFile( const char *filename );
  68. virtual void ShowText( const char *text );
  69. virtual void ShowURL( const char *URL, bool bAllowUserToDisable = true );
  70. virtual void ShowIndex( const char *entry );
  71. virtual void ShowHtmlString( const char *entry );
  72. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  73. protected:
  74. // vgui overrides
  75. virtual void OnCommand( const char *command );
  76. virtual void OnKeyCodePressed( vgui::KeyCode code );
  77. int GetNumSecondsRequiredByServer() const;
  78. int GetNumSecondsSponsorRequiredRemaining() const;
  79. bool m_bHasMotd;
  80. IViewPort *m_pViewPort;
  81. char m_szTitle[255];
  82. char m_szMessage[2048];
  83. char m_szMessageFallback[2048];
  84. //=============================================================================
  85. // HPE_BEGIN:
  86. // [Forrest] Replaced text window command string with TEXTWINDOW_CMD enumeration
  87. // of options. Passing a command string is dangerous and allowed a server network
  88. // message to run arbitrary commands on the client.
  89. //=============================================================================
  90. int m_nExitCommand;
  91. double m_dblTimeExecutedExitCommand;
  92. //=============================================================================
  93. // HPE_END
  94. //=============================================================================
  95. int m_nContentType;
  96. vgui::TextEntry *m_pTextMessage;
  97. class CMOTDHTML : public vgui::HTML
  98. {
  99. private:
  100. DECLARE_CLASS_SIMPLE( CMOTDHTML, vgui::HTML );
  101. public:
  102. CMOTDHTML( Panel *parent, const char *pchName ) : vgui::HTML( parent, pchName ) {}
  103. virtual bool OnStartRequest( const char *url, const char *target, const char *pchPostData, bool bIsRedirect );
  104. };
  105. CMOTDHTML *m_pHTMLMessage;
  106. vgui::Button *m_pOK;
  107. vgui::Label *m_pTitleLabel;
  108. vgui::Label *m_pInfoLabelTicker;
  109. uint32 m_uiTimestampStarted, m_uiTimestampInfoLabelUpdated;
  110. bool m_bForcingWindowCloseRegardlessOfTime;
  111. };
  112. #endif // VGUITEXTWINDOW_H