]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/font.cpp
check default library directories in WX_PATH_FIND_LIBRARIES; do *not* add default...
[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 21
a24aff65 22IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
a24aff65
DE
23
24void wxFontRefData::Init(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
25{
26 m_family = family;
27 m_style = style;
28 m_weight = weight;
29 m_underlined = underlined;
30 m_faceName = faceName;
31 m_encoding = encoding;
32}
33
34wxFontRefData::~wxFontRefData()
35{
36 // TODO: delete font data
37}
38
39void wxFont::Init()
40{
41}
42
43bool wxFont::Create(const wxNativeFontInfo&)
44{
45 return FALSE;
46}
47
48void wxFont::SetEncoding(wxFontEncoding)
49{
50}
51
52wxFontEncoding wxFont::GetEncoding() const
53{
54 return wxFontEncoding();
55}
56
57int wxFont::GetPointSize() const
58{
59 return 0;
60}
61
62bool wxFont::GetUnderlined() const
63{
64 return FALSE;
65}
66
67int wxFont::GetStyle() const
68{
69 return 0;
70}
71
72int wxFont::GetFamily() const
73{
74 return 0;
75}
76
77int wxFont::GetWeight() const
78{
79 return 0;
80}
81
3bf5a59b
VZ
82const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
83{
84 return NULL;
85}
86
a24aff65
DE
87void wxGetNativeFontEncoding(wxFontEncoding, wxNativeEncodingInfo*);
88
89bool wxFont::Create(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
90{
91 UnRef();
92 m_refData = new wxFontRefData;
93
94 M_FONTDATA->m_family = family;
95 M_FONTDATA->m_style = style;
96 M_FONTDATA->m_weight = weight;
97 M_FONTDATA->m_pointSize = pointSize;
98 M_FONTDATA->m_underlined = underlined;
99 M_FONTDATA->m_faceName = faceName;
100
101 RealizeResource();
102
103 return TRUE;
104}
105
106wxFont::~wxFont()
107{
108 if (wxTheFontList)
109 wxTheFontList->DeleteObject(this);
110}
111
112bool wxFont::RealizeResource()
113{
114 // TODO: create the font (if there is a native font object)
115 return FALSE;
116}
117
118void wxFont::Unshare()
119{
120 // Don't change shared data
121 if (!m_refData)
122 {
123 m_refData = new wxFontRefData();
124 }
125 else
126 {
127 wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
128 UnRef();
129 m_refData = ref;
130 }
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
169void wxFont::SetFaceName(const wxString& faceName)
170{
171 Unshare();
172
173 M_FONTDATA->m_faceName = faceName;
174
175 RealizeResource();
176}
177
178void wxFont::SetUnderlined(bool underlined)
179{
180 Unshare();
181
182 M_FONTDATA->m_underlined = underlined;
183
184 RealizeResource();
185}
186
187/* New font system */
188wxString wxFont::GetFaceName() const
189{
b0c0a393 190 wxString str;
a24aff65
DE
191 if (M_FONTDATA)
192 str = M_FONTDATA->m_faceName ;
193 return str;
194}
195
196// vim:sts=4:sw=4:et