]>
git.saurik.com Git - wxWidgets.git/blob - samples/layout/layout.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Layout sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
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
);
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(const wxChar
*title
, int x
, int y
);
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 wxChar
*title
);
75 // a frame using wxGridBagSizer for layout
76 class MyGridBagSizerFrame
: public wxFrame
79 MyGridBagSizerFrame(const wxChar
*title
, int x
, int y
);
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(const wxChar
*title
, int x
, int y
);
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(const wxChar
*title
, int x
, int y
);
126 wxTextCtrl
*m_target
;
129 // controls and menu constants
132 LAYOUT_TEST_SIZER
= 101,
133 LAYOUT_TEST_NB_SIZER
,
134 LAYOUT_TEST_GB_SIZER
,
135 LAYOUT_TEST_PROPORTIONS
,
136 LAYOUT_TEST_SET_MINIMAL
,
138 LAYOUT_QUIT
= wxID_EXIT
,
139 LAYOUT_ABOUT
= wxID_ABOUT