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