]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/gdiobj.cpp
Merge new item attributes if any are already existing
[wxWidgets.git] / src / mac / carbon / gdiobj.cpp
index 46b1aa871fc57fd8ed02bd1ad813ad4655bfb5bd..a4bbc91059171aa1a6d1c712a63c1494c449bde1 100644 (file)
@@ -1,20 +1,75 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gdiobj.cpp
+// Name:        src/mac/carbon/gdiobj.cpp
 // Purpose:     wxGDIObject class
-// Author:      AUTHOR
+// Author:      Stefan Csomor
 // Modified by:
-// Created:     ??/??/98
+// Created:     1998-01-01
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Copyright:   (c) Stefan Csomor
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "gdiobj.h"
-#endif
+#include "wx/wxprec.h"
 
 #include "wx/gdiobj.h"
 
-IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
+#ifndef WX_PRECOMP
+    #include "wx/gdicmn.h"
+    #include "wx/module.h"
+#endif
+
+#include "wx/link.h"
+#include "wx/mac/private.h"
+
+// Linker will discard entire object file without this
+wxFORCE_LINK_THIS_MODULE(gdiobj)
+
+class wxStockGDIMac: public wxStockGDI, public wxModule
+{
+public:
+    virtual const wxFont* GetFont(Item item);
+
+    virtual bool OnInit();
+    virtual void OnExit();
+
+private:
+    typedef wxStockGDI super;
+    DECLARE_DYNAMIC_CLASS(wxStockGDIMac)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule)
+
+bool wxStockGDIMac::OnInit()
+{
+    // Override default instance
+    ms_instance = this;
+    return true;
+}
+
+void wxStockGDIMac::OnExit()
+{
+}
 
-// TODO: Nothing to do, unless you want to.
+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;
+}