+ m_frameToolBar = toolbar;
+ if (toolbar)
+ {
+ if (toolbar->IsVertical())
+ {
+ // Vertical toolbar and m_wxwindow go into an hbox, inside the
+ // vbox (m_mainWidget). hbox is created on demand.
+ GtkWidget* hbox = gtk_widget_get_parent(m_wxwindow);
+ if (!GTK_IS_HBOX(hbox))
+ {
+ hbox = gtk_hbox_new(false, 0);
+ gtk_widget_show(hbox);
+ gtk_container_add(GTK_CONTAINER(m_mainWidget), hbox);
+ gtk_widget_reparent(m_wxwindow, hbox);
+ }
+ gtk_widget_reparent(toolbar->m_widget, hbox);
+ gtk_box_set_child_packing(GTK_BOX(hbox),
+ toolbar->m_widget, false, false, 0, GTK_PACK_START);
+
+ int pos = 0; // left
+ if (toolbar->HasFlag(wxTB_RIGHT))
+ pos = 1; // right
+ gtk_box_reorder_child(GTK_BOX(hbox), toolbar->m_widget, pos);
+ }
+ else
+ {
+ // Horizontal toolbar goes into vbox (m_mainWidget)
+ gtk_widget_reparent(toolbar->m_widget, m_mainWidget);
+ gtk_box_set_child_packing(GTK_BOX(m_mainWidget),
+ toolbar->m_widget, false, false, 0, GTK_PACK_START);
+
+ int pos = 0; // top
+ if (m_frameMenuBar)
+ pos = 1; // below menubar
+ if (toolbar->HasFlag(wxTB_BOTTOM))
+ pos += 2; // below client area (m_wxwindow)
+ gtk_box_reorder_child(
+ GTK_BOX(m_mainWidget), toolbar->m_widget, pos);
+ }
+
+ // disconnect wxWindowGTK "size_request" handler,
+ // it interferes with sizing of detached GtkHandleBox
+ gulong handler_id = g_signal_handler_find(
+ toolbar->m_widget,
+ GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA),
+ g_signal_lookup("size_request", GTK_TYPE_WIDGET),
+ 0, NULL, NULL, toolbar);
+ if (handler_id != 0)
+ g_signal_handler_disconnect(toolbar->m_widget, handler_id);
+
+ // reset size request to allow native sizing to work
+ gtk_widget_set_size_request(toolbar->m_widget, -1, -1);
+ }
+ // make sure next size_allocate causes a wxSizeEvent
+ m_oldClientWidth = 0;
+}