1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: layout.h
|
|
|
|
// Purpose: Layout sample
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 06:55:54 -05:00
|
|
|
// Copyright: (c) Julian Smart
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Define a new application
|
|
|
|
class MyApp: public wxApp
|
|
|
|
{
|
1999-12-11 10:07:14 -05:00
|
|
|
public:
|
2004-10-06 16:54:57 -04:00
|
|
|
MyApp(){};
|
1999-12-11 10:07:14 -05:00
|
|
|
bool OnInit();
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2003-02-27 07:02:22 -05:00
|
|
|
// the main frame class
|
|
|
|
class MyFrame : public wxFrame
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-12-11 10:07:14 -05:00
|
|
|
public:
|
2003-02-27 07:02:22 -05:00
|
|
|
MyFrame();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2005-07-13 06:08:52 -04:00
|
|
|
void TestProportions(wxCommandEvent& event);
|
2003-02-27 07:02:22 -05:00
|
|
|
void TestFlexSizers(wxCommandEvent& event);
|
1999-12-11 10:07:14 -05:00
|
|
|
void TestNotebookSizers(wxCommandEvent& event);
|
2003-11-05 20:31:44 -05:00
|
|
|
void TestGridBagSizer(wxCommandEvent& event);
|
2006-10-29 13:10:32 -05:00
|
|
|
void TestNested(wxCommandEvent& event);
|
2006-10-10 04:57:46 -04:00
|
|
|
void TestSetMinimal(wxCommandEvent& event);
|
2007-12-08 06:37:17 -05:00
|
|
|
void TestWrap(wxCommandEvent& event);
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2003-02-27 07:02:22 -05:00
|
|
|
void OnAbout(wxCommandEvent& event);
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-12-11 10:07:14 -05:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2005-07-13 06:08:52 -04:00
|
|
|
// a frame showing the box sizer proportions
|
|
|
|
class MyProportionsFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MyProportionsFrame(wxFrame *parent);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void UpdateProportions();
|
|
|
|
|
|
|
|
void OnProportionChanged(wxSpinEvent& event);
|
|
|
|
void OnProportionUpdated(wxCommandEvent& event);
|
|
|
|
|
|
|
|
wxSpinCtrl *m_spins[3]; // size can be changed without changing anything else
|
|
|
|
wxSizer *m_sizer;
|
|
|
|
};
|
|
|
|
|
2003-02-27 07:02:22 -05:00
|
|
|
// a frame using flex sizers for layout
|
|
|
|
class MyFlexSizerFrame : public wxFrame
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-12-11 10:07:14 -05:00
|
|
|
public:
|
2007-12-08 06:37:17 -05:00
|
|
|
MyFlexSizerFrame(const wxString &title, int x, int y );
|
1999-12-11 10:07:14 -05:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
private:
|
2005-01-18 16:21:57 -05:00
|
|
|
void InitFlexSizer(wxFlexGridSizer *sizer, wxWindow* parent);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2003-11-05 20:31:44 -05:00
|
|
|
|
2003-02-27 07:02:22 -05:00
|
|
|
// a dialog using notebook sizer for layout
|
|
|
|
class MySizerDialog : public wxDialog
|
1999-08-08 12:45:57 -04:00
|
|
|
{
|
1999-12-11 10:07:14 -05:00
|
|
|
public:
|
2007-12-08 06:37:17 -05:00
|
|
|
MySizerDialog(wxWindow *parent, const wxString &title );
|
2003-02-27 07:02:22 -05:00
|
|
|
};
|
|
|
|
|
2003-11-05 20:31:44 -05:00
|
|
|
|
|
|
|
// a frame using wxGridBagSizer for layout
|
|
|
|
class MyGridBagSizerFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2007-12-08 06:37:17 -05:00
|
|
|
MyGridBagSizerFrame(const wxString &title, int x, int y );
|
2003-11-05 20:31:44 -05:00
|
|
|
|
|
|
|
void OnHideBtn(wxCommandEvent&);
|
|
|
|
void OnShowBtn(wxCommandEvent&);
|
|
|
|
void OnMoveBtn(wxCommandEvent&);
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2003-11-05 20:31:44 -05:00
|
|
|
private:
|
|
|
|
wxGridBagSizer* m_gbs;
|
|
|
|
wxPanel* m_panel;
|
|
|
|
wxButton* m_hideBtn;
|
|
|
|
wxButton* m_showBtn;
|
|
|
|
wxTextCtrl* m_hideTxt;
|
|
|
|
|
|
|
|
wxButton* m_moveBtn1;
|
|
|
|
wxButton* m_moveBtn2;
|
|
|
|
wxGBPosition m_lastPos;
|
2004-10-06 16:54:57 -04:00
|
|
|
|
2003-11-05 20:31:44 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-10-10 04:57:46 -04:00
|
|
|
// a frame for testing simple setting of "default size"
|
|
|
|
class MySimpleSizerFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2007-12-08 06:37:17 -05:00
|
|
|
MySimpleSizerFrame(const wxString &title, int x, int y );
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2006-10-10 04:57:46 -04:00
|
|
|
void OnSetSmallSize( wxCommandEvent &event);
|
|
|
|
void OnSetBigSize( wxCommandEvent &event);
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2006-10-10 04:57:46 -04:00
|
|
|
private:
|
|
|
|
wxTextCtrl *m_target;
|
2003-11-05 20:31:44 -05:00
|
|
|
|
2006-10-10 04:57:46 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
2003-11-05 20:31:44 -05:00
|
|
|
|
|
|
|
|
2006-10-29 13:10:32 -05:00
|
|
|
// a frame for testing simple setting of a frame containing
|
|
|
|
// a sizer containing a panel containing a sizer containing
|
|
|
|
// controls
|
|
|
|
class MyNestedSizerFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2007-12-08 06:37:17 -05:00
|
|
|
MyNestedSizerFrame(const wxString &title, int x, int y );
|
2010-09-30 07:44:45 -04:00
|
|
|
|
|
|
|
|
2006-10-29 13:10:32 -05:00
|
|
|
private:
|
|
|
|
wxTextCtrl *m_target;
|
|
|
|
};
|
|
|
|
|
2007-12-08 06:37:17 -05:00
|
|
|
// a frame with several wrapping sizers
|
|
|
|
|
|
|
|
class MyWrapSizerFrame: public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MyWrapSizerFrame(const wxString &title, int x, int y );
|
|
|
|
};
|
|
|
|
|
2003-11-05 20:31:44 -05:00
|
|
|
// controls and menu constants
|
2003-02-27 07:02:22 -05:00
|
|
|
enum
|
|
|
|
{
|
2005-06-02 08:04:48 -04:00
|
|
|
LAYOUT_TEST_SIZER = 101,
|
2005-07-13 06:08:52 -04:00
|
|
|
LAYOUT_TEST_NB_SIZER,
|
|
|
|
LAYOUT_TEST_GB_SIZER,
|
|
|
|
LAYOUT_TEST_PROPORTIONS,
|
2006-10-10 04:57:46 -04:00
|
|
|
LAYOUT_TEST_SET_MINIMAL,
|
2006-10-29 13:10:32 -05:00
|
|
|
LAYOUT_TEST_NESTED,
|
2007-12-08 06:37:17 -05:00
|
|
|
LAYOUT_TEST_WRAP,
|
2005-07-13 06:08:52 -04:00
|
|
|
LAYOUT_QUIT = wxID_EXIT,
|
|
|
|
LAYOUT_ABOUT = wxID_ABOUT
|
1999-08-08 12:45:57 -04:00
|
|
|
};
|
|
|
|
|