- wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL,
- "wxToolBar::Add needs a wxBitmap" );
-
- GtkWidget *tool_pixmap = (GtkWidget *)NULL;
-
- GdkPixmap *pixmap = bitmap.GetPixmap();
+ switch ( tool->GetStyle() )
+ {
+ case wxTOOL_STYLE_BUTTON:
+ tool->m_item = gtk_toolbar_insert_element
+ (
+ m_toolbar,
+ tool->CanBeToggled()
+ ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
+ : GTK_TOOLBAR_CHILD_BUTTON,
+ (GtkWidget *)NULL,
+ (const char *)NULL,
+ tool->GetShortHelp().mbc_str(),
+ "", // tooltip_private_text (?)
+ tool->m_pixmap,
+ (GtkSignalFunc)gtk_toolbar_callback,
+ (gpointer)tool,
+ pos
+ );
+
+ if ( !tool->m_item )
+ {
+ wxFAIL_MSG( _T("gtk_toolbar_insert_element() failed") );
+
+ return FALSE;
+ }
+
+ gtk_signal_connect( GTK_OBJECT(tool->m_item),
+ "enter_notify_event",
+ GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
+ (gpointer)tool );
+ gtk_signal_connect( GTK_OBJECT(tool->m_item),
+ "leave_notify_event",
+ GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
+ (gpointer)tool );
+ break;
+
+ case wxTOOL_STYLE_SEPARATOR:
+ gtk_toolbar_insert_space( m_toolbar, pos );
+
+ // skip the rest
+ return TRUE;
+
+ case wxTOOL_STYLE_CONTROL:
+ gtk_toolbar_insert_widget(
+ m_toolbar,
+ tool->GetControl()->m_widget,
+ (const char *) NULL,
+ (const char *) NULL,
+ pos
+ );
+ break;
+ }