-#ifdef __WXMSW__
- int width = 24;
-#else
- int width = 16;
-#endif
- int currentX = 5;
-
- toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
- currentX += width + 5;
- toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
-
- wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO);
- combo->Append("This");
- combo->Append("is a");
- combo->Append("combobox");
- combo->Append("in a");
- combo->Append("toolbar");
- toolBar->AddControl(combo);
-
- if ( !smallicons )
- {
- currentX += width + 5;
- toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
- currentX += width + 5;
- toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 2");
- currentX += width + 5;
- toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Toggle/Untoggle help button");
- currentX += width + 5;
- toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
- currentX += width + 5;
- toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Delete this tool");
- currentX += width + 5;
- toolBar->AddSeparator();
- toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help button");
- }
-
- toolBar->Realize();
-
- // Can delete the bitmaps since they're reference counted
- int i, max = smallicons ? 2 : WXSIZEOF(toolBarBitmaps);
- for (i = 0; i < max; i++)
- delete toolBarBitmaps[i];
-
- return TRUE;
+ SetToolBar(NULL);
+
+ style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL);
+ style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL;
+
+ toolBar = CreateToolBar(style, ID_TOOLBAR);
+ //toolBar->SetMargins( 4, 4 );
+
+ // Set up toolbar
+ wxBitmap toolBarBitmaps[8];
+
+#if USE_XPM_BITMAPS
+ toolBarBitmaps[0] = wxBitmap(new_xpm);
+ toolBarBitmaps[1] = wxBitmap(open_xpm);
+ toolBarBitmaps[2] = wxBitmap(save_xpm);
+ toolBarBitmaps[3] = wxBitmap(copy_xpm);
+ toolBarBitmaps[4] = wxBitmap(cut_xpm);
+ toolBarBitmaps[5] = wxBitmap(paste_xpm);
+ toolBarBitmaps[6] = wxBitmap(print_xpm);
+ toolBarBitmaps[7] = wxBitmap(help_xpm);
+#else // !USE_XPM_BITMAPS
+ toolBarBitmaps[0] = wxBITMAP(new);
+ toolBarBitmaps[1] = wxBITMAP(open);
+ toolBarBitmaps[2] = wxBITMAP(save);
+ toolBarBitmaps[3] = wxBITMAP(copy);
+ toolBarBitmaps[4] = wxBITMAP(cut);
+ toolBarBitmaps[5] = wxBITMAP(paste);
+ toolBarBitmaps[6] = wxBITMAP(print);
+ toolBarBitmaps[7] = wxBITMAP(help);
+#endif // USE_XPM_BITMAPS/!USE_XPM_BITMAPS
+
+ if ( !m_smallToolbar )
+ {
+ int w = 2*toolBarBitmaps[0].GetWidth(),
+ h = 2*toolBarBitmaps[0].GetHeight();
+ for ( size_t n = 0; n < WXSIZEOF(toolBarBitmaps); n++ )
+ {
+ toolBarBitmaps[n] =
+ wxBitmap(toolBarBitmaps[n].ConvertToImage().Scale(w, h));
+ }
+
+ toolBar->SetToolBitmapSize(wxSize(w, h));
+ }
+
+ toolBar->AddTool(wxID_NEW, _T("New"), toolBarBitmaps[0], _T("New file"));
+ toolBar->AddTool(wxID_OPEN, _T("Open"), toolBarBitmaps[1], _T("Open file"));
+
+ // neither the generic nor Motif native toolbars really support this
+#if (wxUSE_TOOLBAR_NATIVE && !USE_GENERIC_TBAR) && !defined(__WXMOTIF__) && !defined(__WXX11__)
+ // adding a combo to a vertical toolbar is not very smart
+ if ( m_horzToolbar )
+ {
+ wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, "", wxDefaultPosition, wxSize(200,-1) );
+ combo->Append("This");
+ combo->Append("is a");
+ combo->Append("combobox");
+ combo->Append("in a");
+ combo->Append("toolbar");
+ toolBar->AddControl(combo);
+ }
+#endif // toolbars which don't support controls
+
+ toolBar->AddTool(wxID_SAVE, _T("Save"), toolBarBitmaps[2], _T("Toggle button 1"), wxITEM_CHECK);
+ toolBar->AddTool(wxID_COPY, _T("Copy"), toolBarBitmaps[3], _T("Toggle button 2"), wxITEM_CHECK);
+ toolBar->AddTool(wxID_CUT, _T("Cut"), toolBarBitmaps[4], _T("Toggle/Untoggle help button"));
+ toolBar->AddTool(wxID_PASTE, _T("Paste"), toolBarBitmaps[5], _T("Paste"));
+ toolBar->AddTool(wxID_PRINT, _T("Print"), toolBarBitmaps[6], _T("Delete this tool"));
+ toolBar->AddSeparator();
+ toolBar->AddTool(wxID_HELP, _T("Help"), toolBarBitmaps[7], _T("Help button"), wxITEM_CHECK);
+
+ // after adding the buttons to the toolbar, must call Realize() to reflect
+ // the changes
+ toolBar->Realize();
+
+ toolBar->SetRows(m_horzToolbar ? m_rows : 10 / m_rows);