avoid gtk_widget_reparent(), deprecated in GTK+ 3.14

(cherry picked from commit f8e430e479)
This commit is contained in:
Paul Cornett
2015-10-10 10:40:57 -07:00
parent 41e5cd4506
commit d3dba370da
2 changed files with 11 additions and 10 deletions

View File

@@ -328,6 +328,8 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
m_frameToolBar = toolbar;
if (toolbar)
{
gtk_container_remove(
GTK_CONTAINER(gtk_widget_get_parent(toolbar->m_widget)), toolbar->m_widget);
if (toolbar->IsVertical())
{
// Vertical toolbar and m_wxwindow go into an hbox, inside the
@@ -343,9 +345,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
gtk_box_pack_start(GTK_BOX(hbox), m_wxwindow, true, true, 0);
g_object_unref(m_wxwindow);
}
gtk_widget_reparent(toolbar->m_widget, hbox);
gtk_box_set_child_packing(GTK_BOX(hbox),
toolbar->m_widget, false, false, 0, GTK_PACK_START);
gtk_box_pack_start(GTK_BOX(hbox), toolbar->m_widget, false, false, 0);
int pos = 0; // left
if (toolbar->HasFlag(wxTB_RIGHT))
@@ -355,9 +355,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
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);
gtk_box_pack_start(GTK_BOX(m_mainWidget), toolbar->m_widget, false, false, 0);
int pos = 0; // top
if (m_frameMenuBar)
@@ -385,9 +383,9 @@ void wxFrame::SetStatusBar(wxStatusBar *statbar)
if (statbar)
{
// statusbar goes into bottom of vbox (m_mainWidget)
gtk_widget_reparent(statbar->m_widget, m_mainWidget);
gtk_box_set_child_packing(GTK_BOX(m_mainWidget),
statbar->m_widget, false, false, 0, GTK_PACK_END);
gtk_container_remove(
GTK_CONTAINER(gtk_widget_get_parent(statbar->m_widget)), statbar->m_widget);
gtk_box_pack_end(GTK_BOX(m_mainWidget), statbar->m_widget, false, false, 0);
// make sure next size_allocate on statusbar causes a size event
statbar->m_useCachedClientSize = false;
statbar->m_clientWidth = 0;

View File

@@ -281,7 +281,10 @@ void wxToolBarTool::CreateDropDown()
GtkWidget* box = gtk_box_new(orient, 0);
GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE);
GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
gtk_widget_reparent(tool_button, box);
g_object_ref(tool_button);
gtk_container_remove(GTK_CONTAINER(m_item), tool_button);
gtk_container_add(GTK_CONTAINER(box), tool_button);
g_object_unref(tool_button);
GtkWidget* arrow_button = gtk_toggle_button_new();
gtk_button_set_relief(GTK_BUTTON(arrow_button),
gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));