]> git.saurik.com Git - wxWidgets.git/blame_incremental - interface/wx/fontenum.h
Don't specialize std::numeric_limits<> for wxLongLong when using VC6.
[wxWidgets.git] / interface / wx / fontenum.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: fontenum.h
3// Purpose: interface of wxFontEnumerator
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxFontEnumerator
11
12 wxFontEnumerator enumerates either all available fonts on the system or only
13 the ones with given attributes - either only fixed-width (suited for use in
14 programs such as terminal emulators and the like) or the fonts available in
15 the given encoding).
16
17 To do this, you just have to call one of EnumerateXXX() functions - either
18 wxFontEnumerator::EnumerateFacenames() or wxFontEnumerator::EnumerateEncodings()
19 and the corresponding callback (wxFontEnumerator::OnFacename() or
20 wxFontEnumerator::OnFontEncoding()) will be called repeatedly until either
21 all fonts satisfying the specified criteria are exhausted or the callback
22 returns @false.
23
24 @section fontenum_virtual Virtual functions to override
25
26 Either OnFacename or OnFontEncoding should be overridden depending on
27 whether you plan to call EnumerateFacenames or EnumerateEncodings.
28 Of course, if you call both of them, you should override both functions.
29
30 @library{wxcore}
31 @category{gdi}
32
33 @see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
34*/
35class wxFontEnumerator
36{
37public:
38 /**
39 Call OnFontEncoding() for each encoding supported by the given font -
40 or for each encoding supported by at least some font if @a font is not specified.
41 */
42 virtual bool EnumerateEncodings(const wxString& font = wxEmptyString);
43
44 /**
45 Call OnFacename() for each font which supports given encoding (only if
46 it is not @c wxFONTENCODING_SYSTEM) and is of fixed width
47 (if @a fixedWidthOnly is @true).
48
49 Calling this function with default arguments will result in enumerating all
50 fonts available on the system.
51 */
52 virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
53 bool fixedWidthOnly = false);
54
55 /**
56 Return array of strings containing all encodings found by
57 EnumerateEncodings().
58 */
59 static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
60
61 /**
62 Return array of strings containing all facenames found by
63 EnumerateFacenames().
64 */
65 static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
66 bool fixedWidthOnly = false);
67
68 /**
69 Returns @true if the given string is valid face name, i.e. it's the face name
70 of an installed font and it can safely be used with wxFont::SetFaceName.
71 */
72 static bool IsValidFacename(const wxString& facename);
73
74 /**
75 Called by EnumerateFacenames() for each match.
76
77 Return @true to continue enumeration or @false to stop it.
78 */
79 virtual bool OnFacename(const wxString& font);
80
81 /**
82 Called by EnumerateEncodings() for each match.
83
84 Return @true to continue enumeration or @false to stop it.
85 */
86 virtual bool OnFontEncoding(const wxString& font,
87 const wxString& encoding);
88};
89