]> git.saurik.com Git - wxWidgets.git/blob - include/wx/font.h
Added missing costructor
[wxWidgets.git] / include / wx / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/font.h
3 // Purpose: wxFontBase class: the interface of wxFont
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 #ifndef _WX_FONT_H_BASE_
13 #define _WX_FONT_H_BASE_
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/defs.h" // for wxDEFAULT &c
20 #include "wx/gdiobj.h" // the base class
21
22 // ----------------------------------------------------------------------------
23 // forward declarations
24 // ----------------------------------------------------------------------------
25
26 class WXDLLEXPORT wxFontBase;
27 class WXDLLEXPORT wxFont;
28
29 // ----------------------------------------------------------------------------
30 // font constants
31 // ----------------------------------------------------------------------------
32
33 // standard font families
34 enum wxFontFamily
35 {
36 wxFONTFAMILY_DEFAULT = wxDEFAULT,
37 wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
38 wxFONTFAMILY_ROMAN = wxROMAN,
39 wxFONTFAMILY_SCRIPT = wxSCRIPT,
40 wxFONTFAMILY_SWISS = wxSWISS,
41 wxFONTFAMILY_MODERN = wxMODERN,
42 wxFONTFAMILY_TELETYPE = wxTELETYPE,
43 wxFONTFAMILY_MAX
44 };
45
46 // font styles
47 enum wxFontStyle
48 {
49 wxFONTSTYLE_NORMAL = wxNORMAL,
50 wxFONTSTYLE_ITALIC = wxITALIC,
51 wxFONTSTYLE_SLANT = wxSLANT,
52 wxFONTSTYLE_MAX
53 };
54
55 // font weights
56 enum wxFontWeight
57 {
58 wxFONTWEIGHT_NORMAL = wxNORMAL,
59 wxFONTWEIGHT_LIGHT = wxLIGHT,
60 wxFONTWEIGHT_BOLD = wxBOLD,
61 wxFONTWEIGHT_MAX
62 };
63
64 // font encodings
65 enum wxFontEncoding
66 {
67 wxFONTENCODING_SYSTEM = -1, // system default
68 wxFONTENCODING_DEFAULT, // current default encoding
69
70 // ISO8859 standard defines a number of single-byte charsets
71 wxFONTENCODING_ISO8859_1, // West European (Latin1)
72 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
73 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
74 wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4)
75 wxFONTENCODING_ISO8859_5, // Cyrillic
76 wxFONTENCODING_ISO8859_6, // Arabic
77 wxFONTENCODING_ISO8859_7, // Greek
78 wxFONTENCODING_ISO8859_8, // Hebrew
79 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
80 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
81 wxFONTENCODING_ISO8859_11, // Thai
82 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
83 // here anyhow to make all ISO8859
84 // consecutive numbers
85 wxFONTENCODING_ISO8859_13, // Latin7
86 wxFONTENCODING_ISO8859_14, // Latin8
87 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
88
89 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
90 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
91 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
92 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
93
94 // what would we do without Microsoft? They have their own encodings
95 // for DOS
96 wxFONTENCODING_CP437, // original MS-DOS codepage
97 wxFONTENCODING_CP850, // CP437 merged with Latin1
98 wxFONTENCODING_CP852, // CP437 merged with Latin2
99 wxFONTENCODING_CP855, // another cyrillic encoding
100 wxFONTENCODING_CP866, // and another one
101 // and for Windows
102 wxFONTENCODING_CP1250, // WinLatin2
103 wxFONTENCODING_CP1251, // WinCyrillic
104 wxFONTENCODING_CP1252, // WinLatin1
105
106 wxFONTENCODING_MAX
107 };
108
109 // ----------------------------------------------------------------------------
110 // wxFontBase represents a font object
111 // ----------------------------------------------------------------------------
112
113 class wxFontBase : public wxGDIObject
114 {
115 public:
116 // creator function
117 static wxFont *New(
118 int pointSize, // size of the font in points
119 int family, // see wxFontFamily enum
120 int style, // see wxFontStyle enum
121 int weight, // see wxFontWeight enum
122 bool underlined = FALSE, // not underlined by default
123 const wxString& face = wxEmptyString, // facename
124 wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
125
126 // was the font successfully created?
127 bool Ok() const { return m_refData != NULL; }
128
129 // comparison
130 bool operator == (const wxFont& font) const;
131 bool operator != (const wxFont& font) const;
132
133 // accessors: get the font characteristics
134 virtual int GetPointSize() const = 0;
135 virtual int GetFamily() const = 0;
136 virtual int GetStyle() const = 0;
137 virtual int GetWeight() const = 0;
138 virtual bool GetUnderlined() const = 0;
139 virtual wxString GetFaceName() const = 0;
140 virtual wxFontEncoding GetEncoding() const = 0;
141
142 // change the font characteristics
143 virtual void SetPointSize( int pointSize ) = 0;
144 virtual void SetFamily( int family ) = 0;
145 virtual void SetStyle( int style ) = 0;
146 virtual void SetWeight( int weight ) = 0;
147 virtual void SetFaceName( const wxString& faceName ) = 0;
148 virtual void SetUnderlined( bool underlined ) = 0;
149 virtual void SetEncoding(wxFontEncoding encoding) = 0;
150
151 // translate the fonts into human-readable string (i.e. GetStyleString()
152 // will return "wxITALIC" for an italic font, ...)
153 wxString GetFamilyString() const;
154 wxString GetStyleString() const;
155 wxString GetWeightString() const;
156
157 // the default encoding is used for creating all fonts with default
158 // encoding parameter
159 static wxFontEncoding GetDefaultEncoding()
160 { return ms_encodingDefault; }
161 static void SetDefaultEncoding(wxFontEncoding encoding)
162 { ms_encodingDefault = encoding; }
163
164 protected:
165 // get the internal data
166 class WXDLLEXPORT wxFontRefData *GetFontData() const
167 { return (wxFontRefData *)m_refData; }
168
169 private:
170 // the currently default encoding: by default, it's the default system
171 // encoding, but may be changed by the application using
172 // SetDefaultEncoding() to make all subsequent fonts created without
173 // specifing encoding parameter using this encoding
174 static wxFontEncoding ms_encodingDefault;
175 };
176
177 // include the real class declaration
178 #if defined(__WXMSW__)
179 #include "wx/msw/font.h"
180 #elif defined(__WXMOTIF__)
181 #include "wx/motif/font.h"
182 #elif defined(__WXGTK__)
183 #include "wx/gtk/font.h"
184 #elif defined(__WXQT__)
185 #include "wx/qt/font.h"
186 #elif defined(__WXMAC__)
187 #include "wx/mac/font.h"
188 #elif defined(__WXPM__)
189 #include "wx/os2/font.h"
190 #elif defined(__WXSTUBS__)
191 #include "wx/stubs/font.h"
192 #endif
193
194 // ----------------------------------------------------------------------------
195 // macros
196 // ----------------------------------------------------------------------------
197
198 #define M_FONTDATA GetFontData()
199
200 #endif
201 // _WX_FONT_H_BASE_