X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..9db177273906bb393b97b4a98f6a8b4d61e8f0e3:/src/osx/radiobox_osx.cpp diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index 874381292c..bc209286cb 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/radiobox.cpp +// Name: src/osx/radiobox_osx.cpp // Purpose: wxRadioBox // Author: Stefan Csomor // Modified by: JS Lair (99/11/15) first implementation @@ -97,15 +97,14 @@ bool wxRadioBox::Create( wxWindow *parent, int n, const wxString choices[], int majorDim, long style, const wxValidator& val, const wxString& name ) -{ - m_macIsUserPane = false ; - +{ + DontCreatePeer(); + if ( !wxControl::Create( parent, id, pos, size, style, val, name ) ) return false; - int i; - - m_noItems = (unsigned int)n; + // during construction we must keep this at 0, otherwise GetBestSize fails + m_noItems = 0; m_noRowsOrCols = majorDim; m_radioButtonCycle = NULL; @@ -113,9 +112,9 @@ bool wxRadioBox::Create( wxWindow *parent, m_labelOrig = m_label = label; - m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() )); - for (i = 0; i < n; i++) + for (int i = 0; i < n; i++) { wxRadioButton *radBtn = new wxRadioButton( this, @@ -130,7 +129,13 @@ bool wxRadioBox::Create( wxWindow *parent, // m_radioButtonCycle = radBtn->AddInCycle( m_radioButtonCycle ); } + // as all radiobuttons have been set-up, set the correct dimensions + m_noItems = (unsigned int)n; + SetMajorDim( majorDim == 0 ? n : majorDim, style ); + SetSelection( 0 ); + InvalidateBestSize(); + SetInitialSize( size ); MacPostControlCreate( pos, size ); return true;