From 42f3e38799a038107c9ed1122f06952a41a421fb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Nov 2013 18:46:04 +0000 Subject: [PATCH] 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 --- src/osx/radiobox_osx.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index d728bd821e..2aba6e193b 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -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;