| 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 | |
| 31 | void OnAbout(wxCommandEvent& event); |
| 32 | void OnQuit(wxCommandEvent& event); |
| 33 | |
| 34 | private: |
| 35 | DECLARE_EVENT_TABLE() |
| 36 | }; |
| 37 | |
| 38 | // a frame showing the box sizer proportions |
| 39 | class MyProportionsFrame : public wxFrame |
| 40 | { |
| 41 | public: |
| 42 | MyProportionsFrame(wxFrame *parent); |
| 43 | |
| 44 | protected: |
| 45 | void UpdateProportions(); |
| 46 | |
| 47 | void OnProportionChanged(wxSpinEvent& event); |
| 48 | void OnProportionUpdated(wxCommandEvent& event); |
| 49 | |
| 50 | wxSpinCtrl *m_spins[3]; // size can be changed without changing anything else |
| 51 | wxSizer *m_sizer; |
| 52 | }; |
| 53 | |
| 54 | // a frame using flex sizers for layout |
| 55 | class MyFlexSizerFrame : public wxFrame |
| 56 | { |
| 57 | public: |
| 58 | MyFlexSizerFrame(const wxChar *title, int x, int y ); |
| 59 | |
| 60 | private: |
| 61 | void InitFlexSizer(wxFlexGridSizer *sizer, wxWindow* parent); |
| 62 | }; |
| 63 | |
| 64 | |
| 65 | // a dialog using notebook sizer for layout |
| 66 | class MySizerDialog : public wxDialog |
| 67 | { |
| 68 | public: |
| 69 | MySizerDialog(wxWindow *parent, const wxChar *title); |
| 70 | }; |
| 71 | |
| 72 | |
| 73 | // a frame using wxGridBagSizer for layout |
| 74 | class MyGridBagSizerFrame : public wxFrame |
| 75 | { |
| 76 | public: |
| 77 | MyGridBagSizerFrame(const wxChar *title, int x, int y ); |
| 78 | |
| 79 | void OnHideBtn(wxCommandEvent&); |
| 80 | void OnShowBtn(wxCommandEvent&); |
| 81 | void OnMoveBtn(wxCommandEvent&); |
| 82 | |
| 83 | private: |
| 84 | wxGridBagSizer* m_gbs; |
| 85 | wxPanel* m_panel; |
| 86 | wxButton* m_hideBtn; |
| 87 | wxButton* m_showBtn; |
| 88 | wxTextCtrl* m_hideTxt; |
| 89 | |
| 90 | wxButton* m_moveBtn1; |
| 91 | wxButton* m_moveBtn2; |
| 92 | wxGBPosition m_lastPos; |
| 93 | |
| 94 | DECLARE_EVENT_TABLE() |
| 95 | }; |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | // controls and menu constants |
| 102 | enum |
| 103 | { |
| 104 | LAYOUT_TEST_SIZER = 101, |
| 105 | LAYOUT_TEST_NB_SIZER, |
| 106 | LAYOUT_TEST_GB_SIZER, |
| 107 | LAYOUT_TEST_PROPORTIONS, |
| 108 | LAYOUT_QUIT = wxID_EXIT, |
| 109 | LAYOUT_ABOUT = wxID_ABOUT |
| 110 | }; |
| 111 | |