]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: layout.h | |
3 | // Purpose: Layout sample | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
526954c5 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // Define a new application | |
13 | class MyApp: public wxApp | |
14 | { | |
83edc0a5 | 15 | public: |
925e9792 | 16 | MyApp(){}; |
83edc0a5 | 17 | bool OnInit(); |
c801d85f KB |
18 | }; |
19 | ||
9e023db7 VZ |
20 | // the main frame class |
21 | class MyFrame : public wxFrame | |
c801d85f | 22 | { |
83edc0a5 | 23 | public: |
9e023db7 | 24 | MyFrame(); |
c801d85f | 25 | |
7235f8e1 | 26 | void TestProportions(wxCommandEvent& event); |
9e023db7 | 27 | void TestFlexSizers(wxCommandEvent& event); |
83edc0a5 | 28 | void TestNotebookSizers(wxCommandEvent& event); |
20b35a69 | 29 | void TestGridBagSizer(wxCommandEvent& event); |
a1a3bffc | 30 | void TestNested(wxCommandEvent& event); |
92c0c172 | 31 | void TestSetMinimal(wxCommandEvent& event); |
15f7c305 | 32 | void TestWrap(wxCommandEvent& event); |
925e9792 | 33 | |
9e023db7 VZ |
34 | void OnAbout(wxCommandEvent& event); |
35 | void OnQuit(wxCommandEvent& event); | |
c801d85f | 36 | |
83edc0a5 RR |
37 | private: |
38 | DECLARE_EVENT_TABLE() | |
c801d85f KB |
39 | }; |
40 | ||
7235f8e1 VZ |
41 | // a frame showing the box sizer proportions |
42 | class MyProportionsFrame : public wxFrame | |
43 | { | |
44 | public: | |
45 | MyProportionsFrame(wxFrame *parent); | |
46 | ||
47 | protected: | |
48 | void UpdateProportions(); | |
49 | ||
50 | void OnProportionChanged(wxSpinEvent& event); | |
51 | void OnProportionUpdated(wxCommandEvent& event); | |
52 | ||
53 | wxSpinCtrl *m_spins[3]; // size can be changed without changing anything else | |
54 | wxSizer *m_sizer; | |
55 | }; | |
56 | ||
9e023db7 VZ |
57 | // a frame using flex sizers for layout |
58 | class MyFlexSizerFrame : public wxFrame | |
c801d85f | 59 | { |
83edc0a5 | 60 | public: |
15f7c305 | 61 | MyFlexSizerFrame(const wxString &title, int x, int y ); |
83edc0a5 | 62 | |
2b5f62a0 | 63 | private: |
bdbb07ed | 64 | void InitFlexSizer(wxFlexGridSizer *sizer, wxWindow* parent); |
c801d85f KB |
65 | }; |
66 | ||
20b35a69 | 67 | |
9e023db7 VZ |
68 | // a dialog using notebook sizer for layout |
69 | class MySizerDialog : public wxDialog | |
c62ac5b6 | 70 | { |
83edc0a5 | 71 | public: |
15f7c305 | 72 | MySizerDialog(wxWindow *parent, const wxString &title ); |
9e023db7 VZ |
73 | }; |
74 | ||
20b35a69 RD |
75 | |
76 | // a frame using wxGridBagSizer for layout | |
77 | class MyGridBagSizerFrame : public wxFrame | |
78 | { | |
79 | public: | |
15f7c305 | 80 | MyGridBagSizerFrame(const wxString &title, int x, int y ); |
20b35a69 RD |
81 | |
82 | void OnHideBtn(wxCommandEvent&); | |
83 | void OnShowBtn(wxCommandEvent&); | |
84 | void OnMoveBtn(wxCommandEvent&); | |
925e9792 | 85 | |
20b35a69 RD |
86 | private: |
87 | wxGridBagSizer* m_gbs; | |
88 | wxPanel* m_panel; | |
89 | wxButton* m_hideBtn; | |
90 | wxButton* m_showBtn; | |
91 | wxTextCtrl* m_hideTxt; | |
92 | ||
93 | wxButton* m_moveBtn1; | |
94 | wxButton* m_moveBtn2; | |
95 | wxGBPosition m_lastPos; | |
925e9792 | 96 | |
20b35a69 RD |
97 | DECLARE_EVENT_TABLE() |
98 | }; | |
99 | ||
100 | ||
92c0c172 RR |
101 | // a frame for testing simple setting of "default size" |
102 | class MySimpleSizerFrame : public wxFrame | |
103 | { | |
104 | public: | |
15f7c305 | 105 | MySimpleSizerFrame(const wxString &title, int x, int y ); |
ce00f59b | 106 | |
92c0c172 RR |
107 | void OnSetSmallSize( wxCommandEvent &event); |
108 | void OnSetBigSize( wxCommandEvent &event); | |
ce00f59b | 109 | |
92c0c172 RR |
110 | private: |
111 | wxTextCtrl *m_target; | |
20b35a69 | 112 | |
92c0c172 RR |
113 | DECLARE_EVENT_TABLE() |
114 | }; | |
20b35a69 RD |
115 | |
116 | ||
a1a3bffc RR |
117 | // a frame for testing simple setting of a frame containing |
118 | // a sizer containing a panel containing a sizer containing | |
119 | // controls | |
120 | class MyNestedSizerFrame : public wxFrame | |
121 | { | |
122 | public: | |
15f7c305 | 123 | MyNestedSizerFrame(const wxString &title, int x, int y ); |
ce00f59b VZ |
124 | |
125 | ||
a1a3bffc RR |
126 | private: |
127 | wxTextCtrl *m_target; | |
128 | }; | |
129 | ||
15f7c305 RR |
130 | // a frame with several wrapping sizers |
131 | ||
132 | class MyWrapSizerFrame: public wxFrame | |
133 | { | |
134 | public: | |
135 | MyWrapSizerFrame(const wxString &title, int x, int y ); | |
73eb7ca9 VZ |
136 | |
137 | private: | |
138 | void OnAddCheckbox(wxCommandEvent& event); | |
139 | void OnRemoveCheckbox(wxCommandEvent& event); | |
140 | ||
141 | void DoAddCheckbox(); | |
142 | ||
143 | wxWindow* m_checkboxParent; | |
144 | wxSizer* m_wrapSizer; | |
145 | ||
146 | DECLARE_EVENT_TABLE() | |
15f7c305 RR |
147 | }; |
148 | ||
20b35a69 | 149 | // controls and menu constants |
9e023db7 VZ |
150 | enum |
151 | { | |
91b07357 | 152 | LAYOUT_TEST_SIZER = 101, |
7235f8e1 VZ |
153 | LAYOUT_TEST_NB_SIZER, |
154 | LAYOUT_TEST_GB_SIZER, | |
155 | LAYOUT_TEST_PROPORTIONS, | |
92c0c172 | 156 | LAYOUT_TEST_SET_MINIMAL, |
a1a3bffc | 157 | LAYOUT_TEST_NESTED, |
15f7c305 | 158 | LAYOUT_TEST_WRAP, |
7235f8e1 VZ |
159 | LAYOUT_QUIT = wxID_EXIT, |
160 | LAYOUT_ABOUT = wxID_ABOUT | |
c62ac5b6 RR |
161 | }; |
162 |