From 31e151b56c46cad0e8d53324863fd4774e9ebdda Mon Sep 17 00:00:00 2001 From: Travis Hunter Date: Fri, 10 Feb 2023 18:02:06 -0700 Subject: [PATCH] Initial Commit. Just an empty main window right now --- .gitignore | 6 ++++ CMakeLists.txt | 15 +++++++++ src/main.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore index 259148f..ba99942 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,9 @@ *.exe *.out *.app + +# Build files and executable +build/ + +# IDE +.vscode/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..651fd27 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.0.0) +project(wxRocket VERSION 0.1.0) + +include(CTest) +enable_testing() + +find_package(wxWidgets REQUIRED gl core base) +include(${wxWidgets_USE_FILE}) +add_executable(wxRocket src/main.cpp) + +target_link_libraries(wxRocket PRIVATE ${wxWidgets_LIBRARIES}) + +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +include(CPack) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..1f65aa6 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,83 @@ +#include +#include + +#include + +#ifndef WX_PRECOMP + #include +#endif + +class wxRocket : public wxApp +{ +public: + //wxRocket(); + //virtual ~wxRocket(); + + virtual bool OnInit(); + +}; + +class MainWindowFrame : public wxFrame +{ +public: + MainWindowFrame(); + +private: + void onExit(wxCommandEvent& evt); + void onAbout(wxCommandEvent& evt); + +}; + +wxIMPLEMENT_APP(wxRocket); + +bool wxRocket::OnInit() +{ + MainWindowFrame* frame = new MainWindowFrame; + frame->Show(true); + return true; +} + +MainWindowFrame::MainWindowFrame() + : wxFrame(nullptr, wxID_ANY, "wxRocket") +{ + // Add a File menu + wxMenu* fileMenu = new wxMenu; + fileMenu->Append(wxID_NEW); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_EXIT); + + // Add an Edit menu + wxMenu* editMenu = new wxMenu; + // Add a Tools menu + wxMenu* toolsMenu = new wxMenu; + + // Add a Help menu + wxMenu* helpMenu = new wxMenu; + helpMenu->Append(wxID_ABOUT); + + wxMenuBar* menuBar = new wxMenuBar; + menuBar->Append(fileMenu, _("&File")); + menuBar->Append(editMenu, _("&Edit")); + menuBar->Append(toolsMenu, _("&Tools")); + menuBar->Append(helpMenu, _("&Help")); + + SetMenuBar(menuBar); + + CreateStatusBar(); + SetStatusText(_("Welcome to wxRocket!")); + + Bind(wxEVT_MENU, &MainWindowFrame::onAbout, this, wxID_ABOUT); + Bind(wxEVT_MENU, &MainWindowFrame::onExit, this, wxID_EXIT); + +} + +void MainWindowFrame::onExit(wxCommandEvent& evt) +{ + Close(true); +} + +void MainWindowFrame::onAbout(wxCommandEvent& evt) +{ + wxMessageBox(_("This is wxRocket. (c) 2023 by Travis Hunter"), + _("About wxRocket"), wxOK | wxICON_INFORMATION); +}