]>
git.saurik.com Git - wxWidgets.git/blob - samples/layout/layout.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Layout sample
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // Define a new application
12 class MyApp
: public wxApp
19 // the main frame class
20 class MyFrame
: public wxFrame
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
);
33 void OnAbout(wxCommandEvent
& event
);
34 void OnQuit(wxCommandEvent
& event
);
40 // a frame showing the box sizer proportions
41 class MyProportionsFrame
: public wxFrame
44 MyProportionsFrame(wxFrame
*parent
);
47 void UpdateProportions();
49 void OnProportionChanged(wxSpinEvent
& event
);
50 void OnProportionUpdated(wxCommandEvent
& event
);
52 wxSpinCtrl
*m_spins
[3]; // size can be changed without changing anything else
56 // a frame using flex sizers for layout
57 class MyFlexSizerFrame
: public wxFrame
60 MyFlexSizerFrame(wxFrame
* parent
);
63 void InitFlexSizer(wxFlexGridSizer
*sizer
, wxWindow
* parent
);
67 // a dialog using notebook sizer for layout
68 class MySizerDialog
: public wxDialog
71 MySizerDialog(wxWindow
*parent
, const wxString
&title
);
75 // a frame using wxGridBagSizer for layout
76 class MyGridBagSizerFrame
: public wxFrame
79 MyGridBagSizerFrame(wxFrame
* parent
);
81 void OnHideBtn(wxCommandEvent
&);
82 void OnShowBtn(wxCommandEvent
&);
83 void OnMoveBtn(wxCommandEvent
&);
86 wxGridBagSizer
* m_gbs
;
90 wxTextCtrl
* m_hideTxt
;
94 wxGBPosition m_lastPos
;
100 // a frame for testing simple setting of "default size"
101 class MySimpleSizerFrame
: public wxFrame
104 MySimpleSizerFrame(wxFrame
* parent
);
106 void OnSetSmallSize( wxCommandEvent
&event
);
107 void OnSetBigSize( wxCommandEvent
&event
);
110 wxTextCtrl
*m_target
;
112 DECLARE_EVENT_TABLE()
116 // a frame for testing simple setting of a frame containing
117 // a sizer containing a panel containing a sizer containing
119 class MyNestedSizerFrame
: public wxFrame
122 MyNestedSizerFrame(wxFrame
* parent
);
126 wxTextCtrl
*m_target
;
129 // a frame with several wrapping sizers
131 class MyWrapSizerFrame
: public wxFrame
134 MyWrapSizerFrame(wxFrame
* parent
);
137 void OnAddCheckbox(wxCommandEvent
& event
);
138 void OnRemoveCheckbox(wxCommandEvent
& event
);
140 void DoAddCheckbox();
142 wxWindow
* m_checkboxParent
;
143 wxSizer
* m_wrapSizer
;
145 DECLARE_EVENT_TABLE()
148 // controls and menu constants
151 LAYOUT_TEST_SIZER
= 101,
152 LAYOUT_TEST_NB_SIZER
,
153 LAYOUT_TEST_GB_SIZER
,
154 LAYOUT_TEST_PROPORTIONS
,
155 LAYOUT_TEST_SET_MINIMAL
,
158 LAYOUT_QUIT
= wxID_EXIT
,
159 LAYOUT_ABOUT
= wxID_ABOUT