base:最基础的可以跑起来的版本。
This commit is contained in:
parent
ae358408e0
commit
948deb1408
@ -16,6 +16,8 @@ endif()
|
||||
find_package(wxWidgets REQUIRED COMPONENTS core base)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
|
||||
add_executable(LinuxPack main.cpp)
|
||||
add_executable(LinuxPack main.cpp
|
||||
MainUi.h
|
||||
MainUi.cpp)
|
||||
target_link_libraries(LinuxPack PRIVATE ${wxWidgets_LIBRARIES})
|
||||
set_target_properties(LinuxPack PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
|
30
MainUi.cpp
Normal file
30
MainUi.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#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));
|
||||
}
|
20
MainUi.h
Normal file
20
MainUi.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef MAIN_UI
|
||||
#define MAIN_UI
|
||||
|
||||
#include <wx/wx.h>
|
||||
#define USE_DYNAMIC_CONNECT
|
||||
|
||||
class CLinuxPack : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit() override;
|
||||
};
|
||||
|
||||
class CMainFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
explicit CMainFrame(const wxString& title);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user