X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..2cf3a6d7bef6f20bea35062dd3d4dbf0aec9efb5:/src/mac/classic/gdiobj.cpp?ds=sidebyside diff --git a/src/mac/classic/gdiobj.cpp b/src/mac/classic/gdiobj.cpp index 5a1fff8a02..5ba78d3934 100644 --- a/src/mac/classic/gdiobj.cpp +++ b/src/mac/classic/gdiobj.cpp @@ -1,22 +1,68 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gdiobj.cpp +// Name: src/mac/classic/gdiobj.cpp // Purpose: wxGDIObject class // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#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 = wx_static_cast(wxFont*, ms_stockObject[item]); + if (font == NULL) + { + Str255 fontName; + SInt16 fontSize; + Style fontStyle; + switch (item) + { + case FONT_NORMAL: + GetThemeFont(kThemeSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle); + font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName)); + break; + case FONT_SMALL: + GetThemeFont(kThemeSmallSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle); + font = new wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName)); + break; + default: + font = wx_const_cast(wxFont*, super::GetFont(item)); + break; + } + ms_stockObject[item] = font; + } + return font; +}