+#if USE_GENERIC_TBAR
+
+wxToolBar* MyFrame::OnCreateToolBar(long style,
+ wxWindowID id,
+ const wxString& name)
+{
+ return (wxToolBar *)new wxToolBarSimple(this, id,
+ wxDefaultPosition, wxDefaultSize,
+ style, name);
+}
+
+#endif // USE_GENERIC_TBAR
+
+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
+ {
+ long style = GetToolBar()->GetWindowStyle();
+ style &= ~wxTB_HORIZONTAL;
+ style |= wxTB_VERTICAL;
+
+ m_tbar = new wxToolBar(this, -1,
+ wxDefaultPosition, wxDefaultSize,
+ style);
+
+ m_tbar->AddRadioTool(wxID_NEW, _T("First"), wxBITMAP(new));
+ m_tbar->AddRadioTool(wxID_OPEN, _T("Second"), wxBITMAP(open));
+ m_tbar->AddRadioTool(wxID_SAVE, _T("Third"), wxBITMAP(save));
+ m_tbar->AddSeparator();
+ m_tbar->AddTool(wxID_HELP, _T("Help"), wxBITMAP(help));
+
+ m_tbar->Realize();
+ }
+
+ LayoutChildren();
+}
+