]> git.saurik.com Git - wxWidgets.git/blame - samples/layout/layout.h
call OnInit() from all samples to allow using standard command line options with...
[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
7// RCS-ID: $Id$
6aa89a22 8// Copyright: (c) Julian Smart
2f6c54eb 9// Licence: wxWindows license
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
12// Define a new application
13class MyApp: public wxApp
14{
83edc0a5 15public:
925e9792 16 MyApp(){};
83edc0a5 17 bool OnInit();
c801d85f
KB
18};
19
9e023db7
VZ
20// the main frame class
21class MyFrame : public wxFrame
c801d85f 22{
83edc0a5 23public:
9e023db7 24 MyFrame();
c801d85f 25
7235f8e1 26 void TestProportions(wxCommandEvent& event);
9e023db7 27 void TestFlexSizers(wxCommandEvent& event);
83edc0a5 28 void TestNotebookSizers(wxCommandEvent& event);
20b35a69 29 void TestGridBagSizer(wxCommandEvent& event);
a1a3bffc 30 void TestNested(wxCommandEvent& event);
92c0c172 31 void TestSetMinimal(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:
9e023db7 60 MyFlexSizerFrame(const wxChar *title, int x, int y );
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:
9e023db7
VZ
71 MySizerDialog(wxWindow *parent, const wxChar *title);
72};
73
20b35a69
RD
74
75// a frame using wxGridBagSizer for layout
76class MyGridBagSizerFrame : public wxFrame
77{
78public:
79 MyGridBagSizerFrame(const wxChar *title, int x, int y );
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:
104 MySimpleSizerFrame(const wxChar *title, int x, int y );
105
106 void OnSetSmallSize( wxCommandEvent &event);
107 void OnSetBigSize( wxCommandEvent &event);
108
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:
122 MyNestedSizerFrame(const wxChar *title, int x, int y );
123
124
125private:
126 wxTextCtrl *m_target;
127};
128
20b35a69 129// controls and menu constants
9e023db7
VZ
130enum
131{
91b07357 132 LAYOUT_TEST_SIZER = 101,
7235f8e1
VZ
133 LAYOUT_TEST_NB_SIZER,
134 LAYOUT_TEST_GB_SIZER,
135 LAYOUT_TEST_PROPORTIONS,
92c0c172 136 LAYOUT_TEST_SET_MINIMAL,
a1a3bffc 137 LAYOUT_TEST_NESTED,
7235f8e1
VZ
138 LAYOUT_QUIT = wxID_EXIT,
139 LAYOUT_ABOUT = wxID_ABOUT
c62ac5b6
RR
140};
141