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.

80 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "ModWizard_Finished.h"
  7. #include "CreateModWizard.h"
  8. #include <vgui_controls/WizardPanel.h>
  9. #include <vgui/ILocalize.h>
  10. #include <vgui/ISystem.h>
  11. extern void OpenLocalizedURL( const char *lpszLocalName );
  12. using namespace vgui;
  13. CModWizardSubPanel_Finished::CModWizardSubPanel_Finished( Panel *parent, const char *panelName )
  14. : BaseClass( parent, panelName )
  15. {
  16. m_pFinishedText = new Label( this, "FinishedText", "" );
  17. m_pOpenReadme = new CheckButton( this, "OpenReadme", "" );
  18. m_OutputDirName[0] = 0;
  19. LoadControlSettings( "ModWizardSubPanel_Finished.res");
  20. m_pOpenReadme->SetSelected( true );
  21. }
  22. void CModWizardSubPanel_Finished::GetReady( const char *pOutputDirName )
  23. {
  24. wchar_t *formatStr = g_pVGuiLocalize->Find( "ModWizard_FinishedText" );
  25. if ( formatStr )
  26. {
  27. wchar_t tempStr[4096], labelStr[4096];
  28. Q_strncpy( m_OutputDirName, pOutputDirName, sizeof( m_OutputDirName ) );
  29. int len = strlen( m_OutputDirName );
  30. if ( len > 0 )
  31. {
  32. if ( m_OutputDirName[len-1] == '/' || m_OutputDirName[len-1] == '\\' )
  33. m_OutputDirName[len-1] = 0;
  34. }
  35. g_pVGuiLocalize->ConvertANSIToUnicode( m_OutputDirName, tempStr, sizeof( tempStr ) );
  36. g_pVGuiLocalize->ConstructString( labelStr, sizeof( labelStr ), formatStr, 1, tempStr );
  37. m_pFinishedText->SetText( labelStr );
  38. }
  39. }
  40. WizardSubPanel *CModWizardSubPanel_Finished::GetNextSubPanel()
  41. {
  42. return NULL;
  43. }
  44. void CModWizardSubPanel_Finished::PerformLayout()
  45. {
  46. BaseClass::PerformLayout();
  47. GetWizardPanel()->SetFinishButtonEnabled( true );
  48. GetWizardPanel()->SetPrevButtonEnabled( false );
  49. }
  50. void CModWizardSubPanel_Finished::OnDisplayAsNext()
  51. {
  52. GetWizardPanel()->SetTitle( "#ModWizard_Finished_Title", true );
  53. NoteModWizardFinished();
  54. }
  55. bool CModWizardSubPanel_Finished::OnFinishButton()
  56. {
  57. if ( m_pOpenReadme->IsSelected() )
  58. {
  59. // ShellExecute.. to the site.
  60. OpenLocalizedURL( "URL_Create_Mod_Finished" );
  61. }
  62. return true;
  63. }