]>
Commit | Line | Data |
---|---|---|
489468fe | 1 | ///////////////////////////////////////////////////////////////////////////// |
524c47aa | 2 | // Name: src/osx/carbon/gdiobj.cpp |
489468fe SC |
3 | // Purpose: wxGDIObject class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
489468fe SC |
7 | // Copyright: (c) Stefan Csomor |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #include "wx/wxprec.h" | |
12 | ||
13 | #include "wx/gdiobj.h" | |
14 | ||
15 | #ifndef WX_PRECOMP | |
16 | #include "wx/gdicmn.h" | |
17 | #include "wx/module.h" | |
18 | #endif | |
19 | ||
20 | #include "wx/link.h" | |
1f0c8f31 | 21 | #include "wx/osx/private.h" |
b2680ced | 22 | #include "wx/font.h" |
489468fe SC |
23 | |
24 | // Linker will discard entire object file without this | |
25 | wxFORCE_LINK_THIS_MODULE(gdiobj) | |
26 | ||
27 | class wxStockGDIMac: public wxStockGDI, public wxModule | |
28 | { | |
29 | public: | |
30 | virtual const wxFont* GetFont(Item item); | |
31 | ||
32 | virtual bool OnInit(); | |
33 | virtual void OnExit(); | |
34 | ||
35 | private: | |
36 | typedef wxStockGDI super; | |
37 | DECLARE_DYNAMIC_CLASS(wxStockGDIMac) | |
38 | }; | |
39 | ||
40 | IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule) | |
41 | ||
42 | bool wxStockGDIMac::OnInit() | |
43 | { | |
44 | // Override default instance | |
45 | ms_instance = this; | |
46 | return true; | |
47 | } | |
48 | ||
49 | void wxStockGDIMac::OnExit() | |
50 | { | |
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: | |
7eb8aeb8 | 61 | font = new wxFont(wxOSX_SYSTEM_FONT_NORMAL); |
489468fe SC |
62 | break; |
63 | case FONT_SMALL: | |
7eb8aeb8 | 64 | font = new wxFont(wxOSX_SYSTEM_FONT_SMALL); |
b2680ced | 65 | break; |
489468fe SC |
66 | default: |
67 | font = const_cast<wxFont*>(super::GetFont(item)); | |
68 | break; | |
69 | } | |
70 | ms_stockObject[item] = font; | |
71 | } | |
72 | return font; | |
73 | } |