]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/gdiobj.cpp
Set missing Language: headers in PO files.
[wxWidgets.git] / src / osx / carbon / gdiobj.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/gdiobj.cpp
3 // Purpose: wxGDIObject class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
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"
21 #include "wx/osx/private.h"
22 #include "wx/font.h"
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:
61 font = new wxFont(wxOSX_SYSTEM_FONT_NORMAL);
62 break;
63 case FONT_SMALL:
64 font = new wxFont(wxOSX_SYSTEM_FONT_SMALL);
65 break;
66 default:
67 font = const_cast<wxFont*>(super::GetFont(item));
68 break;
69 }
70 ms_stockObject[item] = font;
71 }
72 return font;
73 }