]> git.saurik.com Git - wxWidgets.git/blob - samples/layout/layout.h
added never_empty hint on WX_DIR option
[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 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // Define a new application
13 class MyApp: public wxApp
14 {
15 public:
16 MyApp(){};
17 bool OnInit();
18 };
19
20 // the main frame class
21 class MyFrame : public wxFrame
22 {
23 public:
24 MyFrame();
25
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
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(const wxChar *title, int x, int y );
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 wxChar *title);
72 };
73
74
75 // a frame using wxGridBagSizer for layout
76 class MyGridBagSizerFrame : public wxFrame
77 {
78 public:
79 MyGridBagSizerFrame(const wxChar *title, int x, int y );
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(const wxChar *title, int x, int y );
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(const wxChar *title, int x, int y );
123
124
125 private:
126 wxTextCtrl *m_target;
127 };
128
129 // controls and menu constants
130 enum
131 {
132 LAYOUT_TEST_SIZER = 101,
133 LAYOUT_TEST_NB_SIZER,
134 LAYOUT_TEST_GB_SIZER,
135 LAYOUT_TEST_PROPORTIONS,
136 LAYOUT_TEST_SET_MINIMAL,
137 LAYOUT_TEST_NESTED,
138 LAYOUT_QUIT = wxID_EXIT,
139 LAYOUT_ABOUT = wxID_ABOUT
140 };
141