]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/font.cpp
blind OS/2 compilation fix in wxSetWorkingDirectory()
[wxWidgets.git] / src / cocoa / font.cpp
CommitLineData
a24aff65 1/////////////////////////////////////////////////////////////////////////////
8898456d 2// Name: src/cocoa/font.cpp
a24aff65
DE
3// Purpose: wxFont class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
8898456d 9// Licence: wxWindows licence
a24aff65
DE
10/////////////////////////////////////////////////////////////////////////////
11
8898456d
WS
12#include "wx/wxprec.h"
13
48a1108e
WS
14#include "wx/font.h"
15
8898456d
WS
16#ifndef WX_PRECOMP
17 #include "wx/string.h"
dd05139a 18 #include "wx/gdicmn.h"
8898456d
WS
19#endif
20
9c6e197f 21#include "wx/encinfo.h"
a24aff65 22
a24aff65 23IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
a24aff65
DE
24
25void wxFontRefData::Init(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
26{
8898456d
WS
27 m_family = family;
28 m_style = style;
29 m_weight = weight;
30 m_underlined = underlined;
31 m_faceName = faceName;
32 m_encoding = encoding;
a24aff65
DE
33}
34
35wxFontRefData::~wxFontRefData()
36{
37 // TODO: delete font data
38}
39
68c95704 40#define M_FONTDATA ((wxFontRefData*)m_refData)
873fd4af 41
a24aff65
DE
42bool wxFont::Create(const wxNativeFontInfo&)
43{
8898456d 44 return false;
a24aff65
DE
45}
46
47void wxFont::SetEncoding(wxFontEncoding)
48{
49}
50
51wxFontEncoding wxFont::GetEncoding() const
52{
53 return wxFontEncoding();
54}
55
56int wxFont::GetPointSize() const
57{
58 return 0;
59}
60
61bool wxFont::GetUnderlined() const
62{
e7e97a59
DE
63 if(M_FONTDATA)
64 return M_FONTDATA->m_underlined;
65 else
66 return false;
a24aff65
DE
67}
68
69int wxFont::GetStyle() const
70{
71 return 0;
72}
73
74int wxFont::GetFamily() const
75{
76 return 0;
77}
78
79int wxFont::GetWeight() const
80{
81 return 0;
82}
83
3bf5a59b
VZ
84const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
85{
86 return NULL;
87}
88
a24aff65
DE
89void wxGetNativeFontEncoding(wxFontEncoding, wxNativeEncodingInfo*);
90
91bool wxFont::Create(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
92{
93 UnRef();
94 m_refData = new wxFontRefData;
95
96 M_FONTDATA->m_family = family;
97 M_FONTDATA->m_style = style;
98 M_FONTDATA->m_weight = weight;
99 M_FONTDATA->m_pointSize = pointSize;
100 M_FONTDATA->m_underlined = underlined;
101 M_FONTDATA->m_faceName = faceName;
102
103 RealizeResource();
104
8898456d 105 return true;
a24aff65
DE
106}
107
108wxFont::~wxFont()
109{
a24aff65
DE
110}
111
112bool wxFont::RealizeResource()
113{
114 // TODO: create the font (if there is a native font object)
8898456d 115 return false;
a24aff65
DE
116}
117
118void wxFont::Unshare()
119{
8898456d
WS
120 // Don't change shared data
121 if (!m_refData)
a24aff65 122 {
8898456d
WS
123 m_refData = new wxFontRefData();
124 }
a24aff65
DE
125 else
126 {
8898456d
WS
127 wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
128 UnRef();
129 m_refData = ref;
130 }
a24aff65
DE
131}
132
133void wxFont::SetPointSize(int pointSize)
134{
135 Unshare();
136
137 M_FONTDATA->m_pointSize = pointSize;
138
139 RealizeResource();
140}
141
142void wxFont::SetFamily(int family)
143{
144 Unshare();
145
146 M_FONTDATA->m_family = family;
147
148 RealizeResource();
149}
150
151void wxFont::SetStyle(int style)
152{
153 Unshare();
154
155 M_FONTDATA->m_style = style;
156
157 RealizeResource();
158}
159
160void wxFont::SetWeight(int weight)
161{
162 Unshare();
163
164 M_FONTDATA->m_weight = weight;
165
166 RealizeResource();
167}
168
85ab460e 169bool wxFont::SetFaceName(const wxString& faceName)
a24aff65
DE
170{
171 Unshare();
172
173 M_FONTDATA->m_faceName = faceName;
174
175 RealizeResource();
85ab460e
VZ
176
177 return wxFontBase::SetFaceName(faceName);
a24aff65
DE
178}
179
180void wxFont::SetUnderlined(bool underlined)
181{
182 Unshare();
183
184 M_FONTDATA->m_underlined = underlined;
185
186 RealizeResource();
187}
188
189/* New font system */
190wxString wxFont::GetFaceName() const
191{
b0c0a393 192 wxString str;
a24aff65 193 if (M_FONTDATA)
8898456d 194 str = M_FONTDATA->m_faceName ;
a24aff65
DE
195 return str;
196}
197
198// vim:sts=4:sw=4:et