bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, int n, const wxString *choices, int majorDim, long style, const wxValidator& wxVALIDATOR_PARAM(val), const wxString& name) { if ( !(style & (wxRA_SPECIFY_ROWS | wxRA_SPECIFY_COLS)) ) style |= wxRA_SPECIFY_COLS; if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) ) return false; #if wxUSE_VALIDATORS SetValidator(val); #endif // wxUSE_VALIDATORS Append(n, choices); // majorDim default value is 0 which means make one row/column SetMajorDim(majorDim == 0 ? n : majorDim, style); if ( size == wxDefaultSize ) { SetClientSize(DoGetBestClientSize()); } // Need to move the radiobox in order to move the radio buttons wxPoint actualPos = GetPosition(); wxSize actualSize = GetSize(); DoMoveWindow(actualPos.x, actualPos.y, actualSize.x, actualSize.y); // radiobox should already have selection so select at least one item SetSelection(0); return true; }
wxSize wxGenericStaticText::DoGetBestSize() const { wxSize ret = DoGetBestClientSize(); CacheBestSize(ret); return ret; }
wxSize wxWindow::DoGetBestSize() const { return AdjustSize(DoGetBestClientSize()); }
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, int n, const wxString *choices, int majorDim, long style, const wxValidator& wxVALIDATOR_PARAM(val), const wxString& name) { // for compatibility with the other ports which don't handle (yet?) // wxRA_LEFTTORIGHT and wxRA_TOPTOBOTTOM flags, we add them ourselves if // not specified if ( !(style & (wxRA_LEFTTORIGHT | wxRA_TOPTOBOTTOM)) ) { // horizontal radiobox use left to right layout if ( style & wxRA_HORIZONTAL ) { style |= wxRA_LEFTTORIGHT; } else if ( style & wxRA_VERTICAL ) { style |= wxRA_TOPTOBOTTOM; } else { wxFAIL_MSG( _T("you must specify wxRA_XXX style!") ); // use default style = wxRA_HORIZONTAL | wxRA_LEFTTORIGHT; } } if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) ) return false; #if wxUSE_VALIDATORS SetValidator(val); #endif // wxUSE_VALIDATORS Append(n, choices); // majorDim default value is 0 which means make one row/column SetMajorDim(majorDim == 0 ? n : majorDim); if ( size == wxDefaultSize ) { SetClientSize(DoGetBestClientSize()); } // Need to move the radiobox in order to move the radio buttons wxPoint actualPos = GetPosition(); wxSize actualSize = GetSize(); DoMoveWindow(actualPos.x, actualPos.y, actualSize.x, actualSize.y); // radiobox should already have selection so select at least one item SetSelection(0); return true; }