fix GetBordersForSizer(), closes #15872

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2014-01-24 18:29:45 +00:00
parent 25684990fa
commit 3313a31ed3
2 changed files with 17 additions and 2 deletions

View File

@@ -603,6 +603,7 @@ wxGTK:
- Fix wxPopupTransientWindow mouse events with GTK3,
also fixes wxOwnerDrawnComboBox, wxDatePickerCtrl.
- Fix cursor inheritance.
- Fix wxStaticBoxSizer size calculation
wxMSW:

View File

@@ -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