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