]>
Commit | Line | Data |
---|---|---|
5c6eb3a8 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 | ||
19 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
20 | { | |
21 | public: | |
22 | // ctors and such | |
23 | wxFont() { } | |
24 | ||
0c14b6c3 | 25 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
5c6eb3a8 SC |
26 | wxFont(int size, |
27 | int family, | |
28 | int style, | |
29 | int weight, | |
0c14b6c3 | 30 | bool underlined = false, |
5c6eb3a8 SC |
31 | const wxString& face = wxEmptyString, |
32 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
33 | { | |
0c14b6c3 | 34 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
5c6eb3a8 | 35 | } |
0c14b6c3 | 36 | #endif |
5c6eb3a8 | 37 | |
0c14b6c3 FM |
38 | wxFont(int size, |
39 | wxFontFamily family, | |
40 | wxFontStyle style, | |
41 | wxFontWeight weight, | |
42 | bool underlined = false, | |
43 | const wxString& face = wxEmptyString, | |
44 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
5c6eb3a8 | 45 | { |
0c14b6c3 | 46 | Create(size, family, style, weight, underlined, face, encoding); |
5c6eb3a8 SC |
47 | } |
48 | ||
5c6eb3a8 | 49 | bool Create(int size, |
0c14b6c3 FM |
50 | wxFontFamily family, |
51 | wxFontStyle style, | |
52 | wxFontWeight weight, | |
53 | bool underlined = false, | |
5c6eb3a8 SC |
54 | const wxString& face = wxEmptyString, |
55 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
56 | ||
0c14b6c3 FM |
57 | wxFont(const wxNativeFontInfo& info) |
58 | { | |
59 | (void)Create(info); | |
60 | } | |
61 | ||
62 | wxFont(const wxString& fontDesc); | |
63 | ||
5c6eb3a8 SC |
64 | bool Create(const wxNativeFontInfo& info); |
65 | ||
524c47aa | 66 | #if wxOSX_USE_CARBON |
5c6eb3a8 | 67 | bool MacCreateFromThemeFont( wxUint16 themeFontID ) ; |
524c47aa | 68 | #endif |
b46f221f | 69 | #if wxOSX_USE_CORE_TEXT |
5c6eb3a8 SC |
70 | bool MacCreateFromUIFont( wxUint32 coreTextFontType ); |
71 | bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 ); | |
72 | bool MacCreateFromCTFont( const void * ctFont ); | |
73 | #endif | |
74 | ||
75 | virtual ~wxFont(); | |
76 | ||
77 | // implement base class pure virtuals | |
78 | virtual int GetPointSize() const; | |
79 | virtual wxSize GetPixelSize() const; | |
0c14b6c3 FM |
80 | virtual wxFontFamily GetFamily() const; |
81 | virtual wxFontStyle GetStyle() const; | |
82 | virtual wxFontWeight GetWeight() const; | |
5c6eb3a8 SC |
83 | virtual bool GetUnderlined() const; |
84 | virtual wxString GetFaceName() const; | |
85 | virtual wxFontEncoding GetEncoding() const; | |
86 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
87 | ||
88 | virtual void SetPointSize(int pointSize); | |
0c14b6c3 FM |
89 | virtual void SetFamily(wxFontFamily family); |
90 | virtual void SetStyle(wxFontStyle style); | |
91 | virtual void SetWeight(wxFontWeight weight); | |
5c6eb3a8 SC |
92 | virtual bool SetFaceName(const wxString& faceName); |
93 | virtual void SetUnderlined(bool underlined); | |
94 | virtual void SetEncoding(wxFontEncoding encoding); | |
95 | ||
0c14b6c3 FM |
96 | WXDECLARE_COMPAT_SETTERS |
97 | ||
5c6eb3a8 SC |
98 | // implementation only from now on |
99 | // ------------------------------- | |
100 | ||
101 | virtual bool RealizeResource(); | |
102 | ||
103 | // Unofficial API, don't use | |
104 | virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; | |
105 | virtual bool GetNoAntiAliasing() const ; | |
106 | ||
107 | // Mac-specific, risks to change, don't use in portable code | |
108 | ||
b46f221f | 109 | #if wxOSX_USE_ATSU_TEXT |
5c6eb3a8 SC |
110 | // 'old' Quickdraw accessors |
111 | short MacGetFontNum() const; | |
112 | short MacGetFontSize() const; | |
113 | wxByte MacGetFontStyle() const; | |
114 | ||
115 | // 'new' ATSUI accessors | |
116 | wxUint32 MacGetATSUFontID() const; | |
117 | wxUint32 MacGetATSUAdditionalQDStyles() const; | |
118 | wxUint16 MacGetThemeFontID() const ; | |
119 | ||
120 | // Returns an ATSUStyle not ATSUStyle* | |
121 | #endif | |
b46f221f | 122 | #if wxOSX_USE_CORE_TEXT |
5c6eb3a8 | 123 | const void * MacGetCTFont() const; |
5c6eb3a8 | 124 | #endif |
b46f221f | 125 | #if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT |
5c6eb3a8 SC |
126 | void* MacGetATSUStyle() const ; |
127 | #endif | |
128 | ||
129 | protected: | |
130 | virtual wxGDIRefData *CreateGDIRefData() const; | |
131 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
132 | ||
133 | private: | |
134 | void Unshare(); | |
135 | ||
136 | DECLARE_DYNAMIC_CLASS(wxFont) | |
137 | }; | |
138 | ||
139 | #endif // _WX_FONT_H_ |