]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/font.h
wxTipWindow is now a wxPopupTransientWindow instead of a wxFrame.
[wxWidgets.git] / include / wx / mac / 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 #ifdef __GNUG__
16 #pragma interface "font.h"
17 #endif
18
19 class WXDLLEXPORT wxFontRefData: public wxGDIRefData
20 {
21 friend class WXDLLEXPORT wxFont;
22 public:
23 wxFontRefData()
24 {
25 Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
26 "Geneva", wxFONTENCODING_DEFAULT);
27 }
28
29 wxFontRefData(const wxFontRefData& data)
30 {
31 Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
32 data.m_underlined, data.m_faceName, data.m_encoding);
33
34 m_macFontNum = data.m_macFontNum ;
35 m_macFontSize = data.m_macFontSize;
36 m_macFontStyle = data.m_macFontStyle;
37 m_fontId = data.m_fontId;
38 }
39
40 wxFontRefData(int size,
41 int family,
42 int style,
43 int weight,
44 bool underlined,
45 const wxString& faceName,
46 wxFontEncoding encoding)
47 {
48 Init(size, family, style, weight, underlined, faceName, encoding);
49 }
50
51 virtual ~wxFontRefData();
52 protected:
53 // common part of all ctors
54 void Init(int size,
55 int family,
56 int style,
57 int weight,
58 bool underlined,
59 const wxString& faceName,
60 wxFontEncoding encoding);
61
62 // font characterstics
63 int m_fontId;
64 int m_pointSize;
65 int m_family;
66 int m_style;
67 int m_weight;
68 bool m_underlined;
69 wxString m_faceName;
70 wxFontEncoding m_encoding;
71
72 public :
73 short m_macFontNum ;
74 short m_macFontSize ;
75 Style m_macFontStyle ;
76 public :
77 void MacFindFont() ;
78 };
79 // ----------------------------------------------------------------------------
80 // wxFont
81 // ----------------------------------------------------------------------------
82
83 class WXDLLEXPORT wxFont : public wxFontBase
84 {
85 public:
86 // ctors and such
87 wxFont() { Init(); }
88 wxFont(const wxFont& font) { Init(); Ref(font); }
89
90 wxFont(int size,
91 int family,
92 int style,
93 int weight,
94 bool underlined = FALSE,
95 const wxString& face = wxEmptyString,
96 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
97 {
98 Init();
99
100 (void)Create(size, family, style, weight, underlined, face, encoding);
101 }
102
103 wxFont(const wxNativeFontInfo& info)
104 {
105 Init();
106
107 (void)Create(info);
108 }
109
110 wxFont(const wxString& fontDesc);
111
112 bool Create(int size,
113 int family,
114 int style,
115 int weight,
116 bool underlined = FALSE,
117 const wxString& face = wxEmptyString,
118 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
119
120 bool Create(const wxNativeFontInfo& info);
121
122 virtual ~wxFont();
123
124 // assignment
125 wxFont& operator=(const wxFont& font);
126
127 // implement base class pure virtuals
128 virtual int GetPointSize() const;
129 virtual int GetFamily() const;
130 virtual int GetStyle() const;
131 virtual int GetWeight() const;
132 virtual bool GetUnderlined() const;
133 virtual wxString GetFaceName() const;
134 virtual wxFontEncoding GetEncoding() const;
135
136 virtual void SetPointSize(int pointSize);
137 virtual void SetFamily(int family);
138 virtual void SetStyle(int style);
139 virtual void SetWeight(int weight);
140 virtual void SetFaceName(const wxString& faceName);
141 virtual void SetUnderlined(bool underlined);
142 virtual void SetEncoding(wxFontEncoding encoding);
143
144 // implementation only from now on
145 // -------------------------------
146
147 virtual bool RealizeResource();
148
149 protected:
150 // common part of all ctors
151 void Init();
152
153 void Unshare();
154
155 private:
156 DECLARE_DYNAMIC_CLASS(wxFont)
157 };
158
159 #endif
160 // _WX_FONT_H_