31 lines
770 B
C++
31 lines
770 B
C++
|
#include "MainUi.h"
|
||
|
|
||
|
bool CLinuxPack::OnInit()
|
||
|
{
|
||
|
auto* frame = new CMainFrame(wxT("Linux二进制打包工具"));
|
||
|
frame->Show(true);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
void CMainFrame::OnQuit(wxCommandEvent& event)
|
||
|
{
|
||
|
Close();
|
||
|
}
|
||
|
|
||
|
CMainFrame::CMainFrame(const wxString& title) : wxFrame(nullptr, wxID_ANY, title)
|
||
|
{
|
||
|
auto* button = new wxButton(this, wxID_OK, wxT("OK"), wxPoint(100, 100));
|
||
|
|
||
|
wxSize screenSize = wxGetDisplaySize();
|
||
|
wxSize initSize(screenSize.GetWidth() / 2, screenSize.GetHeight() / 2);
|
||
|
|
||
|
SetSize(initSize);
|
||
|
|
||
|
// 计算窗口的位置,使其居中
|
||
|
int x = (screenSize.GetWidth() - initSize.GetWidth()) / 2;
|
||
|
int y = (screenSize.GetHeight() - initSize.GetHeight()) / 2;
|
||
|
|
||
|
// 设置窗口的位置
|
||
|
SetPosition(wxPoint(x, y));
|
||
|
}
|