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