Add wxwidgets module with initial implementation and integrate into CMake build system. Improve asset management in sfml module.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 4.1)
|
||||
project(wxwidgets LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
find_package(wxWidgets REQUIRED COMPONENTS net core base)
|
||||
if(wxWidgets_USE_FILE)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
endif()
|
||||
|
||||
add_executable(wxwidgets src/main.cpp)
|
||||
target_link_libraries(wxwidgets ${wxWidgets_LIBRARIES})
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <wx/wx.h>
|
||||
|
||||
class App : public wxApp {
|
||||
public:
|
||||
bool OnInit() override;
|
||||
};
|
||||
|
||||
wxIMPLEMENT_APP(App);
|
||||
|
||||
class MainWindow : public wxFrame {
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private:
|
||||
void OnShowMenuButtonClick(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
bool App::OnInit() {
|
||||
MainWindow* mainWindow = new MainWindow();
|
||||
mainWindow->Show();
|
||||
return true;
|
||||
}
|
||||
|
||||
enum AppIds {
|
||||
ID_LOWEST = 0,
|
||||
|
||||
ID_SHOW
|
||||
};
|
||||
|
||||
MainWindow::MainWindow() : wxFrame(nullptr, wxID_ANY, "Unsere kleine App") {
|
||||
wxMenu* menu = new wxMenu();
|
||||
menu->Append(ID_SHOW, "Zeige Nachricht");
|
||||
menu->Append(wxID_EXIT);
|
||||
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
menuBar->Append(menu, "&Datei");
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
Bind(wxEVT_MENU, &MainWindow::OnShowMenuButtonClick, this, ID_SHOW);
|
||||
|
||||
wxBoxSizer* mainVertical = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticText* label = new wxStaticText(this, wxID_ANY, "Hallo Welt!");
|
||||
mainVertical->Add(label);
|
||||
mainVertical->Add(new wxStaticText(this, wxID_ANY, "Hallo Welt!"));
|
||||
mainVertical->Add(new wxStaticText(this, wxID_ANY, "Hallo Welt!"));
|
||||
|
||||
wxBoxSizer* buttonBar = new wxBoxSizer(wxHORIZONTAL);
|
||||
buttonBar->Add(new wxButton(this, ID_SHOW, "Zeige Nachricht"));
|
||||
buttonBar->Add(new wxButton(this, ID_SHOW, "Zeige Nachricht"));
|
||||
buttonBar->Add(new wxButton(this, ID_SHOW, "Zeige Nachricht"));
|
||||
|
||||
mainVertical->Add(buttonBar);
|
||||
|
||||
SetSizer(mainVertical);
|
||||
}
|
||||
|
||||
void MainWindow::OnShowMenuButtonClick(wxCommandEvent& event) {
|
||||
wxMessageBox("Hallo Welt!");
|
||||
}
|
||||
Reference in New Issue
Block a user