]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/gdiobj.cpp
COW cleanup patch (1583966):
[wxWidgets.git] / src / mac / classic / gdiobj.cpp
CommitLineData
2646f485 1/////////////////////////////////////////////////////////////////////////////
dd05139a 2// Name: src/mac/classic/gdiobj.cpp
2646f485
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
dd05139a 9// Licence: wxWindows licence
2646f485
SC
10/////////////////////////////////////////////////////////////////////////////
11
dd05139a
WS
12#include "wx/wxprec.h"
13
2646f485 14#include "wx/gdiobj.h"
dd05139a
WS
15
16#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18#endif
19
f516d986 20#include "wx/mac/private.h"
2646f485 21
f516d986
VZ
22class wxStockGDIMac: public wxStockGDI
23{
24public:
25 wxStockGDIMac();
26
27 virtual const wxFont* GetFont(Item item);
28
29private:
30 typedef wxStockGDI super;
31};
32
33static wxStockGDIMac gs_wxStockGDIMac_instance;
34
35wxStockGDIMac::wxStockGDIMac()
36{
37 // Override default instance
38 ms_instance = this;
39}
40
41const wxFont* wxStockGDIMac::GetFont(Item item)
42{
43 wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]);
44 if (font == NULL)
45 {
46 Str255 fontName;
47 SInt16 fontSize;
48 Style fontStyle;
49 switch (item)
50 {
51 case FONT_NORMAL:
52 GetThemeFont(kThemeSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle);
53 font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName));
54 break;
55 case FONT_SMALL:
56 GetThemeFont(kThemeSmallSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle);
57 font = new wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName));
58 break;
59 default:
60 font = wx_const_cast(wxFont*, super::GetFont(item));
61 break;
62 }
63 ms_stockObject[item] = font;
64 }
65 return font;
66}