]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/font.h
added wxSpinCtrl::SetSelection method
[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 protected:
85 // common part of all ctors
86 void Init(int size,
87 int family,
88 int style,
89 int weight,
90 bool underlined,
91 const wxString& faceName,
92 wxFontEncoding encoding);
93
94 // font characterstics
95 int m_fontId;
96 int m_pointSize;
97 int m_family;
98 int m_style;
99 int m_weight;
100 bool m_underlined;
101 wxString m_faceName;
102 wxFontEncoding m_encoding;
103
104 public:
105 short m_macFontNum;
106 short m_macFontSize;
107 unsigned char m_macFontStyle;
108 wxUint32 m_macATSUFontID;
109 public:
110 void MacFindFont() ;
111 };
112 // ----------------------------------------------------------------------------
113 // wxFont
114 // ----------------------------------------------------------------------------
115
116 class WXDLLEXPORT wxFont : public wxFontBase
117 {
118 public:
119 // ctors and such
120 wxFont() { Init(); }
121 wxFont(const wxFont& font)
122 : wxFontBase()
123 {
124 Init();
125 Ref(font);
126 }
127
128 wxFont(int size,
129 int family,
130 int style,
131 int weight,
132 bool underlined = FALSE,
133 const wxString& face = wxEmptyString,
134 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
135 {
136 Init();
137
138 (void)Create(size, family, style, weight, underlined, face, encoding);
139 }
140
141 wxFont(const wxNativeFontInfo& info)
142 {
143 Init();
144
145 (void)Create(info);
146 }
147
148 wxFont(const wxString& fontDesc);
149
150 bool Create(int size,
151 int family,
152 int style,
153 int weight,
154 bool underlined = FALSE,
155 const wxString& face = wxEmptyString,
156 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
157
158 bool Create(const wxNativeFontInfo& info);
159
160 virtual ~wxFont();
161
162 // assignment
163 wxFont& operator=(const wxFont& font);
164
165 // implement base class pure virtuals
166 virtual int GetPointSize() const;
167 virtual int GetFamily() const;
168 virtual int GetStyle() const;
169 virtual int GetWeight() const;
170 virtual bool GetUnderlined() const;
171 virtual wxString GetFaceName() const;
172 virtual wxFontEncoding GetEncoding() const;
173
174 virtual void SetPointSize(int pointSize);
175 virtual void SetFamily(int family);
176 virtual void SetStyle(int style);
177 virtual void SetWeight(int weight);
178 virtual void SetFaceName(const wxString& faceName);
179 virtual void SetUnderlined(bool underlined);
180 virtual void SetEncoding(wxFontEncoding encoding);
181
182 // implementation only from now on
183 // -------------------------------
184
185 virtual bool RealizeResource();
186
187 protected:
188 // common part of all ctors
189 void Init();
190
191 void Unshare();
192
193 private:
194 DECLARE_DYNAMIC_CLASS(wxFont)
195 };
196
197 #endif
198 // _WX_FONT_H_