]>
Commit | Line | Data |
---|---|---|
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 | |
13 | class MyApp: public wxApp | |
14 | { | |
83edc0a5 | 15 | public: |
925e9792 | 16 | MyApp(){}; |
83edc0a5 | 17 | bool OnInit(); |
c801d85f KB |
18 | }; |
19 | ||
9e023db7 VZ |
20 | // the main frame class |
21 | class MyFrame : public wxFrame | |
c801d85f | 22 | { |
83edc0a5 | 23 | public: |
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); |
92c0c172 | 30 | void TestSetMinimal(wxCommandEvent& event); |
925e9792 | 31 | |
9e023db7 VZ |
32 | void OnAbout(wxCommandEvent& event); |
33 | void OnQuit(wxCommandEvent& event); | |
c801d85f | 34 | |
83edc0a5 RR |
35 | private: |
36 | DECLARE_EVENT_TABLE() | |
c801d85f KB |
37 | }; |
38 | ||
7235f8e1 VZ |
39 | // a frame showing the box sizer proportions |
40 | class MyProportionsFrame : public wxFrame | |
41 | { | |
42 | public: | |
43 | MyProportionsFrame(wxFrame *parent); | |
44 | ||
45 | protected: | |
46 | void UpdateProportions(); | |
47 | ||
48 | void OnProportionChanged(wxSpinEvent& event); | |
49 | void OnProportionUpdated(wxCommandEvent& event); | |
50 | ||
51 | wxSpinCtrl *m_spins[3]; // size can be changed without changing anything else | |
52 | wxSizer *m_sizer; | |
53 | }; | |
54 | ||
9e023db7 VZ |
55 | // a frame using flex sizers for layout |
56 | class MyFlexSizerFrame : public wxFrame | |
c801d85f | 57 | { |
83edc0a5 | 58 | public: |
9e023db7 | 59 | MyFlexSizerFrame(const wxChar *title, int x, int y ); |
83edc0a5 | 60 | |
2b5f62a0 | 61 | private: |
bdbb07ed | 62 | void InitFlexSizer(wxFlexGridSizer *sizer, wxWindow* parent); |
c801d85f KB |
63 | }; |
64 | ||
20b35a69 | 65 | |
9e023db7 VZ |
66 | // a dialog using notebook sizer for layout |
67 | class MySizerDialog : public wxDialog | |
c62ac5b6 | 68 | { |
83edc0a5 | 69 | public: |
9e023db7 VZ |
70 | MySizerDialog(wxWindow *parent, const wxChar *title); |
71 | }; | |
72 | ||
20b35a69 RD |
73 | |
74 | // a frame using wxGridBagSizer for layout | |
75 | class MyGridBagSizerFrame : public wxFrame | |
76 | { | |
77 | public: | |
78 | MyGridBagSizerFrame(const wxChar *title, int x, int y ); | |
79 | ||
80 | void OnHideBtn(wxCommandEvent&); | |
81 | void OnShowBtn(wxCommandEvent&); | |
82 | void OnMoveBtn(wxCommandEvent&); | |
925e9792 | 83 | |
20b35a69 RD |
84 | private: |
85 | wxGridBagSizer* m_gbs; | |
86 | wxPanel* m_panel; | |
87 | wxButton* m_hideBtn; | |
88 | wxButton* m_showBtn; | |
89 | wxTextCtrl* m_hideTxt; | |
90 | ||
91 | wxButton* m_moveBtn1; | |
92 | wxButton* m_moveBtn2; | |
93 | wxGBPosition m_lastPos; | |
925e9792 | 94 | |
20b35a69 RD |
95 | DECLARE_EVENT_TABLE() |
96 | }; | |
97 | ||
98 | ||
92c0c172 RR |
99 | // a frame for testing simple setting of "default size" |
100 | class MySimpleSizerFrame : public wxFrame | |
101 | { | |
102 | public: | |
103 | MySimpleSizerFrame(const wxChar *title, int x, int y ); | |
104 | ||
105 | void OnSetSmallSize( wxCommandEvent &event); | |
106 | void OnSetBigSize( wxCommandEvent &event); | |
107 | ||
108 | private: | |
109 | wxTextCtrl *m_target; | |
20b35a69 | 110 | |
92c0c172 RR |
111 | DECLARE_EVENT_TABLE() |
112 | }; | |
20b35a69 RD |
113 | |
114 | ||
115 | // controls and menu constants | |
9e023db7 VZ |
116 | enum |
117 | { | |
91b07357 | 118 | LAYOUT_TEST_SIZER = 101, |
7235f8e1 VZ |
119 | LAYOUT_TEST_NB_SIZER, |
120 | LAYOUT_TEST_GB_SIZER, | |
121 | LAYOUT_TEST_PROPORTIONS, | |
92c0c172 | 122 | LAYOUT_TEST_SET_MINIMAL, |
7235f8e1 VZ |
123 | LAYOUT_QUIT = wxID_EXIT, |
124 | LAYOUT_ABOUT = wxID_ABOUT | |
c62ac5b6 RR |
125 | }; |
126 |