]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/gdiobj.cpp
changing guard to support popupwindows as well
[wxWidgets.git] / src / mac / carbon / gdiobj.cpp
CommitLineData
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"
02761f6c 18 #include "wx/module.h"
dd05139a
WS
19#endif
20
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
25wxFORCE_LINK_THIS_MODULE(gdiobj)
26
00f79e34 27class wxStockGDIMac: public wxStockGDI, public wxModule
f516d986
VZ
28{
29public:
f516d986
VZ
30 virtual const wxFont* GetFont(Item item);
31
00f79e34
PC
32 virtual bool OnInit();
33 virtual void OnExit();
34
f516d986
VZ
35private:
36 typedef wxStockGDI super;
00f79e34 37 DECLARE_DYNAMIC_CLASS(wxStockGDIMac)
f516d986
VZ
38};
39
00f79e34 40IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule)
f516d986 41
00f79e34 42bool wxStockGDIMac::OnInit()
f516d986
VZ
43{
44 // Override default instance
45 ms_instance = this;
00f79e34
PC
46 return true;
47}
48
49void wxStockGDIMac::OnExit()
50{
f516d986
VZ
51}
52
53const 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;
8b534a7b 62 font->MacCreateFromThemeFont(kThemeSystemFont);
f516d986
VZ
63 break;
64 case FONT_SMALL:
65 font = new wxFont;
8b534a7b 66 font->MacCreateFromThemeFont(kThemeSmallSystemFont);
f516d986
VZ
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}