summaryrefslogtreecommitdiff
path: root/utils/QCGenerator/CQCGenMain.cpp
blob: fec3fb45d27af7c102154a85b8b9fdf4ec3e5588 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Dialog for selecting game configurations
//
//=====================================================================================//

#include <windows.h>

#include <vgui/IVGui.h>
#include <vgui/IInput.h>
#include <vgui/ISystem.h>
#include <vgui_controls/MessageBox.h>

#include "matsys_controls/QCGenerator.h"
#include "CQCGenMain.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

using namespace vgui;

CQCGenMain *g_pCQCGenMain = NULL;

class CModalPreserveMessageBox : public vgui::MessageBox
{
public:
	CModalPreserveMessageBox(const char *title, const char *text, vgui::Panel *parent)
		: vgui::MessageBox( title, text, parent )
	{
		m_PrevAppFocusPanel = vgui::input()->GetAppModalSurface();
	}

	~CModalPreserveMessageBox()
	{
		vgui::input()->SetAppModalSurface( m_PrevAppFocusPanel );
	}

public:
	vgui::VPANEL	m_PrevAppFocusPanel;
};
		
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
CQCGenMain::CQCGenMain( Panel *parent, const char *pszPath, const char *pszScene , const char *name ) : BaseClass( parent, name ), m_bChanged( false )
{
	Assert( !g_pCQCGenMain );
	g_pCQCGenMain = this;
	
	SetMinimizeButtonVisible( true );	

	SetSize( 846, 770 );
	SetMinimumSize(846, 770);	
	char szTitle[MAX_PATH];
	strcpy( szTitle, pszPath );
	strcat( szTitle, "\\" );
	strcat( szTitle, pszScene );
	SetTitle( szTitle, true );

    m_pQCGenerator = new CQCGenerator( this, pszPath, pszScene );
}

//-----------------------------------------------------------------------------
// Destructor 
//-----------------------------------------------------------------------------
CQCGenMain::~CQCGenMain()
{
	g_pCQCGenMain = NULL;
}



//-----------------------------------------------------------------------------
// Purpose: Kills the whole app on close
//-----------------------------------------------------------------------------
void CQCGenMain::OnClose( void )
{
	BaseClass::OnClose();
	ivgui()->Stop();	
}

//-----------------------------------------------------------------------------
// Purpose: Parse commands coming in from the VGUI dialog
//-----------------------------------------------------------------------------
void CQCGenMain::OnCommand( const char *command )
{		
	BaseClass::OnCommand( command );
}

void CQCGenMain::OnRefresh()
{
	Repaint();
}