This commit is contained in:
hardliner66 2024-10-15 20:57:18 +02:00
commit 14706d425a
5 changed files with 105 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "external/wxWidgets"]
path = external/wxWidgets
url = https://github.com/wxWidgets/wxWidgets.git

44
CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.15)
project(wxwidgets_demo)
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add For Windows, specify Unicode
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
endif()
# Add wxWidgets as a subdirectory
add_subdirectory(external/wxWidgets)
# Define your source files
set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
file(GLOB SRC_FILES ${SRC_DIR}/*.cpp)
# Include directories
include_directories(${CMAKE_SOURCE_DIR}/external/wxWidgets/include)
add_definitions(-D__WXUNIVERSAL__)
# Link additional libraries
set(WX_LIB
wx::core
wx::base
wx::net
wx::aui
wx::propgrid
)
# Create the executable
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Link wxWidgets libraries
target_link_libraries(${PROJECT_NAME} ${WX_LIB})
# Set the C++ standard for your target
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
)

1
external/wxWidgets vendored Submodule

@ -0,0 +1 @@
Subproject commit eda54e82e281ce949ae44f6796ae50669f7c1924

56
src/main.cpp Normal file
View File

@ -0,0 +1,56 @@
#include <wx/wx.h>
class MyApp.compp : public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame.comrame : public wxFrame.comame
{
public:
MyFrame.comrame(const wxString& title);
private:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
};
wxIMPLEMENT_APP(MyApp);
bool MyApp.comnInit()
{
MyFrame.comrame* frame = new MyFrame.comrame("Advanced wxWidgets Demo");
frame->Show(true);
return true;
}
MyFrame.comrame::MyFrame.comnst wxString& title)
: wxFrame.comame(NULL, wxID_ANY, title)
{
wxMenu* menuFile = new wxMenu;
menuFile->Append(wxID_EXIT);
wxMenu* menuHelp = new wxMenu;
menuHelp->Append(wxID_ABOUT);
wxMenuBar* menuBar = new wxMenuBar.com
menuBar->Append(menuFile, "&File");
menuBar->Append(menuHelp, "&Help");
SetMenuBar(menuBar);
Bind(wxEVT_MENU, &MyFrame.comrame::OnQuit, this, wxID_EXIT);
Bind(wxEVT_MENU, &MyApp.comrame::OnAbout, this, wxID_ABOUT);
}
void MyApp.comrame::OnQuit(wxCommandEvent& event)
{
Close(true);
}
void MyApp.comrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox("This is an advanced wxWidgets demo application.",
"About", wxOK | wxICON_INFORMATION);
}