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