From 53ba9dc12e5698ba369d96a3e2252c0ed4afd80a Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Tue, 24 Jun 2025 17:33:43 +0200 Subject: [PATCH] a start button --- launcher/gui/src/GLauncherApp.cpp | 43 +++- launcher/gui/src/GLauncherApp.h | 16 +- launcher/gui/src/LauncherAppMainFrame.cpp | 7 + launcher/gui/src/LauncherAppMainFrame.h | 15 +- launcher/gui/src/launcher.fbp | 260 +++++++++++++++++++++- 5 files changed, 318 insertions(+), 23 deletions(-) diff --git a/launcher/gui/src/GLauncherApp.cpp b/launcher/gui/src/GLauncherApp.cpp index b13cdf32..1b35bcb0 100644 --- a/launcher/gui/src/GLauncherApp.cpp +++ b/launcher/gui/src/GLauncherApp.cpp @@ -19,33 +19,56 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer4; - bSizer4 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_panel1, wxID_ANY, _("Status") ), wxVERTICAL ); + + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 0, 0 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Running"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + gbSizer1->Add( m_staticText1, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + + m_startStopButton = new wxButton( sbSizer4->GetStaticBox(), wxID_ANY, _("Start"), wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer1->Add( m_startStopButton, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); - bSizer4->Add( 0, 8, 1, wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer3; - sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_panel1, wxID_ANY, _("Status") ), wxVERTICAL ); + sbSizer4->Add( gbSizer1, 1, wxEXPAND, 5 ); - bSizer4->Add( sbSizer3, 1, wxEXPAND, 5 ); + bSizer2->Add( sbSizer4, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( m_panel1, wxID_ANY, _("Statistics") ), wxVERTICAL ); - m_panel1->SetSizer( bSizer4 ); + bSizer2->Add( sbSizer6, 1, wxEXPAND, 5 ); + + + m_panel1->SetSizer( bSizer2 ); m_panel1->Layout(); - bSizer4->Fit( m_panel1 ); + bSizer2->Fit( m_panel1 ); m_notebook1->AddPage( m_panel1, _("Info"), true ); + m_panel3 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_notebook1->AddPage( m_panel3, _("Logs"), false ); m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_notebook1->AddPage( m_panel2, _("Settings"), false ); - bSizer3->Add( m_notebook1, 1, wxEXPAND | wxALL, 5 ); + bSizer3->Add( m_notebook1, 1, wxALL|wxEXPAND, 5 ); this->SetSizer( bSizer3 ); this->Layout(); this->Centre( wxBOTH ); + + // Connect Events + m_startStopButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::OnStartStopButtonClick ), NULL, this ); } MainFrame::~MainFrame() diff --git a/launcher/gui/src/GLauncherApp.h b/launcher/gui/src/GLauncherApp.h index ce5641a4..53a50238 100644 --- a/launcher/gui/src/GLauncherApp.h +++ b/launcher/gui/src/GLauncherApp.h @@ -16,12 +16,15 @@ #include #include #include -#include -#include -#include +#include +#include #include #include #include +#include +#include +#include +#include #include #include @@ -38,8 +41,15 @@ class MainFrame : public wxFrame wxStatusBar* m_statusBar1; wxNotebook* m_notebook1; wxPanel* m_panel1; + wxStaticText* m_staticText1; + wxButton* m_startStopButton; + wxPanel* m_panel3; wxPanel* m_panel2; + // Virtual event handlers, override them in your derived class + virtual void OnStartStopButtonClick( wxCommandEvent& event ) { event.Skip(); } + + public: MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DHFS"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("DHFS") ); diff --git a/launcher/gui/src/LauncherAppMainFrame.cpp b/launcher/gui/src/LauncherAppMainFrame.cpp index 8ca3d9ff..b7b14548 100644 --- a/launcher/gui/src/LauncherAppMainFrame.cpp +++ b/launcher/gui/src/LauncherAppMainFrame.cpp @@ -1,5 +1,12 @@ #include "LauncherAppMainFrame.h" +#include + LauncherAppMainFrame::LauncherAppMainFrame(wxWindow* parent) : MainFrame(parent) { } + +void LauncherAppMainFrame::OnStartStopButtonClick(wxCommandEvent& event) { + std::cout << "Hi!" << std::endl; + // TODO: Implement OnStartStopButtonClick +} diff --git a/launcher/gui/src/LauncherAppMainFrame.h b/launcher/gui/src/LauncherAppMainFrame.h index 5165519e..72e27642 100644 --- a/launcher/gui/src/LauncherAppMainFrame.h +++ b/launcher/gui/src/LauncherAppMainFrame.h @@ -11,13 +11,16 @@ Subclass of MainFrame, which is generated by wxFormBuilder. //// end generated include /** Implementing MainFrame */ -class LauncherAppMainFrame : public MainFrame -{ - public: - /** Constructor */ - LauncherAppMainFrame( wxWindow* parent ); - //// end generated class members +class LauncherAppMainFrame : public MainFrame { +protected: + // Handlers for MainFrame events. + void OnStartStopButtonClick(wxCommandEvent& event); +public: + /** Constructor */ + LauncherAppMainFrame(wxWindow* parent); + + //// end generated class members }; #endif // __LauncherAppMainFrame__ diff --git a/launcher/gui/src/launcher.fbp b/launcher/gui/src/launcher.fbp index 89db50f9..e65366a2 100644 --- a/launcher/gui/src/launcher.fbp +++ b/launcher/gui/src/launcher.fbp @@ -91,7 +91,7 @@ none 5 - wxEXPAND | wxALL + wxALL|wxEXPAND 1 1 @@ -150,8 +150,8 @@ Info - 0 - + 1 + 1 1 1 @@ -203,12 +203,264 @@ wxTAB_TRAVERSAL + + + bSizer2 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + wxID_ANY + Status + + sbSizer4 + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + + wxBOTH + + + 0 + + gbSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + + 5 + 1 + 0 + wxALL + 0 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Running + 0 + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALL + 0 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Start + + 0 + + 0 + + + 0 + + 1 + m_startStopButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnStartStopButtonClick + + + + + + + + 5 + wxEXPAND + 1 + + wxID_ANY + Statistics + + sbSizer6 + wxVERTICAL + 1 + none + + + + + + + + Logs + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panel3 + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL Settings - 1 + 0 1 1