]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/checklst.cpp
made wxFFile a bit more safe: don't crash when Tell() and Length() are called on...
[wxWidgets.git] / src / mac / checklst.cpp
index ee04357b8ff4d84b422cec76dd06e492cce412db..cb7c4a818f7e007c3cff9aa62d3262f43755f188 100644 (file)
@@ -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,
@@ -198,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;