From f5e31138836414035f2d8bd8999889a1a96d1caa Mon Sep 17 00:00:00 2001 From: taynpg Date: Mon, 31 Mar 2025 13:58:49 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=B7=BB=E5=8A=A0gui=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 4 ++-- CMakeLists.txt | 4 ++++ gui/CMakeLists.txt | 19 +++++++++++++++++++ gui/MainFrame.cpp | 5 +++++ gui/MainFrame.h | 12 ++++++++++++ gui/main.cxx | 21 +++++++++++++++++++++ 6 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 gui/CMakeLists.txt create mode 100644 gui/MainFrame.cpp create mode 100644 gui/MainFrame.h create mode 100644 gui/main.cxx diff --git a/.vscode/settings.json b/.vscode/settings.json index b4589e2..7ba932b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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", diff --git a/CMakeLists.txt b/CMakeLists.txt index 479adca..1e74741 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt new file mode 100644 index 0000000..fe350bd --- /dev/null +++ b/gui/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/gui/MainFrame.cpp b/gui/MainFrame.cpp new file mode 100644 index 0000000..0a3fe4a --- /dev/null +++ b/gui/MainFrame.cpp @@ -0,0 +1,5 @@ +#include "MainFrame.h" + +CMainFrame::CMainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) +{ +} \ No newline at end of file diff --git a/gui/MainFrame.h b/gui/MainFrame.h new file mode 100644 index 0000000..c547949 --- /dev/null +++ b/gui/MainFrame.h @@ -0,0 +1,12 @@ +#ifndef MAINFRAME_H +#define MAINFRAME_H + +#include + +class CMainFrame : public wxFrame +{ +public: + explicit CMainFrame(const wxString& title); +}; + +#endif \ No newline at end of file diff --git a/gui/main.cxx b/gui/main.cxx new file mode 100644 index 0000000..9a593da --- /dev/null +++ b/gui/main.cxx @@ -0,0 +1,21 @@ +#include "MainFrame.h" +#include + +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); \ No newline at end of file