+ m_smallToolbar = FALSE;
+
+ // Give it a status line
+ CreateStatusBar();
+
+ // Give it an icon
+ SetIcon(wxICON(mondrian));
+
+ // Make a menubar
+ wxMenu *tbarMenu = new wxMenu;
+ tbarMenu->Append(IDM_TOOLBAR_TOGGLETOOLBAR, "&Toggle toolbar", "Change the toolbar kind");
+ tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, "&Enable print button", "");
+ tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button", "");
+ tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button", "");
+
+ wxMenu *fileMenu = new wxMenu;
+ fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" );
+
+ wxMenu *helpMenu = new wxMenu;
+ helpMenu->Append(wxID_HELP, "&About", "About toolbar sample");
+
+ wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
+
+ menuBar->Append(fileMenu, "&File");
+ menuBar->Append(tbarMenu, "&Toolbar");
+ menuBar->Append(helpMenu, "&Help");
+
+ // Associate the menu bar with the frame
+ SetMenuBar(menuBar);
+
+ // Create the toolbar
+ wxToolBar *tbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
+ wxTB_FLAT | wxTB_DOCKABLE,
+ ID_TOOLBAR);
+
+ tbar->SetMargins( 4, 4 );
+
+ wxGetApp().InitToolbar(tbar);
+}
+
+void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
+{
+ // delete and recreate the toolbar
+ wxToolBar *tbar = GetToolBar();
+ delete tbar;
+
+ SetToolBar(NULL);
+ tbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
+ wxTB_FLAT | wxTB_DOCKABLE,
+ ID_TOOLBAR);
+
+ m_smallToolbar = !m_smallToolbar;
+ wxGetApp().InitToolbar(tbar, m_smallToolbar);