X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3d1a4878f36ba4b5f66c2ccfd2cb27a9dc528b6f..3e1924dd5f5744c3e2a8973de9b3e4f372b7fd85:/src/mac/carbon/gdiobj.cpp?ds=inline diff --git a/src/mac/carbon/gdiobj.cpp b/src/mac/carbon/gdiobj.cpp index f0c7133298..76156134e0 100644 --- a/src/mac/carbon/gdiobj.cpp +++ b/src/mac/carbon/gdiobj.cpp @@ -1,24 +1,75 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" + #include "wx/module.h" #endif -// TODO: Nothing to do, unless you want to. +#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() +{ +} + +const wxFont* wxStockGDIMac::GetFont(Item item) +{ + wxFont* font = static_cast(ms_stockObject[item]); + if (font == NULL) + { + switch (item) + { + case FONT_NORMAL: + font = new wxFont; + font->MacCreateFromThemeFont(kThemeSystemFont); + break; + case FONT_SMALL: + font = new wxFont; + font->MacCreateFromThemeFont(kThemeSmallSystemFont); + break; + default: + font = const_cast(super::GetFont(item)); + break; + } + ms_stockObject[item] = font; + } + return font; +}