]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxFontEnumerator
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 @class wxFontEnumerator
11 wxFontEnumerator enumerates either all available fonts on the system or only
12 the ones with given attributes - either only fixed-width (suited for use in
13 programs such as terminal emulators and the like) or the fonts available in
16 To do this, you just have to call one of EnumerateXXX() functions - either
17 wxFontEnumerator::EnumerateFacenames() or wxFontEnumerator::EnumerateEncodings()
18 and the corresponding callback (wxFontEnumerator::OnFacename() or
19 wxFontEnumerator::OnFontEncoding()) will be called repeatedly until either
20 all fonts satisfying the specified criteria are exhausted or the callback
23 @section fontenum_virtual Virtual functions to override
25 Either OnFacename or OnFontEncoding should be overridden depending on
26 whether you plan to call EnumerateFacenames or EnumerateEncodings.
27 Of course, if you call both of them, you should override both functions.
32 @see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
34 class wxFontEnumerator
38 virtual ~wxFontEnumerator();
41 Call OnFontEncoding() for each encoding supported by the given font -
42 or for each encoding supported by at least some font if @a font is not specified.
44 virtual bool EnumerateEncodings(const wxString
& font
= wxEmptyString
);
47 Call OnFacename() for each font which supports given encoding (only if
48 it is not @c wxFONTENCODING_SYSTEM) and is of fixed width
49 (if @a fixedWidthOnly is @true).
51 Calling this function with default arguments will result in enumerating all
52 fonts available on the system.
54 virtual bool EnumerateFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
55 bool fixedWidthOnly
= false);
58 Return array of strings containing all encodings found by
61 static wxArrayString
GetEncodings(const wxString
& facename
= wxEmptyString
);
64 Return array of strings containing all facenames found by
67 static wxArrayString
GetFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
,
68 bool fixedWidthOnly
= false);
71 Returns @true if the given string is valid face name, i.e. it's the face name
72 of an installed font and it can safely be used with wxFont::SetFaceName.
74 static bool IsValidFacename(const wxString
& facename
);
77 Called by EnumerateFacenames() for each match.
79 Return @true to continue enumeration or @false to stop it.
81 virtual bool OnFacename(const wxString
& font
);
84 Called by EnumerateEncodings() for each match.
86 Return @true to continue enumeration or @false to stop it.
88 virtual bool OnFontEncoding(const wxString
& font
,
89 const wxString
& encoding
);