Remove obsolete VisualAge-related files.
[wxWidgets.git] / interface / wx / fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fontenum.h
3 // Purpose: interface of wxFontEnumerator
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxFontEnumerator
10
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
14 the given encoding).
15
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
21 returns @false.
22
23 @section fontenum_virtual Virtual functions to override
24
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.
28
29 @library{wxcore}
30 @category{gdi}
31
32 @see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
33 */
34 class wxFontEnumerator
35 {
36 public:
37 wxFontEnumerator();
38 virtual ~wxFontEnumerator();
39
40 /**
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.
43 */
44 virtual bool EnumerateEncodings(const wxString& font = wxEmptyString);
45
46 /**
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).
50
51 Calling this function with default arguments will result in enumerating all
52 fonts available on the system.
53 */
54 virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
55 bool fixedWidthOnly = false);
56
57 /**
58 Return array of strings containing all encodings found by
59 EnumerateEncodings().
60 */
61 static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
62
63 /**
64 Return array of strings containing all facenames found by
65 EnumerateFacenames().
66 */
67 static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
68 bool fixedWidthOnly = false);
69
70 /**
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.
73 */
74 static bool IsValidFacename(const wxString& facename);
75
76 /**
77 Called by EnumerateFacenames() for each match.
78
79 Return @true to continue enumeration or @false to stop it.
80 */
81 virtual bool OnFacename(const wxString& font);
82
83 /**
84 Called by EnumerateEncodings() for each match.
85
86 Return @true to continue enumeration or @false to stop it.
87 */
88 virtual bool OnFontEncoding(const wxString& font,
89 const wxString& encoding);
90 };
91