X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/17a6a662f7d7932983fc29892854fad56a82057b..b77b87881bae2e6306366d79e7fe160334b3d4a2:/src/mac/carbon/choice.cpp?ds=sidebyside diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index c187d9ecc7..55a9268e10 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -46,6 +46,9 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxChoiceBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + Rect bounds ; Str255 title ; @@ -60,6 +63,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, if ( n > 0 ) SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ; MacPostControlCreate() ; + // TODO wxCB_SORT for ( int i = 0; i < n; i++ ) { Append(choices[i]); @@ -241,12 +245,11 @@ wxSize wxChoice::DoGetBestSize() const #endif { wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; - wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; - if ( font ) + if ( m_font.Ok() ) { - ::TextFont( font->m_macFontNum ) ; - ::TextSize( short(font->m_macFontSize) ) ; - ::TextFace( font->m_macFontStyle ) ; + ::TextFont( m_font.GetMacFontNum() ) ; + ::TextSize( m_font.GetMacFontSize() ) ; + ::TextFace( m_font.GetMacFontStyle() ) ; } else { @@ -268,8 +271,7 @@ wxSize wxChoice::DoGetBestSize() const &baseline ); wLine = bounds.h ; #else - wxCharBuffer text = wxMacStringToCString( str ) ; - wLine = ::TextWidth( text , 0 , strlen(text) ) ; + wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ; #endif lbWidth = wxMax(lbWidth, wLine); }