]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/gdiobj.cpp
guarding open combo box against AppDefined NSEvents issued by wxEventLoop::WakeUp...
[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 // 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 #include "wx/module.h"
19 #endif
20
21 #include "wx/link.h"
22 #include "wx/osx/private.h"
23 #include "wx/font.h"
24
25 // Linker will discard entire object file without this
26 wxFORCE_LINK_THIS_MODULE(gdiobj)
27
28 class wxStockGDIMac: public wxStockGDI, public wxModule
29 {
30 public:
31 virtual const wxFont* GetFont(Item item);
32
33 virtual bool OnInit();
34 virtual void OnExit();
35
36 private:
37 typedef wxStockGDI super;
38 DECLARE_DYNAMIC_CLASS(wxStockGDIMac)
39 };
40
41 IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule)
42
43 bool wxStockGDIMac::OnInit()
44 {
45 // Override default instance
46 ms_instance = this;
47 return true;
48 }
49
50 void wxStockGDIMac::OnExit()
51 {
52 }
53
54 const wxFont* wxStockGDIMac::GetFont(Item item)
55 {
56 wxFont* font = static_cast<wxFont*>(ms_stockObject[item]);
57 if (font == NULL)
58 {
59 switch (item)
60 {
61 case FONT_NORMAL:
62 font = new wxFont(wxOSX_SYSTEM_FONT_NORMAL);
63 break;
64 case FONT_SMALL:
65 font = new wxFont(wxOSX_SYSTEM_FONT_SMALL);
66 break;
67 default:
68 font = const_cast<wxFont*>(super::GetFont(item));
69 break;
70 }
71 ms_stockObject[item] = font;
72 }
73 return font;
74 }