Fix positioning of radio buttons inside wxOSX radio boxes in some cases.

If the previous radio box size was too small (notably (0,0) as it happened
during AUI relayout), the buttons were positioned without taking the box
margins into account, resulting in visually broken display.

Recompute the full size after setting the new size but before positioning the
buttons in wxRadioBox::DoSetSize() to avoid this.

Closes #14087.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-11-09 18:46:04 +00:00
parent a2eeaaf090
commit 42f3e38799

View File

@ -432,7 +432,13 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
totHeight = GetRowCount() * maxHeight + (GetRowCount() - 1) * space;
totWidth = GetColumnCount() * (maxWidth + charWidth);
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
// Determine the full size in case we need to use it as fallback.
wxSize sz;
if ( (width == wxDefaultCoord && (sizeFlags & wxSIZE_AUTO_WIDTH)) ||
(height == wxDefaultCoord && (sizeFlags & wxSIZE_AUTO_HEIGHT)) )
{
sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
}
// change the width / height only when specified
if ( width == wxDefaultCoord )
@ -453,6 +459,11 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
wxControl::DoSetSize( x_offset, y_offset, width, height, wxSIZE_AUTO );
// But now recompute the full size again because it could have changed.
// This notably happens if the previous full size was too small to fully
// fit the box margins.
sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
// arrange radio buttons
int x_start, y_start;