]> git.saurik.com Git - wxWidgets.git/blob - samples/layout/layout.h
Fix outdated comment for wxCondition::Wait().
[wxWidgets.git] / samples / layout / layout.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: layout.h
3 // Purpose: Layout sample
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // Define a new application
12 class MyApp: public wxApp
13 {
14 public:
15 MyApp(){};
16 bool OnInit();
17 };
18
19 // the main frame class
20 class MyFrame : public wxFrame
21 {
22 public:
23 MyFrame();
24
25 void TestProportions(wxCommandEvent& event);
26 void TestFlexSizers(wxCommandEvent& event);
27 void TestNotebookSizers(wxCommandEvent& event);
28 void TestGridBagSizer(wxCommandEvent& event);
29 void TestNested(wxCommandEvent& event);
30 void TestSetMinimal(wxCommandEvent& event);
31 void TestWrap(wxCommandEvent& event);
32
33 void OnAbout(wxCommandEvent& event);
34 void OnQuit(wxCommandEvent& event);
35
36 private:
37 DECLARE_EVENT_TABLE()
38 };
39
40 // a frame showing the box sizer proportions
41 class MyProportionsFrame : public wxFrame
42 {
43 public:
44 MyProportionsFrame(wxFrame *parent);
45
46 protected:
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
56 // a frame using flex sizers for layout
57 class MyFlexSizerFrame : public wxFrame
58 {
59 public:
60 MyFlexSizerFrame(wxFrame* parent);
61
62 private:
63 void InitFlexSizer(wxFlexGridSizer *sizer, wxWindow* parent);
64 };
65
66
67 // a dialog using notebook sizer for layout
68 class MySizerDialog : public wxDialog
69 {
70 public:
71 MySizerDialog(wxWindow *parent, const wxString &title );
72 };
73
74
75 // a frame using wxGridBagSizer for layout
76 class MyGridBagSizerFrame : public wxFrame
77 {
78 public:
79 MyGridBagSizerFrame(wxFrame* parent);
80
81 void OnHideBtn(wxCommandEvent&);
82 void OnShowBtn(wxCommandEvent&);
83 void OnMoveBtn(wxCommandEvent&);
84
85 private:
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;
95
96 DECLARE_EVENT_TABLE()
97 };
98
99
100 // a frame for testing simple setting of "default size"
101 class MySimpleSizerFrame : public wxFrame
102 {
103 public:
104 MySimpleSizerFrame(wxFrame* parent);
105
106 void OnSetSmallSize( wxCommandEvent &event);
107 void OnSetBigSize( wxCommandEvent &event);
108
109 private:
110 wxTextCtrl *m_target;
111
112 DECLARE_EVENT_TABLE()
113 };
114
115
116 // a frame for testing simple setting of a frame containing
117 // a sizer containing a panel containing a sizer containing
118 // controls
119 class MyNestedSizerFrame : public wxFrame
120 {
121 public:
122 MyNestedSizerFrame(wxFrame* parent);
123
124
125 private:
126 wxTextCtrl *m_target;
127 };
128
129 // a frame with several wrapping sizers
130
131 class MyWrapSizerFrame: public wxFrame
132 {
133 public:
134 MyWrapSizerFrame(wxFrame* parent);
135
136 private:
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()
146 };
147
148 // controls and menu constants
149 enum
150 {
151 LAYOUT_TEST_SIZER = 101,
152 LAYOUT_TEST_NB_SIZER,
153 LAYOUT_TEST_GB_SIZER,
154 LAYOUT_TEST_PROPORTIONS,
155 LAYOUT_TEST_SET_MINIMAL,
156 LAYOUT_TEST_NESTED,
157 LAYOUT_TEST_WRAP,
158 LAYOUT_QUIT = wxID_EXIT,
159 LAYOUT_ABOUT = wxID_ABOUT
160 };
161