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