]> git.saurik.com Git - wxWidgets.git/blame - src/common/fontcmn.cpp
wxDataObejct and related changes (won't compile right now)
[wxWidgets.git] / src / common / fontcmn.cpp
CommitLineData
0c5d3e1c
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: common/fontcmn.cpp
3// Purpose: implementation of wxFontBase methods
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 20.09.99
7// RCS-ID: $Id$
8// Copyright: (c) wxWindows team
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
1b68e0b5
RR
20#ifdef __GNUG__
21 #pragma implementation "fontbase.h"
22#endif
23
0c5d3e1c
VZ
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
32 #include "wx/font.h"
33#endif // WX_PRECOMP
34
35// ============================================================================
36// implementation
37// ============================================================================
38
39// ----------------------------------------------------------------------------
40// wxFontBase
41// ----------------------------------------------------------------------------
42
43wxFontEncoding wxFontBase::ms_encodingDefault = wxFONTENCODING_SYSTEM;
44
45wxFont *wxFontBase::New(int size,
46 int family,
47 int style,
48 int weight,
49 bool underlined,
50 const wxString& face,
51 wxFontEncoding encoding)
52{
53 return new wxFont(size, family, style, weight, underlined, face, encoding);
54}
55
56wxFont& wxFont::operator=(const wxFont& font)
57{
58 if ( this != &font )
59 Ref(font);
60
61 return (wxFont &)*this;
62}
63
64// VZ: is it correct to compare pointers and not the contents? (FIXME)
65bool wxFontBase::operator==(const wxFont& font) const
66{
5e0201ea 67 return GetFontData() == font.GetFontData();
0c5d3e1c
VZ
68}
69
70bool wxFontBase::operator!=(const wxFont& font) const
71{
5e0201ea 72 return GetFontData() != font.GetFontData();
0c5d3e1c
VZ
73}
74
75wxString wxFontBase::GetFamilyString() const
76{
223d09f6 77 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
0c5d3e1c
VZ
78
79 switch ( GetFamily() )
80 {
223d09f6
KB
81 case wxDECORATIVE: return wxT("wxDECORATIVE");
82 case wxROMAN: return wxT("wxROMAN");
83 case wxSCRIPT: return wxT("wxSCRIPT");
84 case wxSWISS: return wxT("wxSWISS");
85 case wxMODERN: return wxT("wxMODERN");
86 case wxTELETYPE: return wxT("wxTELETYPE");
87 default: return wxT("wxDEFAULT");
0c5d3e1c
VZ
88 }
89}
90
91wxString wxFontBase::GetStyleString() const
92{
223d09f6 93 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
0c5d3e1c
VZ
94
95 switch ( GetStyle() )
96 {
223d09f6
KB
97 case wxNORMAL: return wxT("wxNORMAL");
98 case wxSLANT: return wxT("wxSLANT");
99 case wxITALIC: return wxT("wxITALIC");
100 default: return wxT("wxDEFAULT");
0c5d3e1c
VZ
101 }
102}
103
104wxString wxFontBase::GetWeightString() const
105{
223d09f6 106 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
0c5d3e1c
VZ
107
108 switch ( GetWeight() )
109 {
223d09f6
KB
110 case wxNORMAL: return wxT("wxNORMAL");
111 case wxBOLD: return wxT("wxBOLD");
112 case wxLIGHT: return wxT("wxLIGHT");
113 default: return wxT("wxDEFAULT");
0c5d3e1c
VZ
114 }
115}
116