From 5744fad0f9e0c70f7ea13eaf09f5c865820e0da4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 24 Jan 2014 18:29:45 +0000 Subject: [PATCH] fix GetBordersForSizer(), closes #15872 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/statbox.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index 6d0a9b0db1..2a385b29d1 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -158,8 +158,22 @@ wxStaticBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const { - *borderTop = GetCharHeight(); - *borderOther = GetCharWidth()/2; + GtkAllocation alloc, child_alloc; + gtk_widget_get_allocation(m_widget, &alloc); + const int w_save = alloc.width; + const int h_save = alloc.height; + if (alloc.width < 50) alloc.width = 50; + if (alloc.height < 50) alloc.height = 50; + gtk_widget_set_allocation(m_widget, &alloc); + + GTK_FRAME_GET_CLASS(m_widget)->compute_child_allocation(GTK_FRAME(m_widget), &child_alloc); + + alloc.width = w_save; + alloc.height = h_save; + gtk_widget_set_allocation(m_widget, &alloc); + + *borderTop = child_alloc.y - alloc.y; + *borderOther = child_alloc.x - alloc.x; } #endif // wxUSE_STATBOX