X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4455332266b332ca005c3430234f9a2b372b5764..cd318cd31b8fd9876af7ba5f4878b90f446bd0f5:/src/mac/listbox.cpp diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index 87757f78e2..fe39a0a19f 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -105,13 +105,12 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect ClipRect( drawRect ); EraseRect( drawRect ); - wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ; - - if ( font ) + const wxFont& font = list->GetFont(); + if ( font.Ok() ) { - ::TextFont( font->m_macFontNum ) ; - ::TextSize( short(font->m_macFontSize) ) ; - ::TextFace( font->m_macFontStyle ) ; + ::TextFont( font.GetMacFontNum() ) ; + ::TextSize( font.GetMacFontSize() ) ; + ::TextFace( font.GetMacFontStyle() ) ; } else { @@ -137,7 +136,7 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect } #else { - wxCharBuffer text = wxMacStringToCString( linetext ) ; + wxCharBuffer text = linetext.mb_str( wxConvLocal) ; MoveTo(drawRect->left + 4 , drawRect->top + 10 ); DrawText(text, 0 , strlen(text) ); } @@ -202,6 +201,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) ) + return false; + m_noItems = 0 ; // this will be increased by our append command m_selected = 0; @@ -221,7 +223,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, Str255 fontName ; SInt16 fontSize ; Style fontStyle ; - SInt16 fontNum ; #if TARGET_CARBON GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; #else @@ -602,13 +603,11 @@ wxSize wxListBox::DoGetBestSize() const { 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 { @@ -631,8 +630,7 @@ wxSize wxListBox::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); } @@ -824,7 +822,7 @@ void wxListBox::OnSize( const wxSizeEvent &event) LCellSize( pt , (ListHandle)m_macList ) ; } -void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) +void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown)) { Boolean wasDoubleClick = false ; long result ;