]>
Commit | Line | Data |
---|---|---|
e9576ca5 | 1 | ///////////////////////////////////////////////////////////////////////////// |
dd05139a | 2 | // Name: src/mac/carbon/gdiobj.cpp |
e9576ca5 | 3 | // Purpose: wxGDIObject class |
a31a5f85 | 4 | // Author: Stefan Csomor |
e9576ca5 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
e9576ca5 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
dd05139a | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
3d1a4878 SC |
12 | #include "wx/wxprec.h" |
13 | ||
e9576ca5 | 14 | #include "wx/gdiobj.h" |
dd05139a WS |
15 | |
16 | #ifndef WX_PRECOMP | |
17 | #include "wx/gdicmn.h" | |
18 | #endif | |
19 | ||
00f79e34 | 20 | #include "wx/module.h" |
2260bc5f | 21 | #include "wx/link.h" |
f516d986 | 22 | #include "wx/mac/private.h" |
e9576ca5 | 23 | |
2260bc5f PC |
24 | // Linker will discard entire object file without this |
25 | wxFORCE_LINK_THIS_MODULE(gdiobj) | |
26 | ||
00f79e34 | 27 | class wxStockGDIMac: public wxStockGDI, public wxModule |
f516d986 VZ |
28 | { |
29 | public: | |
f516d986 VZ |
30 | virtual const wxFont* GetFont(Item item); |
31 | ||
00f79e34 PC |
32 | virtual bool OnInit(); |
33 | virtual void OnExit(); | |
34 | ||
f516d986 VZ |
35 | private: |
36 | typedef wxStockGDI super; | |
00f79e34 | 37 | DECLARE_DYNAMIC_CLASS(wxStockGDIMac) |
f516d986 VZ |
38 | }; |
39 | ||
00f79e34 | 40 | IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule) |
f516d986 | 41 | |
00f79e34 | 42 | bool wxStockGDIMac::OnInit() |
f516d986 VZ |
43 | { |
44 | // Override default instance | |
45 | ms_instance = this; | |
00f79e34 PC |
46 | return true; |
47 | } | |
48 | ||
49 | void wxStockGDIMac::OnExit() | |
50 | { | |
f516d986 VZ |
51 | } |
52 | ||
53 | const wxFont* wxStockGDIMac::GetFont(Item item) | |
54 | { | |
55 | wxFont* font = static_cast<wxFont*>(ms_stockObject[item]); | |
56 | if (font == NULL) | |
57 | { | |
58 | switch (item) | |
59 | { | |
60 | case FONT_NORMAL: | |
61 | font = new wxFont; | |
62 | font->MacCreateThemeFont(kThemeSystemFont); | |
63 | break; | |
64 | case FONT_SMALL: | |
65 | font = new wxFont; | |
66 | font->MacCreateThemeFont(kThemeSmallSystemFont); | |
67 | break; | |
68 | default: | |
69 | font = const_cast<wxFont*>(super::GetFont(item)); | |
70 | break; | |
71 | } | |
72 | ms_stockObject[item] = font; | |
73 | } | |
74 | return font; | |
75 | } |