-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNewWxCrafterFileDlg.cpp
43 lines (37 loc) · 1.21 KB
/
NewWxCrafterFileDlg.cpp
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
#include "NewWxCrafterFileDlg.h"
#include <manager.h>
#include <projectmanager.h>
#include <cbproject.h>
#include "wxcHelper.h"
NewWxCrafterFileDlg::NewWxCrafterFileDlg(wxWindow* parent)
: NewWxCrafterFileDlgBase(parent)
{
ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
for(size_t i=0; i<projects->GetCount(); ++i) {
cbProject* project = projects->Item(i);
m_choiceProjects->Append(project->GetTitle());
}
m_choiceProjects->SetSelection(0);
// Update the default path
wxCommandEvent dummy;
OnProjectSelected( dummy );
Centre();
}
NewWxCrafterFileDlg::~NewWxCrafterFileDlg()
{
}
void NewWxCrafterFileDlg::OnButtonOKUI(wxUpdateUIEvent& event)
{
event.Enable( !m_filePicker->GetPath().IsEmpty() );
}
void NewWxCrafterFileDlg::OnProjectSelected(wxCommandEvent& event)
{
wxUnusedVar ( event );
wxString projectName = m_choiceProjects->GetStringSelection();
cbProject *selectedProject = wxcHelper::GetProject( projectName );
if ( selectedProject ) {
wxFileName fnProject(selectedProject->GetFilename());
fnProject.SetFullName(wxT("wxcrafter.wxcp"));
m_filePicker->SetPath( fnProject.GetFullPath() );
}
}