X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e40298d54ecd5b109222a7c60aa2ef084a304d69..e71800ba3a40711f6c6c2461ed10cd6f2502c1d1:/src/mac/carbon/checklst.cpp?ds=sidebyside diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index c50773b137..cb7c4a818f 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -22,6 +22,7 @@ #if wxUSE_CHECKLISTBOX #include "wx/checklst.h" +#include "wx/arrstr.h" #include "wx/mac/uma.h" #include "Appearance.h" @@ -102,13 +103,12 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected, 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( font->m_macFontSize) ; - ::TextFace( font->m_macFontStyle ) ; + ::TextFont( font.GetMacFontNum() ) ; + ::TextSize( font.GetMacFontSize()) ; + ::TextFace( font.GetMacFontStyle() ) ; } ThemeButtonDrawInfo info ; @@ -173,6 +173,21 @@ void wxCheckListBox::Init() { } +bool wxCheckListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, @@ -183,6 +198,10 @@ bool wxCheckListBox::Create(wxWindow *parent, const wxValidator& validator, const wxString &name) { + if ( !wxCheckListBoxBase::Create(parent, id, pos, size, + n, choices, style, validator, name) ) + return false; + m_noItems = 0 ; // this will be increased by our append command m_selected = 0; @@ -194,10 +213,11 @@ bool wxCheckListBox::Create(wxWindow *parent, GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth); GetThemeMetric(kThemeMetricCheckBoxHeight,&h); #endif - wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ; + + const wxFont& font = GetFont(); FontInfo finfo; - FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo); + FetchFontInfo(font.GetMacFontNum(),font.GetMacFontSize(),font.GetMacFontStyle(),&finfo); m_TextBaseLineOffset= finfo.leading+finfo.ascent; m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent; @@ -211,7 +231,7 @@ bool wxCheckListBox::Create(wxWindow *parent, Rect bounds ; Str255 title ; - MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; + MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ; ListDefSpec listDef; listDef.defType = kListDefUserProcType;