#include "wx/wrapsizer.h"
#include "wx/artprov.h"
-#ifndef __WXMSW__
+#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif
wxToolBar *MakeToolBar()
{
- wxToolBar *tb = new wxToolBar(this, wxID_ANY,
+ wxToolBar *tb = new wxToolBar(m_panel, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxTB_NODIVIDER);
AddToolBarButton(tb, "Help", wxART_HELP_BOOK);
tb->Realize( );
return tb;
}
+
+ wxPanel *m_panel;
};
class WrapSizerApp : public wxApp
{
SetIcon(wxICON(sample));
+ m_panel = new wxPanel(this);
+
// Root sizer, vertical
wxSizer * const sizerRoot = new wxBoxSizer(wxVERTICAL);
sizerRoot->Add(sizerTop, wxSizerFlags().Expand().Border());
// A number of checkboxes inside a wrap sizer
- wxSizer *sizerMid = new wxStaticBoxSizer(wxVERTICAL, this,
+ wxSizer *sizerMid = new wxStaticBoxSizer(wxVERTICAL, m_panel,
"With check-boxes");
wxSizer * const sizerMidWrap = new wxWrapSizer(wxHORIZONTAL);
for ( int nCheck = 0; nCheck < 6; nCheck++ )
{
wxCheckBox *chk = new wxCheckBox
(
- this,
+ m_panel,
wxID_ANY,
wxString::Format("Option %d", nCheck)
);
// A shaped item inside a box sizer
- wxSizer *sizerBottom = new wxStaticBoxSizer(wxVERTICAL, this,
+ wxSizer *sizerBottom = new wxStaticBoxSizer(wxVERTICAL, m_panel,
"With wxSHAPED item");
wxSizer *sizerBottomBox = new wxBoxSizer(wxHORIZONTAL);
sizerBottom->Add(sizerBottomBox, wxSizerFlags(100).Expand());
- sizerBottomBox->Add(new wxListBox(this, wxID_ANY,
+ sizerBottomBox->Add(new wxListBox(m_panel, wxID_ANY,
wxPoint(0, 0), wxSize(70, 70)),
wxSizerFlags().Expand().Shaped());
sizerBottomBox->AddSpacer(10);
- sizerBottomBox->Add(new wxCheckBox(this, wxID_ANY,
+ sizerBottomBox->Add(new wxCheckBox(m_panel, wxID_ANY,
"A much longer option..."),
wxSizerFlags(100).Border());
sizerRoot->Add(sizerBottom, wxSizerFlags(100).Expand().Border());
// OK Button
- sizerRoot->Add(new wxButton(this, wxID_OK),
+ sizerRoot->Add(new wxButton(m_panel, wxID_OK),
wxSizerFlags().Centre().DoubleBorder());
Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(WrapSizerFrame::OnButton));
- // Set sizer for window
- SetSizerAndFit(sizerRoot);
+ // Set sizer for the panel
+ m_panel->SetSizer(sizerRoot);
Show();
}