]>
Commit | Line | Data |
---|---|---|
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 | ||
20 | // For compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #ifndef WX_PRECOMP | |
28 | #include "wx/font.h" | |
29 | #endif // WX_PRECOMP | |
30 | ||
31 | // ============================================================================ | |
32 | // implementation | |
33 | // ============================================================================ | |
34 | ||
35 | // ---------------------------------------------------------------------------- | |
36 | // wxFontBase | |
37 | // ---------------------------------------------------------------------------- | |
38 | ||
39 | wxFontEncoding wxFontBase::ms_encodingDefault = wxFONTENCODING_SYSTEM; | |
40 | ||
41 | wxFont *wxFontBase::New(int size, | |
42 | int family, | |
43 | int style, | |
44 | int weight, | |
45 | bool underlined, | |
46 | const wxString& face, | |
47 | wxFontEncoding encoding) | |
48 | { | |
49 | return new wxFont(size, family, style, weight, underlined, face, encoding); | |
50 | } | |
51 | ||
52 | wxFont& wxFont::operator=(const wxFont& font) | |
53 | { | |
54 | if ( this != &font ) | |
55 | Ref(font); | |
56 | ||
57 | return (wxFont &)*this; | |
58 | } | |
59 | ||
60 | // VZ: is it correct to compare pointers and not the contents? (FIXME) | |
61 | bool wxFontBase::operator==(const wxFont& font) const | |
62 | { | |
63 | return m_refData == font.m_refData; | |
64 | } | |
65 | ||
66 | bool wxFontBase::operator!=(const wxFont& font) const | |
67 | { | |
68 | return m_refData != font.m_refData; | |
69 | } | |
70 | ||
71 | wxString wxFontBase::GetFamilyString() const | |
72 | { | |
73 | wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); | |
74 | ||
75 | switch ( GetFamily() ) | |
76 | { | |
77 | case wxDECORATIVE: return _T("wxDECORATIVE"); | |
78 | case wxROMAN: return _T("wxROMAN"); | |
79 | case wxSCRIPT: return _T("wxSCRIPT"); | |
80 | case wxSWISS: return _T("wxSWISS"); | |
81 | case wxMODERN: return _T("wxMODERN"); | |
82 | case wxTELETYPE: return _T("wxTELETYPE"); | |
83 | default: return _T("wxDEFAULT"); | |
84 | } | |
85 | } | |
86 | ||
87 | wxString wxFontBase::GetStyleString() const | |
88 | { | |
89 | wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); | |
90 | ||
91 | switch ( GetStyle() ) | |
92 | { | |
93 | case wxNORMAL: return _T("wxNORMAL"); | |
94 | case wxSLANT: return _T("wxSLANT"); | |
95 | case wxITALIC: return _T("wxITALIC"); | |
96 | default: return _T("wxDEFAULT"); | |
97 | } | |
98 | } | |
99 | ||
100 | wxString wxFontBase::GetWeightString() const | |
101 | { | |
102 | wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); | |
103 | ||
104 | switch ( GetWeight() ) | |
105 | { | |
106 | case wxNORMAL: return _T("wxNORMAL"); | |
107 | case wxBOLD: return _T("wxBOLD"); | |
108 | case wxLIGHT: return _T("wxLIGHT"); | |
109 | default: return _T("wxDEFAULT"); | |
110 | } | |
111 | } | |
112 |