]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/font.h
compilation fix for non-PCH
[wxWidgets.git] / include / wx / mac / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: font.h
3 // Purpose: wxFont class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONT_H_
13 #define _WX_FONT_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "font.h"
17 #endif
18
19 class WXDLLEXPORT wxFontRefData: public wxGDIRefData
20 {
21 friend class WXDLLEXPORT wxFont;
22 public:
23 wxFontRefData()
24 : m_fontId(0)
25 , m_pointSize(10)
26 , m_family(wxDEFAULT)
27 , m_style(wxNORMAL)
28 , m_weight(wxNORMAL)
29 , m_underlined(FALSE)
30 , m_faceName("Geneva")
31 , m_encoding(wxFONTENCODING_DEFAULT)
32 , m_macFontNum(0)
33 , m_macFontSize(0)
34 , m_macFontStyle(0)
35 , m_macATSUFontID()
36 {
37 Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
38 "Geneva", wxFONTENCODING_DEFAULT);
39 }
40
41 wxFontRefData(const wxFontRefData& data)
42 : wxGDIRefData()
43 , m_fontId(data.m_fontId)
44 , m_pointSize(data.m_pointSize)
45 , m_family(data.m_family)
46 , m_style(data.m_style)
47 , m_weight(data.m_weight)
48 , m_underlined(data.m_underlined)
49 , m_faceName(data.m_faceName)
50 , m_encoding(data.m_encoding)
51 , m_macFontNum(data.m_macFontNum)
52 , m_macFontSize(data.m_macFontSize)
53 , m_macFontStyle(data.m_macFontStyle)
54 , m_macATSUFontID(data.m_macATSUFontID)
55 {
56 Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
57 data.m_underlined, data.m_faceName, data.m_encoding);
58 }
59
60 wxFontRefData(int size,
61 int family,
62 int style,
63 int weight,
64 bool underlined,
65 const wxString& faceName,
66 wxFontEncoding encoding)
67 : m_fontId(0)
68 , m_pointSize(size)
69 , m_family(family)
70 , m_style(style)
71 , m_weight(weight)
72 , m_underlined(underlined)
73 , m_faceName(faceName)
74 , m_encoding(encoding)
75 , m_macFontNum(0)
76 , m_macFontSize(0)
77 , m_macFontStyle(0)
78 , m_macATSUFontID(0)
79 {
80 Init(size, family, style, weight, underlined, faceName, encoding);
81 }
82
83 virtual ~wxFontRefData();
84 void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; }
85 bool GetNoAntiAliasing() { return m_noAA; }
86
87 protected:
88 // common part of all ctors
89 void Init(int size,
90 int family,
91 int style,
92 int weight,
93 bool underlined,
94 const wxString& faceName,
95 wxFontEncoding encoding);
96
97 // font characterstics
98 int m_fontId;
99 int m_pointSize;
100 int m_family;
101 int m_style;
102 int m_weight;
103 bool m_underlined;
104 wxString m_faceName;
105 wxFontEncoding m_encoding;
106 bool m_noAA; // No anti-aliasing
107
108 public:
109 short m_macFontNum;
110 short m_macFontSize;
111 unsigned char m_macFontStyle;
112 wxUint32 m_macATSUFontID;
113 public:
114 void MacFindFont() ;
115 };
116 // ----------------------------------------------------------------------------
117 // wxFont
118 // ----------------------------------------------------------------------------
119
120 class WXDLLEXPORT wxFont : public wxFontBase
121 {
122 public:
123 // ctors and such
124 wxFont() { Init(); }
125 wxFont(const wxFont& font)
126 : wxFontBase()
127 {
128 Init();
129 Ref(font);
130 }
131
132 wxFont(int size,
133 int family,
134 int style,
135 int weight,
136 bool underlined = FALSE,
137 const wxString& face = wxEmptyString,
138 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
139 {
140 Init();
141
142 (void)Create(size, family, style, weight, underlined, face, encoding);
143 }
144
145 wxFont(const wxNativeFontInfo& info)
146 {
147 Init();
148
149 (void)Create(info);
150 }
151
152 wxFont(const wxString& fontDesc);
153
154 bool Create(int size,
155 int family,
156 int style,
157 int weight,
158 bool underlined = FALSE,
159 const wxString& face = wxEmptyString,
160 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
161
162 bool Create(const wxNativeFontInfo& info);
163
164 virtual ~wxFont();
165
166 // assignment
167 wxFont& operator=(const wxFont& font);
168
169 // implement base class pure virtuals
170 virtual int GetPointSize() const;
171 virtual int GetFamily() const;
172 virtual int GetStyle() const;
173 virtual int GetWeight() const;
174 virtual bool GetUnderlined() const;
175 virtual wxString GetFaceName() const;
176 virtual wxFontEncoding GetEncoding() const;
177
178 virtual void SetPointSize(int pointSize);
179 virtual void SetFamily(int family);
180 virtual void SetStyle(int style);
181 virtual void SetWeight(int weight);
182 virtual void SetFaceName(const wxString& faceName);
183 virtual void SetUnderlined(bool underlined);
184 virtual void SetEncoding(wxFontEncoding encoding);
185
186 // implementation only from now on
187 // -------------------------------
188
189 virtual bool RealizeResource();
190
191 // Unofficial API, don't use
192 virtual void SetNoAntiAliasing( bool noAA = TRUE ) ;
193 virtual bool GetNoAntiAliasing() ;
194 protected:
195 // common part of all ctors
196 void Init();
197
198 void Unshare();
199
200 private:
201 DECLARE_DYNAMIC_CLASS(wxFont)
202 };
203
204 #endif
205 // _WX_FONT_H_