]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontmap.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxFontMapper
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 wxFontMapper manages user-definable correspondence between logical font
13 names and the fonts present on the machine.
15 The default implementations of all functions will ask the user if they are
16 not capable of finding the answer themselves and store the answer in a
17 config file (configurable via SetConfigXXX functions). This behaviour may
18 be disabled by giving the value of @false to "interactive" parameter.
20 However, the functions will always consult the config file to allow the
21 user-defined values override the default logic and there is no way to
22 disable this - which shouldn't be ever needed because if "interactive" was
23 never @true, the config file is never created anyhow.
25 In case everything else fails (i.e. there is no record in config file
26 and "interactive" is @false or user denied to choose any replacement),
27 the class queries wxEncodingConverter
28 for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
33 @see wxEncodingConverter, @ref overview_nonenglishoverview "Writing non-English
45 Virtual dtor for a base class.
50 Returns the encoding for the given charset (in the form of RFC 2046) or
51 @c wxFONTENCODING_SYSTEM if couldn't decode it.
52 Be careful when using this function with @a interactive set to @true
53 (default value) as the function then may show a dialog box to the user which
54 may lead to unexpected reentrancies and may also take a significantly longer
55 time than a simple function call. For these reasons, it is almost always a bad
56 idea to call this function from the event handlers for repeatedly generated
57 events such as @c EVT_PAINT.
59 wxFontEncoding
CharsetToEncoding(const wxString
& charset
,
60 bool interactive
= true);
63 Get the current font mapper object. If there is no current object, creates
68 static wxFontMapper
* Get();
71 Returns the array of all possible names for the given encoding. The array is
72 @NULL-terminated. IF it isn't empty, the first name in it is the canonical
73 encoding name, i.e. the same string as returned by
76 static const wxChar
** GetAllEncodingNames(wxFontEncoding encoding
);
80 Find an alternative for the given encoding (which is supposed to not be
81 available on this system). If successful, return @true and fill info
82 structure with the parameters required to create the font, otherwise
84 The first form is for wxWidgets' internal use while the second one
85 is better suitable for general use -- it returns wxFontEncoding which
86 can consequently be passed to wxFont constructor.
88 bool GetAltForEncoding(wxFontEncoding encoding
,
89 wxNativeEncodingInfo
* info
,
90 const wxString
& facename
= wxEmptyString
,
91 bool interactive
= true);
92 bool GetAltForEncoding(wxFontEncoding encoding
,
93 wxFontEncoding
* alt_encoding
,
94 const wxString
& facename
= wxEmptyString
,
95 bool interactive
= true);
99 Returns the @e n-th supported encoding. Together with
100 GetSupportedEncodingsCount()
101 this method may be used to get all supported encodings.
103 static wxFontEncoding
GetEncoding(size_t n
);
106 Return user-readable string describing the given encoding.
108 static wxString
GetEncodingDescription(wxFontEncoding encoding
);
111 Return the encoding corresponding to the given internal name. This function is
112 the inverse of GetEncodingName() and is
113 intentionally less general than
114 CharsetToEncoding(), i.e. it doesn't
115 try to make any guesses nor ever asks the user. It is meant just as a way of
116 restoring objects previously serialized using
119 static wxFontEncoding
GetEncodingFromName(const wxString
& encoding
);
122 Return internal string identifier for the encoding (see also
123 wxFontMapper::GetEncodingDescription)
125 @see GetEncodingFromName()
127 static wxString
GetEncodingName(wxFontEncoding encoding
);
130 Returns the number of the font encodings supported by this class. Together with
131 GetEncoding() this method may be used to get
132 all supported encodings.
134 static size_t GetSupportedEncodingsCount();
137 Check whether given encoding is available in given face or not.
138 If no facename is given, find @e any font in this encoding.
140 bool IsEncodingAvailable(wxFontEncoding encoding
,
141 const wxString
& facename
= wxEmptyString
);
144 Set the current font mapper object and return previous one (may be @NULL).
145 This method is only useful if you want to plug-in an alternative font mapper
150 static wxFontMapper
* Set(wxFontMapper
* mapper
);
153 Set the config object to use (may be @NULL to use default).
154 By default, the global one (from wxConfigBase::Get() will be used)
155 and the default root path for the config settings is the string returned by
156 GetDefaultConfigPath().
158 void SetConfig(wxConfigBase
* config
);
161 Set the root config path to use (should be an absolute path).
163 void SetConfigPath(const wxString
& prefix
);
166 The parent window for modal dialogs.
168 void SetDialogParent(wxWindow
* parent
);
171 The title for the dialogs (note that default is quite reasonable).
173 void SetDialogTitle(const wxString
& title
);