]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/font.h
add the wxFont(const wxSize& pixelSize, ...) ctor to all ports; add some wxCHECK_MSGs...
[wxWidgets.git] / include / wx / osx / 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 wxFont(const wxSize& pixelSize,
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 Create(10, family, style, weight, underlined, face, encoding);
58 SetPixelSize(pixelSize);
59 }
60
61 bool Create(int size,
62 wxFontFamily family,
63 wxFontStyle style,
64 wxFontWeight weight,
65 bool underlined = false,
66 const wxString& face = wxEmptyString,
67 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
68
69 wxFont(const wxNativeFontInfo& info)
70 {
71 (void)Create(info);
72 }
73
74 wxFont(const wxString& fontDesc);
75
76 bool Create(const wxNativeFontInfo& info);
77
78 #if wxOSX_USE_ATSU_TEXT
79 bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
80 #endif
81 #if wxOSX_USE_CORE_TEXT
82 bool MacCreateFromUIFont( wxUint32 coreTextFontType );
83 bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 );
84 bool MacCreateFromCTFont( const void * ctFont );
85 #endif
86
87 virtual ~wxFont();
88
89 // implement base class pure virtuals
90 virtual int GetPointSize() const;
91 virtual wxSize GetPixelSize() const;
92 virtual wxFontFamily GetFamily() const;
93 virtual wxFontStyle GetStyle() const;
94 virtual wxFontWeight GetWeight() const;
95 virtual bool GetUnderlined() const;
96 virtual wxString GetFaceName() const;
97 virtual wxFontEncoding GetEncoding() const;
98 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
99
100 virtual void SetPointSize(int pointSize);
101 virtual void SetFamily(wxFontFamily family);
102 virtual void SetStyle(wxFontStyle style);
103 virtual void SetWeight(wxFontWeight weight);
104 virtual bool SetFaceName(const wxString& faceName);
105 virtual void SetUnderlined(bool underlined);
106 virtual void SetEncoding(wxFontEncoding encoding);
107
108 WXDECLARE_COMPAT_SETTERS
109
110 // implementation only from now on
111 // -------------------------------
112
113 virtual bool RealizeResource();
114
115 // Unofficial API, don't use
116 virtual void SetNoAntiAliasing( bool noAA = TRUE ) ;
117 virtual bool GetNoAntiAliasing() const ;
118
119 // Mac-specific, risks to change, don't use in portable code
120
121 #if wxOSX_USE_ATSU_TEXT
122 // 'old' Quickdraw accessors
123 short MacGetFontNum() const;
124 short MacGetFontSize() const;
125 wxByte MacGetFontStyle() const;
126
127 // 'new' ATSUI accessors
128 wxUint32 MacGetATSUFontID() const;
129 wxUint32 MacGetATSUAdditionalQDStyles() const;
130 wxUint16 MacGetThemeFontID() const ;
131
132 // Returns an ATSUStyle not ATSUStyle*
133 #endif
134 #if wxOSX_USE_CORE_TEXT
135 const void * MacGetCTFont() const;
136 #endif
137 #if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
138 void* MacGetATSUStyle() const ;
139 #endif
140
141 protected:
142 virtual wxGDIRefData *CreateGDIRefData() const;
143 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
144
145 private:
146 void Unshare();
147
148 DECLARE_DYNAMIC_CLASS(wxFont)
149 };
150
151 #endif // _WX_FONT_H_