+void MyFrame::LayoutChildren()
+{
+ wxSize size = GetClientSize();
+
+ int offset;
+ if ( m_tbar )
+ {
+ m_tbar->SetSize(-1, size.y);
+ m_tbar->Move(0, 0);
+
+ offset = m_tbar->GetSize().x;
+ }
+ else
+ {
+ offset = 0;
+ }
+
+ m_textWindow->SetSize(offset, 0, size.x - offset, size.y);
+}
+
+void MyFrame::OnSize(wxSizeEvent& event)
+{
+ if ( m_tbar )
+ {
+ LayoutChildren();
+ }
+ else
+ {
+ event.Skip();
+ }
+}
+
+void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
+{
+ if ( m_tbar )
+ {
+ delete m_tbar;
+ m_tbar = NULL;
+ }
+ else
+ {
+ m_tbar = new wxToolBar(this, -1,
+ wxDefaultPosition, wxDefaultSize,
+ TOOLBAR_STYLE | wxTB_VERTICAL);
+ m_tbar->AddTool(wxID_HELP, wxBITMAP(help),
+ wxNullBitmap, FALSE,
+ NULL,
+ "This is the help button",
+ "This is the long help for the help button");
+ m_tbar->Realize();
+ }
+
+ LayoutChildren();
+}
+