]>
Commit | Line | Data |
---|---|---|
2646f485 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 | |
65571936 | 9 | // Licence: wxWindows licence |
2646f485 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
2646f485 | 12 | #include "wx/gdiobj.h" |
f516d986 VZ |
13 | #include "wx/gdicmn.h" |
14 | #include "wx/mac/private.h" | |
2646f485 | 15 | |
2646f485 | 16 | IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) |
2646f485 | 17 | |
f516d986 VZ |
18 | class wxStockGDIMac: public wxStockGDI |
19 | { | |
20 | public: | |
21 | wxStockGDIMac(); | |
22 | ||
23 | virtual const wxFont* GetFont(Item item); | |
24 | ||
25 | private: | |
26 | typedef wxStockGDI super; | |
27 | }; | |
28 | ||
29 | static wxStockGDIMac gs_wxStockGDIMac_instance; | |
30 | ||
31 | wxStockGDIMac::wxStockGDIMac() | |
32 | { | |
33 | // Override default instance | |
34 | ms_instance = this; | |
35 | } | |
36 | ||
37 | const wxFont* wxStockGDIMac::GetFont(Item item) | |
38 | { | |
39 | wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]); | |
40 | if (font == NULL) | |
41 | { | |
42 | Str255 fontName; | |
43 | SInt16 fontSize; | |
44 | Style fontStyle; | |
45 | switch (item) | |
46 | { | |
47 | case FONT_NORMAL: | |
48 | GetThemeFont(kThemeSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle); | |
49 | font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName)); | |
50 | break; | |
51 | case FONT_SMALL: | |
52 | GetThemeFont(kThemeSmallSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle); | |
53 | font = new wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName)); | |
54 | break; | |
55 | default: | |
56 | font = wx_const_cast(wxFont*, super::GetFont(item)); | |
57 | break; | |
58 | } | |
59 | ms_stockObject[item] = font; | |
60 | } | |
61 | return font; | |
62 | } |