- if (!bitmap.Ok()) return NULL;
-
- wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
- clientData, helpString1, helpString2 );
-
- GdkPixmap *pixmap = bitmap.GetPixmap();
-
- GdkBitmap *mask = NULL;
- if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
-
- GtkWidget *tool_pixmap = gtk_pixmap_new( pixmap, mask );
- gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
-
- GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
- if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
-
- gtk_toolbar_append_element( m_toolbar,
- ctype, NULL, NULL, helpString1, "", tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
+ delete m_fg;
+ delete m_bg;
+}
+
+bool wxToolBar::Create( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name )
+{
+ m_needParent = TRUE;
+ m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
+
+ if ( !PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+ {
+ wxFAIL_MSG( wxT("wxToolBar creation failed") );
+
+ return FALSE;
+ }
+
+ GtkOrientation orient = style & wxTB_VERTICAL ? GTK_ORIENTATION_VERTICAL
+ : GTK_ORIENTATION_HORIZONTAL;
+ m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( orient, GTK_TOOLBAR_ICONS ) );
+
+ SetToolSeparation(7);
+
+ if (style & wxTB_DOCKABLE)
+ {
+ m_widget = gtk_handle_box_new();
+ gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
+ gtk_widget_show( GTK_WIDGET(m_toolbar) );
+
+#if (GTK_MINOR_VERSION > 0)
+ if (style & wxTB_FLAT)
+ gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
+#endif
+ }
+ else
+ {
+ m_widget = GTK_WIDGET(m_toolbar);
+ }
+
+ gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
+
+ if (style & wxTB_FLAT)
+ gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE );
+
+
+ m_fg = new GdkColor;
+ m_fg->red = 0;
+ m_fg->green = 0;
+ m_fg->blue = 0;
+ wxColour fg(0,0,0);
+ fg.CalcPixel( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ) );
+ m_fg->pixel = fg.GetPixel();