#include <wx/wx.h>
#include <wx/frame.h>
#include <wx/toolbar.h>
class MyApp : public wxApp {
public:
virtual bool OnInit();
};
class MyFrame : public wxFrame {
public:
MyFrame(const wxString& title);
private:
void CreateToolbars();
};
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit() {
MyFrame *frame = new MyFrame("wxWidgets Toolbars Example");
frame->Show(true);
return true;
}
MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) {
this->SetSizeHints(wxDefaultSize, wxDefaultSize);
CreateToolbars();
}
void MyFrame::CreateToolbars() {
// Create the top toolbar
wxToolBar* topToolbar = this->CreateToolBar(wxTB_HORIZONTAL, wxID_ANY);
topToolbar->AddTool(wxID_ANY, wxT("Top Tool"), wxNullBitmap);
topToolbar->Realize();
// Create the left toolbar
wxToolBar* leftToolbar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_VERTICAL);
leftToolbar->AddTool(wxID_ANY, wxT("Left Tool"), wxNullBitmap);
leftToolbar->Realize();
// Create the right toolbar
wxToolBar* rightToolbar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_VERTICAL);
rightToolbar->AddTool(wxID_ANY, wxT("Right Tool"), wxNullBitmap);
rightToolbar->Realize();
// Use sizers for layout management
wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
mainSizer->Add(leftToolbar, 0, wxEXPAND);
mainSizer->Add(1, 1, 1, wxEXPAND); // Center area placeholder
mainSizer->Add(rightToolbar, 0, wxEXPAND);
this->SetSizer(mainSizer);
this->Layout();
}