]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/font.h
reverted r51340: don't use wxWeakRef in the library code as long as not all supported...
[wxWidgets.git] / include / wx / mac / 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 WXDLLEXPORT wxFont : public wxFontBase
20 {
21 public:
22 // ctors and such
23 wxFont() { }
24
25 wxFont(int size,
26 int family,
27 int style,
28 int weight,
29 bool underlined = FALSE,
30 const wxString& face = wxEmptyString,
31 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
32 {
33 (void)Create(size, family, style, weight, underlined, face, encoding);
34 }
35
36 wxFont(const wxNativeFontInfo& info)
37 {
38 (void)Create(info);
39 }
40
41 wxFont(const wxString& fontDesc);
42
43 bool Create(int size,
44 int family,
45 int style,
46 int weight,
47 bool underlined = FALSE,
48 const wxString& face = wxEmptyString,
49 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
50
51 bool Create(const wxNativeFontInfo& info);
52
53 bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
54 #if wxMAC_USE_CORE_TEXT
55 bool MacCreateFromUIFont( wxUint32 coreTextFontType );
56 bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 );
57 bool MacCreateFromCTFont( const void * ctFont );
58 #endif
59
60 virtual ~wxFont();
61
62 // implement base class pure virtuals
63 virtual int GetPointSize() const;
64 virtual wxSize GetPixelSize() const;
65 virtual int GetFamily() const;
66 virtual int GetStyle() const;
67 virtual int GetWeight() const;
68 virtual bool GetUnderlined() const;
69 virtual wxString GetFaceName() const;
70 virtual wxFontEncoding GetEncoding() const;
71 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
72
73 virtual void SetPointSize(int pointSize);
74 virtual void SetFamily(int family);
75 virtual void SetStyle(int style);
76 virtual void SetWeight(int weight);
77 virtual bool SetFaceName(const wxString& faceName);
78 virtual void SetUnderlined(bool underlined);
79 virtual void SetEncoding(wxFontEncoding encoding);
80
81 // implementation only from now on
82 // -------------------------------
83
84 virtual bool RealizeResource();
85
86 // Unofficial API, don't use
87 virtual void SetNoAntiAliasing( bool noAA = TRUE ) ;
88 virtual bool GetNoAntiAliasing() const ;
89
90 // Mac-specific, risks to change, don't use in portable code
91
92 #if wxMAC_USE_ATSU_TEXT
93 // 'old' Quickdraw accessors
94 short MacGetFontNum() const;
95 short MacGetFontSize() const;
96 wxByte MacGetFontStyle() const;
97
98 // 'new' ATSUI accessors
99 wxUint32 MacGetATSUFontID() const;
100 wxUint32 MacGetATSUAdditionalQDStyles() const;
101 wxUint16 MacGetThemeFontID() const ;
102
103 // Returns an ATSUStyle not ATSUStyle*
104 #endif
105 #if wxMAC_USE_CORE_TEXT
106 const void * MacGetCTFont() const;
107 const void * MacGetCTFontDescriptor() const;
108 #endif
109 #if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
110 void* MacGetATSUStyle() const ;
111 #endif
112
113 protected:
114 virtual wxGDIRefData *CreateGDIRefData() const;
115 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
116
117 private:
118 void Unshare();
119
120 DECLARE_DYNAMIC_CLASS(wxFont)
121 };
122
123 #endif // _WX_FONT_H_