]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/font.h
export wxRichTextObjectPtrArrayArray since it is used in the public API.
[wxWidgets.git] / include / wx / osx / font.h
CommitLineData
6762286d 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/osx/font.h
6762286d
SC
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// ----------------------------------------------------------------------------
16// wxFont
17// ----------------------------------------------------------------------------
18
f1c40652
SC
19// font styles
20enum wxOSXSystemFont
21{
22 wxOSX_SYSTEM_FONT_NONE = 0,
23 wxOSX_SYSTEM_FONT_NORMAL,
24 wxOSX_SYSTEM_FONT_BOLD,
25 wxOSX_SYSTEM_FONT_SMALL,
26 wxOSX_SYSTEM_FONT_SMALL_BOLD,
27 wxOSX_SYSTEM_FONT_MINI,
28 wxOSX_SYSTEM_FONT_MINI_BOLD,
29 wxOSX_SYSTEM_FONT_LABELS,
0b79709d 30 wxOSX_SYSTEM_FONT_VIEWS
f1c40652
SC
31};
32
33
6762286d
SC
34class WXDLLIMPEXP_CORE wxFont : public wxFontBase
35{
36public:
37 // ctors and such
38 wxFont() { }
ce00f59b 39
b960795e
VZ
40 wxFont(const wxFontInfo& info)
41 {
42 Create(info.GetPointSize(),
43 info.GetFamily(),
44 info.GetStyle(),
45 info.GetWeight(),
46 info.IsUnderlined(),
47 info.GetFaceName(),
48 info.GetEncoding());
49
50 if ( info.IsUsingSizeInPixels() )
51 SetPixelSize(info.GetPixelSize());
52 }
53
7eb8aeb8 54 wxFont( wxOSXSystemFont systemFont );
6762286d 55
f7946add
KO
56#if wxOSX_USE_COCOA
57 wxFont(WX_NSFont nsfont);
58#endif
59
6762286d
SC
60#if FUTURE_WXWIN_COMPATIBILITY_3_0
61 wxFont(int size,
62 int family,
63 int style,
64 int weight,
65 bool underlined = false,
66 const wxString& face = wxEmptyString,
67 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
68 {
69 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
70 }
5c6eb3a8 71#endif
6762286d
SC
72
73 wxFont(int size,
74 wxFontFamily family,
75 wxFontStyle style,
76 wxFontWeight weight,
77 bool underlined = false,
78 const wxString& face = wxEmptyString,
79 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
80 {
81 Create(size, family, style, weight, underlined, face, encoding);
82 }
03647350 83
b5791cc7
FM
84 wxFont(const wxSize& pixelSize,
85 wxFontFamily family,
86 wxFontStyle style,
87 wxFontWeight weight,
88 bool underlined = false,
89 const wxString& face = wxEmptyString,
90 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
91 {
92 Create(10, family, style, weight, underlined, face, encoding);
93 SetPixelSize(pixelSize);
94 }
03647350 95
6762286d
SC
96 bool Create(int size,
97 wxFontFamily family,
98 wxFontStyle style,
99 wxFontWeight weight,
100 bool underlined = false,
101 const wxString& face = wxEmptyString,
102 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
103
104 wxFont(const wxNativeFontInfo& info)
105 {
106 (void)Create(info);
107 }
108
109 wxFont(const wxString& fontDesc);
110
111 bool Create(const wxNativeFontInfo& info);
112
6762286d
SC
113 virtual ~wxFont();
114
115 // implement base class pure virtuals
116 virtual int GetPointSize() const;
117 virtual wxSize GetPixelSize() const;
6762286d
SC
118 virtual wxFontStyle GetStyle() const;
119 virtual wxFontWeight GetWeight() const;
120 virtual bool GetUnderlined() const;
121 virtual wxString GetFaceName() const;
122 virtual wxFontEncoding GetEncoding() const;
123 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
124
a2c3d6b8
SC
125 virtual bool IsFixedWidth() const;
126
6762286d
SC
127 virtual void SetPointSize(int pointSize);
128 virtual void SetFamily(wxFontFamily family);
129 virtual void SetStyle(wxFontStyle style);
130 virtual void SetWeight(wxFontWeight weight);
131 virtual bool SetFaceName(const wxString& faceName);
132 virtual void SetUnderlined(bool underlined);
133 virtual void SetEncoding(wxFontEncoding encoding);
134
f76c0758 135 wxDECLARE_COMMON_FONT_METHODS();
6762286d
SC
136
137 // implementation only from now on
138 // -------------------------------
139
140 virtual bool RealizeResource();
141
6762286d
SC
142 // Mac-specific, risks to change, don't use in portable code
143
f1c40652
SC
144#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
145 wxUint16 MacGetThemeFontID() const ;
aa6208d9 146
6762286d
SC
147 // 'old' Quickdraw accessors
148 short MacGetFontNum() const;
6762286d 149 wxByte MacGetFontStyle() const;
f1c40652 150#endif
6762286d 151
f1c40652 152#if wxOSX_USE_COCOA_OR_CARBON
aa6208d9 153 CGFontRef OSXGetCGFont() const;
6762286d 154#endif
f1c40652 155
6762286d 156#if wxOSX_USE_CORE_TEXT
aa6208d9 157 CTFontRef OSXGetCTFont() const;
6762286d 158#endif
f1c40652 159
beb2638a 160#if wxOSX_USE_ATSU_TEXT
f1c40652 161 // Returns an ATSUStyle not ATSUStyle*
6762286d 162 void* MacGetATSUStyle() const ;
aa6208d9
SC
163 void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; }
164
6f283573
SC
165 wxDEPRECATED( wxUint32 MacGetATSUFontID() const );
166 wxDEPRECATED( wxUint32 MacGetATSUAdditionalQDStyles() const );
167#endif
6762286d 168
f1c40652 169#if wxOSX_USE_COCOA
aa6208d9
SC
170 WX_NSFont OSXGetNSFont() const;
171 static WX_NSFont OSXCreateNSFont(wxOSXSystemFont font, wxNativeFontInfo* info);
172 static WX_NSFont OSXCreateNSFont(const wxNativeFontInfo* info);
f7946add 173 static void SetNativeInfoFromNSFont(WX_NSFont nsfont, wxNativeFontInfo* info);
f1c40652
SC
174#endif
175
176#if wxOSX_USE_IPHONE
aa6208d9 177 WX_UIFont OSXGetUIFont() const;
b4ff8b3e
SC
178 static WX_UIFont OSXCreateUIFont(wxOSXSystemFont font, wxNativeFontInfo* info);
179 static WX_UIFont OSXCreateUIFont(const wxNativeFontInfo* info);
f1c40652
SC
180#endif
181
6762286d 182protected:
c443ff6f 183 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
59b7da02 184 virtual wxFontFamily DoGetFamily() const;
c443ff6f 185
6762286d
SC
186 virtual wxGDIRefData *CreateGDIRefData() const;
187 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
188
189private:
6762286d
SC
190
191 DECLARE_DYNAMIC_CLASS(wxFont)
192};
193
194#endif // _WX_FONT_H_