| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/mac/classic/gdiobj.cpp |
| 3 | // Purpose: wxGDIObject class |
| 4 | // Author: Stefan Csomor |
| 5 | // Modified by: |
| 6 | // Created: 1998-01-01 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Stefan Csomor |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #include "wx/wxprec.h" |
| 13 | |
| 14 | #include "wx/gdiobj.h" |
| 15 | |
| 16 | #ifndef WX_PRECOMP |
| 17 | #include "wx/gdicmn.h" |
| 18 | #endif |
| 19 | |
| 20 | #include "wx/mac/private.h" |
| 21 | |
| 22 | class wxStockGDIMac: public wxStockGDI |
| 23 | { |
| 24 | public: |
| 25 | wxStockGDIMac(); |
| 26 | |
| 27 | virtual const wxFont* GetFont(Item item); |
| 28 | |
| 29 | private: |
| 30 | typedef wxStockGDI super; |
| 31 | }; |
| 32 | |
| 33 | static wxStockGDIMac gs_wxStockGDIMac_instance; |
| 34 | |
| 35 | wxStockGDIMac::wxStockGDIMac() |
| 36 | { |
| 37 | // Override default instance |
| 38 | ms_instance = this; |
| 39 | } |
| 40 | |
| 41 | const wxFont* wxStockGDIMac::GetFont(Item item) |
| 42 | { |
| 43 | wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]); |
| 44 | if (font == NULL) |
| 45 | { |
| 46 | Str255 fontName; |
| 47 | SInt16 fontSize; |
| 48 | Style fontStyle; |
| 49 | switch (item) |
| 50 | { |
| 51 | case FONT_NORMAL: |
| 52 | GetThemeFont(kThemeSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle); |
| 53 | font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName)); |
| 54 | break; |
| 55 | case FONT_SMALL: |
| 56 | GetThemeFont(kThemeSmallSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle); |
| 57 | font = new wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName)); |
| 58 | break; |
| 59 | default: |
| 60 | font = wx_const_cast(wxFont*, super::GetFont(item)); |
| 61 | break; |
| 62 | } |
| 63 | ms_stockObject[item] = font; |
| 64 | } |
| 65 | return font; |
| 66 | } |