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.

94 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Dialog for selecting game configurations
  4. //
  5. //=====================================================================================//
  6. #include <windows.h>
  7. #include <vgui/IVGui.h>
  8. #include <vgui/IInput.h>
  9. #include <vgui/ISystem.h>
  10. #include <vgui_controls/MessageBox.h>
  11. #include "matsys_controls/QCGenerator.h"
  12. #include "CQCGenMain.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include <tier0/memdbgon.h>
  15. using namespace vgui;
  16. CQCGenMain *g_pCQCGenMain = NULL;
  17. class CModalPreserveMessageBox : public vgui::MessageBox
  18. {
  19. public:
  20. CModalPreserveMessageBox(const char *title, const char *text, vgui::Panel *parent)
  21. : vgui::MessageBox( title, text, parent )
  22. {
  23. m_PrevAppFocusPanel = vgui::input()->GetAppModalSurface();
  24. }
  25. ~CModalPreserveMessageBox()
  26. {
  27. vgui::input()->SetAppModalSurface( m_PrevAppFocusPanel );
  28. }
  29. public:
  30. vgui::VPANEL m_PrevAppFocusPanel;
  31. };
  32. //-----------------------------------------------------------------------------
  33. // Constructor
  34. //-----------------------------------------------------------------------------
  35. CQCGenMain::CQCGenMain( Panel *parent, const char *pszPath, const char *pszScene , const char *name ) : BaseClass( parent, name ), m_bChanged( false )
  36. {
  37. Assert( !g_pCQCGenMain );
  38. g_pCQCGenMain = this;
  39. SetMinimizeButtonVisible( true );
  40. SetSize( 846, 770 );
  41. SetMinimumSize(846, 770);
  42. char szTitle[MAX_PATH];
  43. strcpy( szTitle, pszPath );
  44. strcat( szTitle, "\\" );
  45. strcat( szTitle, pszScene );
  46. SetTitle( szTitle, true );
  47. m_pQCGenerator = new CQCGenerator( this, pszPath, pszScene );
  48. }
  49. //-----------------------------------------------------------------------------
  50. // Destructor
  51. //-----------------------------------------------------------------------------
  52. CQCGenMain::~CQCGenMain()
  53. {
  54. g_pCQCGenMain = NULL;
  55. }
  56. //-----------------------------------------------------------------------------
  57. // Purpose: Kills the whole app on close
  58. //-----------------------------------------------------------------------------
  59. void CQCGenMain::OnClose( void )
  60. {
  61. BaseClass::OnClose();
  62. ivgui()->Stop();
  63. }
  64. //-----------------------------------------------------------------------------
  65. // Purpose: Parse commands coming in from the VGUI dialog
  66. //-----------------------------------------------------------------------------
  67. void CQCGenMain::OnCommand( const char *command )
  68. {
  69. BaseClass::OnCommand( command );
  70. }
  71. void CQCGenMain::OnRefresh()
  72. {
  73. Repaint();
  74. }