]> git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/gdiobj.cpp
Rich text lib separation.
[wxWidgets.git] / src / mac / classic / gdiobj.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/classic/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 #endif
19
20 #include "wx/mac/private.h"
21
22 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
23
24 class wxStockGDIMac: public wxStockGDI
25 {
26 public:
27 wxStockGDIMac();
28
29 virtual const wxFont* GetFont(Item item);
30
31 private:
32 typedef wxStockGDI super;
33 };
34
35 static wxStockGDIMac gs_wxStockGDIMac_instance;
36
37 wxStockGDIMac::wxStockGDIMac()
38 {
39 // Override default instance
40 ms_instance = this;
41 }
42
43 const wxFont* wxStockGDIMac::GetFont(Item item)
44 {
45 wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]);
46 if (font == NULL)
47 {
48 Str255 fontName;
49 SInt16 fontSize;
50 Style fontStyle;
51 switch (item)
52 {
53 case FONT_NORMAL:
54 GetThemeFont(kThemeSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle);
55 font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName));
56 break;
57 case FONT_SMALL:
58 GetThemeFont(kThemeSmallSystemFont, GetApplicationScript(), fontName, &fontSize, &fontStyle);
59 font = new wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL, false, wxMacMakeStringFromPascal(fontName));
60 break;
61 default:
62 font = wx_const_cast(wxFont*, super::GetFont(item));
63 break;
64 }
65 ms_stockObject[item] = font;
66 }
67 return font;
68 }