Initial Commit. Just an empty main window right now
This commit is contained in:
parent
0db1d019f3
commit
31e151b56c
6
.gitignore
vendored
6
.gitignore
vendored
@ -30,3 +30,9 @@
|
|||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
|
# Build files and executable
|
||||||
|
build/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
15
CMakeLists.txt
Normal file
15
CMakeLists.txt
Normal file
@ -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)
|
83
src/main.cpp
Normal file
83
src/main.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user