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