Created
March 16, 2024 17:10
-
-
Save vadz/60e5def21ecb8502b9e246a0447a6590 to your computer and use it in GitHub Desktop.
Example of using AUI with a panel (and not a frame)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wx/app.h> | |
#include <wx/frame.h> | |
#include <wx/panel.h> | |
#include <wx/sizer.h> | |
#include <wx/textctrl.h> | |
#include <wx/aui/aui.h> | |
class TestPanel : public wxPanel { | |
public: | |
explicit TestPanel(wxWindow* parent) : wxPanel(parent, wxID_ANY) { | |
m_manager.SetManagedWindow(this); | |
m_manager.AddPane(new wxTextCtrl(this, wxID_ANY, "Central pane"), wxAuiPaneInfo().CenterPane()); | |
m_manager.AddPane(new wxTextCtrl(this, wxID_ANY, "Left pane"), wxAuiPaneInfo().Left().Layer(1).MinSize(FromDIP(wxSize(200, 100))).Caption("Left pane").CloseButton()); | |
m_manager.AddPane(new wxTextCtrl(this, wxID_ANY, "Bottom pane"), wxAuiPaneInfo().Bottom().Layer(2).MinSize(FromDIP(wxSize(200, 100))).Caption("Bottom pane").MaximizeButton()); | |
m_manager.Update(); | |
} | |
private: | |
wxAuiManager m_manager; | |
}; | |
class TestApp : public wxApp { | |
public: | |
bool OnInit() override { | |
auto f = new wxFrame(nullptr, wxID_ANY, "Window containing AUI panel"); | |
auto t = new wxTextCtrl(f, wxID_ANY, "Just a text", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); | |
auto p = new TestPanel(f); | |
auto s = new wxBoxSizer(wxHORIZONTAL); | |
s->Add(t, wxSizerFlags().Expand()); | |
s->Add(p, wxSizerFlags(1).Expand()); | |
f->SetSizer(s); | |
f->SetClientSize(f->FromDIP(wxSize(800, 600))); | |
f->Show(); | |
return true; | |
} | |
}; | |
wxIMPLEMENT_APP(TestApp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment