add:添加gui模块。

This commit is contained in:
taynpg 2025-03-31 13:58:49 +08:00
parent 97e9192583
commit f5e3113883
6 changed files with 63 additions and 2 deletions

View File

@ -29,8 +29,8 @@
},
"cmake.configureArgs": [
"-Wno-dev",
"-DCMAKE_PREFIX_PATH:STRING=C:/Dev/fltk",
"-DTSCGUI=ON"
"-DCMAKE_PREFIX_PATH:STRING=C:/dev/wxwigets",
"-DUSE_GUI=ON"
],
"cmake.options.statusBarVisibility": "visible",
"cmake.generator": "Ninja",

View File

@ -80,6 +80,10 @@ install(TARGETS tss DESTINATION bin)
if (DEFINED USE_BOOST)
install(FILES ${MINGW32_DLLS} DESTINATION bin)
endif()
if (DEFINED USE_GUI)
message(STATUS "USE GUI ${USE_GUI}")
add_subdirectory(gui)
endif()
# ********************************************************** pack infomation
if(CMAKE_SIZEOF_VOID_P EQUAL 8)

19
gui/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(transm-gui LANGUAGES CXX)
find_package(wxWidgets CONFIG REQUIRED)
set(SOURCES
main.cxx
MainFrame.cpp
MainFrame.h
)
add_executable(transm-gui ${SOURCES})
target_link_libraries(transm-gui PRIVATE
wx::core wx::base
)
set_target_properties(transm-gui PROPERTIES WIN32_EXECUTABLE TRUE)

5
gui/MainFrame.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "MainFrame.h"
CMainFrame::CMainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title)
{
}

12
gui/MainFrame.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef MAINFRAME_H
#define MAINFRAME_H
#include <wx/wx.h>
class CMainFrame : public wxFrame
{
public:
explicit CMainFrame(const wxString& title);
};
#endif

21
gui/main.cxx Normal file
View File

@ -0,0 +1,21 @@
#include "MainFrame.h"
#include <wx/wx.h>
class CTransForm : public wxApp
{
public:
virtual bool OnInit()
{
wxString title = wxString::Format(wxT("transm-gui"));
auto* f = new CMainFrame(title);
f->Show(true);
return true;
}
virtual int OnExit()
{
return wxApp::OnExit();
}
};
IMPLEMENT_APP(CTransForm);
DECLARE_APP(CTransForm);