-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathStaticBoxSizerVertical.cpp
More file actions
38 lines (31 loc) · 1.4 KB
/
StaticBoxSizerVertical.cpp
File metadata and controls
38 lines (31 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <wx/app.h>
#include <wx/sizer.h>
#include <wx/frame.h>
#include <wx/panel.h>
namespace StaticBoxSizerVerticalExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame {nullptr, wxID_ANY, "StaticBoxSizerVertical example"} {
red_panel->SetBackgroundColour({255, 0, 0});
green_panel->SetBackgroundColour({0, 128, 0});
blue_panel->SetBackgroundColour({0, 0, 255});
yellow_panel->SetBackgroundColour({255, 255, 0});
boxSizerVertical->Add(red_panel, wxSizerFlags {}.Expand());
boxSizerVertical->Add(green_panel, wxSizerFlags {70}.Expand());
boxSizerVertical->Add(blue_panel, wxSizerFlags {15}.Expand());
boxSizerVertical->Add(yellow_panel, wxSizerFlags {15}.Expand());
SetSizerAndFit(boxSizerVertical);
SetSize(300, 300);
}
private:
wxBoxSizer* boxSizerVertical = new wxBoxSizer {wxVERTICAL};
wxPanel* red_panel = new wxPanel {this, wxID_ANY, wxDefaultPosition, {1, 30}};
wxPanel* green_panel = new wxPanel {this, wxID_ANY, wxDefaultPosition, wxDefaultSize};
wxPanel* blue_panel = new wxPanel {this, wxID_ANY, wxDefaultPosition, wxDefaultSize};
wxPanel* yellow_panel = new wxPanel {this, wxID_ANY, wxDefaultPosition, wxDefaultSize};
};
class Application : public wxApp {
bool OnInit() override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(StaticBoxSizerVerticalExample::Application);