summaryrefslogtreecommitdiff
path: root/sdklauncher/ModWizard_Finished.cpp
blob: fa3089b7cecd29f77f45c54be721d207d4f7f4ef (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

#include "ModWizard_Finished.h"
#include "CreateModWizard.h"
#include <vgui_controls/WizardPanel.h>
#include <vgui/ILocalize.h>
#include <vgui/ISystem.h>

extern void OpenLocalizedURL( const char *lpszLocalName );

using namespace vgui;

CModWizardSubPanel_Finished::CModWizardSubPanel_Finished( Panel *parent, const char *panelName )
	: BaseClass( parent, panelName )						 
{
	m_pFinishedText = new Label( this, "FinishedText", "" );
	m_pOpenReadme = new CheckButton( this, "OpenReadme", "" );
	
	m_OutputDirName[0] = 0;

	LoadControlSettings( "ModWizardSubPanel_Finished.res");

	m_pOpenReadme->SetSelected( true );
}

void CModWizardSubPanel_Finished::GetReady( const char *pOutputDirName )
{
	wchar_t *formatStr = g_pVGuiLocalize->Find( "ModWizard_FinishedText" );
	if ( formatStr )
	{
		wchar_t tempStr[4096], labelStr[4096];

		Q_strncpy( m_OutputDirName, pOutputDirName, sizeof( m_OutputDirName ) );
		int len = strlen( m_OutputDirName );
		if ( len > 0 )
		{
			if ( m_OutputDirName[len-1] == '/' || m_OutputDirName[len-1] == '\\' )
				m_OutputDirName[len-1] = 0;
		}

		g_pVGuiLocalize->ConvertANSIToUnicode( m_OutputDirName, tempStr, sizeof( tempStr ) );
		g_pVGuiLocalize->ConstructString( labelStr, sizeof( labelStr ), formatStr, 1, tempStr );
		m_pFinishedText->SetText( labelStr );
	}
}

WizardSubPanel *CModWizardSubPanel_Finished::GetNextSubPanel()
{
	return NULL;
}

void CModWizardSubPanel_Finished::PerformLayout()
{
	BaseClass::PerformLayout();
	
	GetWizardPanel()->SetFinishButtonEnabled( true );
	GetWizardPanel()->SetPrevButtonEnabled( false );
}

void CModWizardSubPanel_Finished::OnDisplayAsNext()
{
	GetWizardPanel()->SetTitle( "#ModWizard_Finished_Title", true );
	NoteModWizardFinished();
}

bool CModWizardSubPanel_Finished::OnFinishButton()
{
	if ( m_pOpenReadme->IsSelected() )
	{
		// ShellExecute.. to the site.
		OpenLocalizedURL( "URL_Create_Mod_Finished" );
	}

	return true;
}