40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
#include "MainPanel.h"
|
|
|
|
CMainPanel::CMainPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
|
: wxPanel(parent, id, pos, size, style, name)
|
|
{
|
|
InitPanel();
|
|
}
|
|
|
|
void CMainPanel::InitPanel()
|
|
{
|
|
ui_box_sizer_ = new wxStaticBoxSizer(wxVERTICAL, this, wxT("一、基本信息"));
|
|
|
|
sizer_select_ = new wxBoxSizer(wxHORIZONTAL);
|
|
label_select_ = new wxStaticText(ui_box_sizer_->GetStaticBox(), wxID_ANY, wxT("要打包的二进制文件"));
|
|
text_select_ctrl_ = new wxTextCtrl(ui_box_sizer_->GetStaticBox(), wxID_ANY);
|
|
text_select_ctrl_->SetMinSize(wxSize(300, -1));
|
|
btn_select_ = new wxButton(ui_box_sizer_->GetStaticBox(), wxID_ANY, wxT("选择"));
|
|
btn_select_->Bind(wxEVT_BUTTON, &CMainPanel::selectBinaryFile, this);
|
|
sizer_select_->Add(label_select_, 0, wxALL | wxALIGN_CENTER_VERTICAL, 3);
|
|
sizer_select_->Add(text_select_ctrl_, 1, wxALL, 3);
|
|
sizer_select_->Add(btn_select_, 0, wxALL | wxALIGN_LEFT, 3);
|
|
|
|
ui_box_sizer_->Add(sizer_select_, 0, wxALL | wxEXPAND, 3);
|
|
SetSizer(ui_box_sizer_);
|
|
}
|
|
|
|
void CMainPanel::selectBinaryFile(wxCommandEvent& event)
|
|
{
|
|
wxFileDialog openFileDialog(
|
|
this, _("Open file"), "", "",
|
|
"Text files (*.txt)|*.txt|PDF files (*.pdf)|*.pdf|All files (*.*)|*.*",
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
|
|
|
if (openFileDialog.ShowModal() == wxID_CANCEL)
|
|
return;
|
|
|
|
wxString filePath = openFileDialog.GetPath();
|
|
text_select_ctrl_->SetValue(filePath);
|
|
}
|