]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/gdiobj.cpp
new file added
[wxWidgets.git] / src / osx / carbon / gdiobj.cpp
CommitLineData
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
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"
1f0c8f31 22#include "wx/osx/private.h"
b2680ced 23#include "wx/font.h"
489468fe
SC
24
25// Linker will discard entire object file without this
26wxFORCE_LINK_THIS_MODULE(gdiobj)
27
28class wxStockGDIMac: public wxStockGDI, public wxModule
29{
30public:
31 virtual const wxFont* GetFont(Item item);
32
33 virtual bool OnInit();
34 virtual void OnExit();
35
36private:
37 typedef wxStockGDI super;
38 DECLARE_DYNAMIC_CLASS(wxStockGDIMac)
39};
40
41IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule)
42
43bool wxStockGDIMac::OnInit()
44{
45 // Override default instance
46 ms_instance = this;
47 return true;
48}
49
50void wxStockGDIMac::OnExit()
51{
52}
53
54const 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:
7eb8aeb8 62 font = new wxFont(wxOSX_SYSTEM_FONT_NORMAL);
489468fe
SC
63 break;
64 case FONT_SMALL:
7eb8aeb8 65 font = new wxFont(wxOSX_SYSTEM_FONT_SMALL);
b2680ced 66 break;
489468fe
SC
67 default:
68 font = const_cast<wxFont*>(super::GetFont(item));
69 break;
70 }
71 ms_stockObject[item] = font;
72 }
73 return font;
74}