]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/gdiobj.cpp
don't create non-existing groups in HasEntry()
[wxWidgets.git] / src / mac / carbon / gdiobj.cpp
index f0c713329895bbac370e3352c136467a694d3084..163429e27f3c46dc433ab1a843a9d3a678dd2446 100644 (file)
@@ -1,24 +1,65 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gdiobj.cpp
+// Name:        src/mac/carbon/gdiobj.cpp
 // Purpose:     wxGDIObject class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "gdiobj.h"
-#endif
-
 #include "wx/wxprec.h"
 
 #include "wx/gdiobj.h"
 
-#if !USE_SHARED_LIBRARIES
-IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
+#ifndef WX_PRECOMP
+    #include "wx/gdicmn.h"
 #endif
 
-// TODO: Nothing to do, unless you want to.
+#include "wx/mac/private.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
+
+class wxStockGDIMac: public wxStockGDI
+{
+public:
+    wxStockGDIMac();
+
+    virtual const wxFont* GetFont(Item item);
+
+private:
+    typedef wxStockGDI super;
+};
+
+static wxStockGDIMac gs_wxStockGDIMac_instance;
+
+wxStockGDIMac::wxStockGDIMac()
+{
+    // Override default instance
+    ms_instance = this;
+}
+
+const wxFont* wxStockGDIMac::GetFont(Item item)
+{
+    wxFont* font = static_cast<wxFont*>(ms_stockObject[item]);
+    if (font == NULL)
+    {
+        switch (item)
+        {
+        case FONT_NORMAL:
+            font = new wxFont;
+            font->MacCreateThemeFont(kThemeSystemFont);
+            break;
+        case FONT_SMALL:
+            font = new wxFont;
+            font->MacCreateThemeFont(kThemeSmallSystemFont);
+            break;
+        default:
+            font = const_cast<wxFont*>(super::GetFont(item));
+            break;
+        }
+        ms_stockObject[item] = font;
+    }
+    return font;
+}