]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/carbon/font.h
extract (and expand and clean up and document) the header window implementation used...
[wxWidgets.git] / include / wx / osx / carbon / 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 // ----------------------------------------------------------------------------
16 // wxFont
17 // ----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
20 {
21 public:
22 // ctors and such
23 wxFont() { }
24
25 #if FUTURE_WXWIN_COMPATIBILITY_3_0
26 wxFont(int size,
27 int family,
28 int style,
29 int weight,
30 bool underlined = false,
31 const wxString& face = wxEmptyString,
32 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
33 {
34 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
35 }
36 #endif
37
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)
45 {
46 Create(size, family, style, weight, underlined, face, encoding);
47 }
48
49 bool Create(int size,
50 wxFontFamily family,
51 wxFontStyle style,
52 wxFontWeight weight,
53 bool underlined = false,
54 const wxString& face = wxEmptyString,
55 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
56
57 wxFont(const wxNativeFontInfo& info)
58 {
59 (void)Create(info);
60 }
61
62 wxFont(const wxString& fontDesc);
63
64 bool Create(const wxNativeFontInfo& info);
65
66 #if wxOSX_USE_CARBON
67 bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
68 #endif
69 #if wxOSX_USE_CORE_TEXT
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;
80 virtual wxFontFamily GetFamily() const;
81 virtual wxFontStyle GetStyle() const;
82 virtual wxFontWeight GetWeight() const;
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);
89 virtual void SetFamily(wxFontFamily family);
90 virtual void SetStyle(wxFontStyle style);
91 virtual void SetWeight(wxFontWeight weight);
92 virtual bool SetFaceName(const wxString& faceName);
93 virtual void SetUnderlined(bool underlined);
94 virtual void SetEncoding(wxFontEncoding encoding);
95
96 WXDECLARE_COMPAT_SETTERS
97
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
109 #if wxOSX_USE_ATSU_TEXT
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
122 #if wxOSX_USE_CORE_TEXT
123 const void * MacGetCTFont() const;
124 #endif
125 #if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
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_