]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/dfb/font.cpp
Use gdk_window_invalidate instead of gtk_widget_queue_draw as the latter doesn't...
[wxWidgets.git] / src / dfb / font.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/dfb/font.cpp
3// Purpose: wxFont implementation
4// Author: Vaclav Slavik
5// Created: 2006-08-08
6// RCS-ID: $Id$
7// Copyright: (c) 2006 REA Elektronik GmbH
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// For compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#include "wx/font.h"
27
28#ifndef WX_PRECOMP
29 #include "wx/app.h"
30#endif
31
32#include "wx/dfb/private.h"
33#include "wx/private/fontmgr.h"
34
35typedef wxFontMgrFontRefData wxFontRefData;
36#define M_FONTDATA ((wxFontRefData*)m_refData)
37
38// ----------------------------------------------------------------------------
39// wxFont
40// ----------------------------------------------------------------------------
41
42IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
43
44bool wxFont::Create(const wxNativeFontInfo& info)
45{
46 return Create(info.pointSize, info.family, info.style, info.weight,
47 info.underlined, info.faceName, info.encoding);
48}
49
50bool wxFont::Create(int pointSize,
51 wxFontFamily family,
52 wxFontStyle style,
53 wxFontWeight weight,
54 bool underlined,
55 const wxString& face,
56 wxFontEncoding encoding)
57{
58 m_refData = new wxFontRefData(pointSize, family, style, weight,
59 underlined, face, encoding);
60 return true;
61}
62
63wxGDIRefData *wxFont::CreateGDIRefData() const
64{
65 return new wxFontRefData;
66}
67
68wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
69{
70 return new wxFontRefData(*(wxFontRefData *)data);
71}
72
73
74// ----------------------------------------------------------------------------
75// accessors
76// ----------------------------------------------------------------------------
77
78wxIDirectFBFontPtr wxFont::GetDirectFBFont(bool antialiased) const
79{
80 wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
81
82 // we don't support DC scaling yet, so use scale=1
83 wxFontInstance *i = M_FONTDATA->GetFontInstance(1.0, antialiased);
84 return i ? i->GetDirectFBFont() : wxIDirectFBFontPtr();
85}
86
87int wxFont::GetPointSize() const
88{
89 wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
90
91 return M_FONTDATA->GetPointSize();
92}
93
94wxString wxFont::GetFaceName() const
95{
96 wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
97
98 return M_FONTDATA->GetFaceName();
99}
100
101wxFontFamily wxFont::GetFamily() const
102{
103 wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
104
105 return M_FONTDATA->GetFamily();
106}
107
108wxFontStyle wxFont::GetStyle() const
109{
110 wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
111
112 return M_FONTDATA->GetStyle();
113}
114
115wxFontWeight wxFont::GetWeight() const
116{
117 wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
118
119 return M_FONTDATA->GetWeight();
120}
121
122bool wxFont::GetUnderlined() const
123{
124 wxCHECK_MSG( Ok(), false, wxT("invalid font") );
125
126 return M_FONTDATA->GetUnderlined();
127}
128
129
130wxFontEncoding wxFont::GetEncoding() const
131{
132 wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
133
134 return M_FONTDATA->GetEncoding();
135}
136
137bool wxFont::IsFixedWidth() const
138{
139 wxCHECK_MSG( Ok(), false, wxT("invalid font") );
140
141 return M_FONTDATA->IsFixedWidth();
142}
143
144const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
145{
146 wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
147
148 return M_FONTDATA->GetNativeFontInfo();
149}
150
151bool wxFont::GetNoAntiAliasing() const
152{
153 wxCHECK_MSG( Ok(), false, wxT("invalid font") );
154
155 return M_FONTDATA->GetNoAntiAliasing();
156}
157
158// ----------------------------------------------------------------------------
159// change font attributes
160// ----------------------------------------------------------------------------
161
162void wxFont::SetPointSize(int pointSize)
163{
164 AllocExclusive();
165 M_FONTDATA->SetPointSize(pointSize);
166}
167
168void wxFont::SetFamily(wxFontFamily family)
169{
170 AllocExclusive();
171 M_FONTDATA->SetFamily(family);
172}
173
174void wxFont::SetStyle(wxFontStyle style)
175{
176 AllocExclusive();
177 M_FONTDATA->SetStyle(style);
178}
179
180void wxFont::SetWeight(wxFontWeight weight)
181{
182 AllocExclusive();
183 M_FONTDATA->SetWeight(weight);
184}
185
186bool wxFont::SetFaceName(const wxString& faceName)
187{
188 AllocExclusive();
189 M_FONTDATA->SetFaceName(faceName);
190 return wxFontBase::SetFaceName(faceName);
191}
192
193void wxFont::SetUnderlined(bool underlined)
194{
195 AllocExclusive();
196 M_FONTDATA->SetUnderlined(underlined);
197}
198
199void wxFont::SetEncoding(wxFontEncoding encoding)
200{
201 AllocExclusive();
202 M_FONTDATA->SetEncoding(encoding);
203}
204
205void wxFont::SetNoAntiAliasing(bool no)
206{
207 AllocExclusive();
208 M_FONTDATA->SetNoAntiAliasing(no);
209}