- }
-
- 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_image,
- (GtkSignalFunc)gtk_toolbar_callback,
- (gpointer)tool,
- posGtk
- );
-
- wxCHECK_MSG(tool->m_item != NULL, false, _T("gtk_toolbar_insert_element() failed"));
-
- g_signal_connect (tool->m_item, "enter_notify_event",
- G_CALLBACK (gtk_toolbar_tool_callback),
- tool);
- g_signal_connect (tool->m_item, "leave_notify_event",
- G_CALLBACK (gtk_toolbar_tool_callback),
- tool);
- g_signal_connect(tool->m_item, "button-press-event",
- G_CALLBACK (gtk_toolbar_tool_rclick_callback),
- tool);
-
- if (tool->GetKind() == wxITEM_DROPDOWN)
- {
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data( arrow_down_xpm );
- GtkWidget *dropdown = gtk_toggle_button_new();
- GtkWidget *image = gtk_image_new_from_pixbuf( pixbuf );
- gtk_widget_show( image );
- gtk_container_add( GTK_CONTAINER(dropdown), image );
-
- if (GetWindowStyle() & wxTB_FLAT)
- gtk_button_set_relief( GTK_BUTTON(dropdown), GTK_RELIEF_NONE );
- GTK_WIDGET_UNSET_FLAGS (dropdown, GTK_CAN_FOCUS);
- gtk_widget_show( dropdown );
-
- g_signal_connect (dropdown, "enter_notify_event",
- G_CALLBACK (gtk_toolbar_buddy_enter_callback),
- tool->m_item);
- g_signal_connect (dropdown, "leave_notify_event",
- G_CALLBACK (gtk_toolbar_buddy_leave_callback),
- tool->m_item);
- g_signal_connect(dropdown, "button-press-event",
- G_CALLBACK (gtk_toolbar_dropdown_lclick_callback),
- tool);
-
- GtkRequisition req;
- (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(tool->m_item) )->size_request )
- (tool->m_item, &req );
- gtk_widget_set_size_request( dropdown, -1, req.height );
-
- gtk_toolbar_insert_widget(
- m_toolbar,
- dropdown,
- (const char *) NULL,
- (const char *) NULL,
- posGtk+1
- );
- }
+ tool->m_item = gtk_radio_tool_button_new(radioGroup);
+ g_signal_connect(tool->m_item, "toggled",
+ G_CALLBACK(item_toggled), tool);
+ break;
+ default:
+ wxFAIL_MSG("unknown toolbar child type");
+ // fall through
+ case wxITEM_DROPDOWN:
+ case wxITEM_NORMAL:
+ tool->m_item = gtk_tool_button_new(NULL, "");
+ g_signal_connect(tool->m_item, "clicked",
+ G_CALLBACK(item_clicked), tool);
+ break;
+ }
+ if (!HasFlag(wxTB_NOICONS))
+ {
+ GtkWidget* image = gtk_image_new();
+ gtk_tool_button_set_icon_widget(
+ GTK_TOOL_BUTTON(tool->m_item), image);
+ tool->SetImage();
+ gtk_widget_show(image);
+ g_signal_connect(image, "expose_event",
+ G_CALLBACK(image_expose_event), tool);
+ }
+ if (!tool->GetLabel().empty())
+ {
+ gtk_tool_button_set_label(
+ GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(tool->GetLabel()));
+ // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
+ gtk_tool_item_set_is_important(tool->m_item, true);