]>
Commit | Line | Data |
---|---|---|
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 |
20 | enum 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 |
34 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
35 | { | |
36 | public: | |
37 | // ctors and such | |
38 | wxFont() { } | |
ce00f59b | 39 | |
7eb8aeb8 | 40 | wxFont( wxOSXSystemFont systemFont ); |
6762286d | 41 | |
f7946add KO |
42 | #if wxOSX_USE_COCOA |
43 | wxFont(WX_NSFont nsfont); | |
44 | #endif | |
45 | ||
6762286d SC |
46 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
47 | wxFont(int size, | |
48 | int family, | |
49 | int style, | |
50 | int weight, | |
51 | bool underlined = false, | |
52 | const wxString& face = wxEmptyString, | |
53 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
54 | { | |
55 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); | |
56 | } | |
5c6eb3a8 | 57 | #endif |
6762286d SC |
58 | |
59 | wxFont(int size, | |
60 | wxFontFamily family, | |
61 | wxFontStyle style, | |
62 | wxFontWeight weight, | |
63 | bool underlined = false, | |
64 | const wxString& face = wxEmptyString, | |
65 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
66 | { | |
67 | Create(size, family, style, weight, underlined, face, encoding); | |
68 | } | |
03647350 | 69 | |
b5791cc7 FM |
70 | wxFont(const wxSize& pixelSize, |
71 | wxFontFamily family, | |
72 | wxFontStyle style, | |
73 | wxFontWeight weight, | |
74 | bool underlined = false, | |
75 | const wxString& face = wxEmptyString, | |
76 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
77 | { | |
78 | Create(10, family, style, weight, underlined, face, encoding); | |
79 | SetPixelSize(pixelSize); | |
80 | } | |
03647350 | 81 | |
6762286d SC |
82 | bool Create(int size, |
83 | wxFontFamily family, | |
84 | wxFontStyle style, | |
85 | wxFontWeight weight, | |
86 | bool underlined = false, | |
87 | const wxString& face = wxEmptyString, | |
88 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
89 | ||
90 | wxFont(const wxNativeFontInfo& info) | |
91 | { | |
92 | (void)Create(info); | |
93 | } | |
94 | ||
95 | wxFont(const wxString& fontDesc); | |
96 | ||
97 | bool Create(const wxNativeFontInfo& info); | |
98 | ||
6762286d SC |
99 | virtual ~wxFont(); |
100 | ||
101 | // implement base class pure virtuals | |
102 | virtual int GetPointSize() const; | |
103 | virtual wxSize GetPixelSize() const; | |
6762286d SC |
104 | virtual wxFontStyle GetStyle() const; |
105 | virtual wxFontWeight GetWeight() const; | |
106 | virtual bool GetUnderlined() const; | |
107 | virtual wxString GetFaceName() const; | |
108 | virtual wxFontEncoding GetEncoding() const; | |
109 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
110 | ||
111 | virtual void SetPointSize(int pointSize); | |
112 | virtual void SetFamily(wxFontFamily family); | |
113 | virtual void SetStyle(wxFontStyle style); | |
114 | virtual void SetWeight(wxFontWeight weight); | |
115 | virtual bool SetFaceName(const wxString& faceName); | |
116 | virtual void SetUnderlined(bool underlined); | |
117 | virtual void SetEncoding(wxFontEncoding encoding); | |
118 | ||
f76c0758 | 119 | wxDECLARE_COMMON_FONT_METHODS(); |
6762286d SC |
120 | |
121 | // implementation only from now on | |
122 | // ------------------------------- | |
123 | ||
124 | virtual bool RealizeResource(); | |
125 | ||
6762286d SC |
126 | // Mac-specific, risks to change, don't use in portable code |
127 | ||
f1c40652 SC |
128 | #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT |
129 | wxUint16 MacGetThemeFontID() const ; | |
aa6208d9 | 130 | |
6762286d SC |
131 | // 'old' Quickdraw accessors |
132 | short MacGetFontNum() const; | |
6762286d | 133 | wxByte MacGetFontStyle() const; |
f1c40652 | 134 | #endif |
6762286d | 135 | |
f1c40652 | 136 | #if wxOSX_USE_COCOA_OR_CARBON |
aa6208d9 | 137 | CGFontRef OSXGetCGFont() const; |
6762286d | 138 | #endif |
f1c40652 | 139 | |
6762286d | 140 | #if wxOSX_USE_CORE_TEXT |
aa6208d9 | 141 | CTFontRef OSXGetCTFont() const; |
6762286d | 142 | #endif |
f1c40652 | 143 | |
beb2638a | 144 | #if wxOSX_USE_ATSU_TEXT |
f1c40652 | 145 | // Returns an ATSUStyle not ATSUStyle* |
6762286d | 146 | void* MacGetATSUStyle() const ; |
aa6208d9 SC |
147 | void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; } |
148 | ||
6f283573 SC |
149 | wxDEPRECATED( wxUint32 MacGetATSUFontID() const ); |
150 | wxDEPRECATED( wxUint32 MacGetATSUAdditionalQDStyles() const ); | |
151 | #endif | |
6762286d | 152 | |
f1c40652 | 153 | #if wxOSX_USE_COCOA |
aa6208d9 SC |
154 | WX_NSFont OSXGetNSFont() const; |
155 | static WX_NSFont OSXCreateNSFont(wxOSXSystemFont font, wxNativeFontInfo* info); | |
156 | static WX_NSFont OSXCreateNSFont(const wxNativeFontInfo* info); | |
f7946add | 157 | static void SetNativeInfoFromNSFont(WX_NSFont nsfont, wxNativeFontInfo* info); |
f1c40652 SC |
158 | #endif |
159 | ||
160 | #if wxOSX_USE_IPHONE | |
aa6208d9 | 161 | WX_UIFont OSXGetUIFont() const; |
b4ff8b3e SC |
162 | static WX_UIFont OSXCreateUIFont(wxOSXSystemFont font, wxNativeFontInfo* info); |
163 | static WX_UIFont OSXCreateUIFont(const wxNativeFontInfo* info); | |
f1c40652 SC |
164 | #endif |
165 | ||
6762286d | 166 | protected: |
c443ff6f | 167 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); |
59b7da02 | 168 | virtual wxFontFamily DoGetFamily() const; |
c443ff6f | 169 | |
6762286d SC |
170 | virtual wxGDIRefData *CreateGDIRefData() const; |
171 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
172 | ||
173 | private: | |
6762286d SC |
174 | |
175 | DECLARE_DYNAMIC_CLASS(wxFont) | |
176 | }; | |
177 | ||
178 | #endif // _WX_FONT_H_ |