]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/font.cpp
setting clipping correctly
[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
a24aff65
DE
40bool wxFont::Create(const wxNativeFontInfo&)
41{
8898456d 42 return false;
a24aff65
DE
43}
44
45void wxFont::SetEncoding(wxFontEncoding)
46{
47}
48
49wxFontEncoding wxFont::GetEncoding() const
50{
51 return wxFontEncoding();
52}
53
54int wxFont::GetPointSize() const
55{
56 return 0;
57}
58
59bool wxFont::GetUnderlined() const
60{
8898456d 61 return false;
a24aff65
DE
62}
63
64int wxFont::GetStyle() const
65{
66 return 0;
67}
68
69int wxFont::GetFamily() const
70{
71 return 0;
72}
73
74int wxFont::GetWeight() const
75{
76 return 0;
77}
78
3bf5a59b
VZ
79const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
80{
81 return NULL;
82}
83
a24aff65
DE
84void wxGetNativeFontEncoding(wxFontEncoding, wxNativeEncodingInfo*);
85
86bool wxFont::Create(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
87{
88 UnRef();
89 m_refData = new wxFontRefData;
90
91 M_FONTDATA->m_family = family;
92 M_FONTDATA->m_style = style;
93 M_FONTDATA->m_weight = weight;
94 M_FONTDATA->m_pointSize = pointSize;
95 M_FONTDATA->m_underlined = underlined;
96 M_FONTDATA->m_faceName = faceName;
97
98 RealizeResource();
99
8898456d 100 return true;
a24aff65
DE
101}
102
103wxFont::~wxFont()
104{
a24aff65
DE
105}
106
107bool wxFont::RealizeResource()
108{
109 // TODO: create the font (if there is a native font object)
8898456d 110 return false;
a24aff65
DE
111}
112
113void wxFont::Unshare()
114{
8898456d
WS
115 // Don't change shared data
116 if (!m_refData)
a24aff65 117 {
8898456d
WS
118 m_refData = new wxFontRefData();
119 }
a24aff65
DE
120 else
121 {
8898456d
WS
122 wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
123 UnRef();
124 m_refData = ref;
125 }
a24aff65
DE
126}
127
128void wxFont::SetPointSize(int pointSize)
129{
130 Unshare();
131
132 M_FONTDATA->m_pointSize = pointSize;
133
134 RealizeResource();
135}
136
137void wxFont::SetFamily(int family)
138{
139 Unshare();
140
141 M_FONTDATA->m_family = family;
142
143 RealizeResource();
144}
145
146void wxFont::SetStyle(int style)
147{
148 Unshare();
149
150 M_FONTDATA->m_style = style;
151
152 RealizeResource();
153}
154
155void wxFont::SetWeight(int weight)
156{
157 Unshare();
158
159 M_FONTDATA->m_weight = weight;
160
161 RealizeResource();
162}
163
85ab460e 164bool wxFont::SetFaceName(const wxString& faceName)
a24aff65
DE
165{
166 Unshare();
167
168 M_FONTDATA->m_faceName = faceName;
169
170 RealizeResource();
85ab460e
VZ
171
172 return wxFontBase::SetFaceName(faceName);
a24aff65
DE
173}
174
175void wxFont::SetUnderlined(bool underlined)
176{
177 Unshare();
178
179 M_FONTDATA->m_underlined = underlined;
180
181 RealizeResource();
182}
183
184/* New font system */
185wxString wxFont::GetFaceName() const
186{
b0c0a393 187 wxString str;
a24aff65 188 if (M_FONTDATA)
8898456d 189 str = M_FONTDATA->m_faceName ;
a24aff65
DE
190 return str;
191}
192
193// vim:sts=4:sw=4:et