+ gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
+
+ tool->m_pixmap = tool_pixmap;
+ }
+ }
+
+ switch ( tool->GetStyle() )
+ {
+ case wxTOOL_STYLE_BUTTON:
+ // for a radio button we need the widget which starts the radio
+ // group it belongs to, i.e. the first radio button immediately
+ // preceding this one
+ {
+ GtkWidget *widget = NULL;
+
+ if ( tool->IsRadio() )
+ {
+ wxToolBarToolsList::compatibility_iterator node
+ = wxToolBarToolsList::compatibility_iterator();
+ if ( pos ) node = m_tools.Item(pos - 1);
+
+ while ( node )
+ {
+ wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
+ if ( !tool->IsRadio() )
+ break;
+
+ widget = tool->m_item;
+
+ node = node->GetPrevious();
+ }
+
+ if ( !widget )
+ {
+ // this is the first button in the radio button group,
+ // it will be toggled automatically by GTK so bring the
+ // internal flag in sync
+ tool->Toggle(TRUE);
+ }
+ }
+
+ tool->m_item = gtk_toolbar_insert_element
+ (
+ m_toolbar,
+ tool->GetGtkChildType(),
+ widget,
+ tool->GetLabel().empty()
+ ? NULL
+ : (const char*) wxGTK_CONV( tool->GetLabel() ),
+ tool->GetShortHelp().empty()
+ ? NULL
+ : (const char*) wxGTK_CONV( tool->GetShortHelp() ),
+ "", // tooltip_private_text (?)
+ tool->m_pixmap,
+ (GtkSignalFunc)gtk_toolbar_callback,
+ (gpointer)tool,
+ posGtk
+ );
+
+ 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, posGtk );
+
+ // 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,
+ posGtk
+ );
+ break;
+ }
+
+ GtkRequisition req;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
+ (m_widget, &req );
+ m_width = req.width + m_xMargin;
+ m_height = req.height + 2*m_yMargin;