]>
git.saurik.com Git - wxWidgets.git/blob - samples/layout/layout.h
fc1d1b64cfee9651c4e58bdfff934d10627a5331
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Layout sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // Define a new application
13 class MyApp
: public wxApp
20 // the main frame class
21 class MyFrame
: public wxFrame
26 void TestProportions(wxCommandEvent
& event
);
27 void TestFlexSizers(wxCommandEvent
& event
);
28 void TestNotebookSizers(wxCommandEvent
& event
);
29 void TestGridBagSizer(wxCommandEvent
& event
);
30 void TestNested(wxCommandEvent
& event
);
31 void TestSetMinimal(wxCommandEvent
& event
);
32 void TestWrap(wxCommandEvent
& event
);
34 void OnAbout(wxCommandEvent
& event
);
35 void OnQuit(wxCommandEvent
& event
);
41 // a frame showing the box sizer proportions
42 class MyProportionsFrame
: public wxFrame
45 MyProportionsFrame(wxFrame
*parent
);
48 void UpdateProportions();
50 void OnProportionChanged(wxSpinEvent
& event
);
51 void OnProportionUpdated(wxCommandEvent
& event
);
53 wxSpinCtrl
*m_spins
[3]; // size can be changed without changing anything else
57 // a frame using flex sizers for layout
58 class MyFlexSizerFrame
: public wxFrame
61 MyFlexSizerFrame(wxFrame
* parent
);
64 void InitFlexSizer(wxFlexGridSizer
*sizer
, wxWindow
* parent
);
68 // a dialog using notebook sizer for layout
69 class MySizerDialog
: public wxDialog
72 MySizerDialog(wxWindow
*parent
, const wxString
&title
);
76 // a frame using wxGridBagSizer for layout
77 class MyGridBagSizerFrame
: public wxFrame
80 MyGridBagSizerFrame(wxFrame
* parent
);
82 void OnHideBtn(wxCommandEvent
&);
83 void OnShowBtn(wxCommandEvent
&);
84 void OnMoveBtn(wxCommandEvent
&);
87 wxGridBagSizer
* m_gbs
;
91 wxTextCtrl
* m_hideTxt
;
95 wxGBPosition m_lastPos
;
101 // a frame for testing simple setting of "default size"
102 class MySimpleSizerFrame
: public wxFrame
105 MySimpleSizerFrame(wxFrame
* parent
);
107 void OnSetSmallSize( wxCommandEvent
&event
);
108 void OnSetBigSize( wxCommandEvent
&event
);
111 wxTextCtrl
*m_target
;
113 DECLARE_EVENT_TABLE()
117 // a frame for testing simple setting of a frame containing
118 // a sizer containing a panel containing a sizer containing
120 class MyNestedSizerFrame
: public wxFrame
123 MyNestedSizerFrame(wxFrame
* parent
);
127 wxTextCtrl
*m_target
;
130 // a frame with several wrapping sizers
132 class MyWrapSizerFrame
: public wxFrame
135 MyWrapSizerFrame(wxFrame
* parent
);
138 void OnAddCheckbox(wxCommandEvent
& event
);
139 void OnRemoveCheckbox(wxCommandEvent
& event
);
141 void DoAddCheckbox();
143 wxWindow
* m_checkboxParent
;
144 wxSizer
* m_wrapSizer
;
146 DECLARE_EVENT_TABLE()
149 // controls and menu constants
152 LAYOUT_TEST_SIZER
= 101,
153 LAYOUT_TEST_NB_SIZER
,
154 LAYOUT_TEST_GB_SIZER
,
155 LAYOUT_TEST_PROPORTIONS
,
156 LAYOUT_TEST_SET_MINIMAL
,
159 LAYOUT_QUIT
= wxID_EXIT
,
160 LAYOUT_ABOUT
= wxID_ABOUT