]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/font.cpp
Wrappers for *ToText
[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
12#ifdef __GNUG__
13#pragma implementation "font.h"
14#endif
15
16#include "wx/defs.h"
17#include "wx/string.h"
18#include "wx/font.h"
19#include "wx/gdicmn.h"
9c6e197f 20#include "wx/encinfo.h"
a24aff65
DE
21
22#if !USE_SHARED_LIBRARIES
23IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
24#endif
25
26void wxFontRefData::Init(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
27{
28 m_family = family;
29 m_style = style;
30 m_weight = weight;
31 m_underlined = underlined;
32 m_faceName = faceName;
33 m_encoding = encoding;
34}
35
36wxFontRefData::~wxFontRefData()
37{
38 // TODO: delete font data
39}
40
41void wxFont::Init()
42{
43}
44
45bool wxFont::Create(const wxNativeFontInfo&)
46{
47 return FALSE;
48}
49
50void wxFont::SetEncoding(wxFontEncoding)
51{
52}
53
54wxFontEncoding wxFont::GetEncoding() const
55{
56 return wxFontEncoding();
57}
58
59int wxFont::GetPointSize() const
60{
61 return 0;
62}
63
64bool wxFont::GetUnderlined() const
65{
66 return FALSE;
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
105 return TRUE;
106}
107
108wxFont::~wxFont()
109{
110 if (wxTheFontList)
111 wxTheFontList->DeleteObject(this);
112}
113
114bool wxFont::RealizeResource()
115{
116 // TODO: create the font (if there is a native font object)
117 return FALSE;
118}
119
120void wxFont::Unshare()
121{
122 // Don't change shared data
123 if (!m_refData)
124 {
125 m_refData = new wxFontRefData();
126 }
127 else
128 {
129 wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
130 UnRef();
131 m_refData = ref;
132 }
133}
134
135void wxFont::SetPointSize(int pointSize)
136{
137 Unshare();
138
139 M_FONTDATA->m_pointSize = pointSize;
140
141 RealizeResource();
142}
143
144void wxFont::SetFamily(int family)
145{
146 Unshare();
147
148 M_FONTDATA->m_family = family;
149
150 RealizeResource();
151}
152
153void wxFont::SetStyle(int style)
154{
155 Unshare();
156
157 M_FONTDATA->m_style = style;
158
159 RealizeResource();
160}
161
162void wxFont::SetWeight(int weight)
163{
164 Unshare();
165
166 M_FONTDATA->m_weight = weight;
167
168 RealizeResource();
169}
170
171void wxFont::SetFaceName(const wxString& faceName)
172{
173 Unshare();
174
175 M_FONTDATA->m_faceName = faceName;
176
177 RealizeResource();
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
DE
193 if (M_FONTDATA)
194 str = M_FONTDATA->m_faceName ;
195 return str;
196}
197
198// vim:sts=4:sw=4:et