+ const wxSize margins = win->GetMargins();
+ req->width += margins.x;
+ req->height += 2 * margins.y;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "expose_event" from GtkImage inside m_item
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
+{
+ const wxBitmap& bitmap = tool->GetDisabledBitmap();
+ if (tool->IsEnabled() || !bitmap.IsOk())
+ return false;
+
+ // draw disabled bitmap ourselves, GtkImage has no way to specify it
+ const GtkAllocation& alloc = widget->allocation;
+ gdk_draw_pixbuf(
+ widget->window, widget->style->black_gc, bitmap.GetPixbuf(),
+ 0, 0,
+ alloc.x + (alloc.width - widget->requisition.width) / 2,
+ alloc.y + (alloc.height - widget->requisition.height) / 2,
+ -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0);
+ return true;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "toggled" from dropdown menu button
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void arrow_toggled(GtkToggleButton* button, wxToolBarTool* tool)
+{
+ if (gtk_toggle_button_get_active(button))
+ {
+ tool->ShowDropdown(button);
+ gtk_toggle_button_set_active(button, false);
+ }
+}
+}
+
+//-----------------------------------------------------------------------------
+// "button_press_event" from dropdown menu button
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+arrow_button_press_event(GtkToggleButton* button, GdkEventButton* event, wxToolBarTool* tool)
+{
+ if (event->button == 1)
+ {
+ g_signal_handlers_block_by_func(button, (void*)arrow_toggled, tool);
+ gtk_toggle_button_set_active(button, true);
+ tool->ShowDropdown(button);
+ gtk_toggle_button_set_active(button, false);
+ g_signal_handlers_unblock_by_func(button, (void*)arrow_toggled, tool);
+ return true;
+ }
+ return false;
+}
+}
+
+void wxToolBar::AddChildGTK(wxWindowGTK* child)
+{
+ GtkWidget* align = gtk_alignment_new(0.5, 0.5, 0, 0);
+ gtk_widget_show(align);
+ gtk_container_add(GTK_CONTAINER(align), child->m_widget);
+ GtkToolItem* item = gtk_tool_item_new();
+ gtk_container_add(GTK_CONTAINER(item), align);
+ // position will be corrected in DoInsertTool if necessary
+ gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(m_widget)->child), item, -1);