]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/fontenum.h
Allow wxPreferencesEditor::Dismiss() to work when using modal dialogs too.
[wxWidgets.git] / interface / wx / fontenum.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: fontenum.h
e54c96f1 3// Purpose: interface of wxFontEnumerator
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxFontEnumerator
7c913512 11
23324ae1
FM
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
0b70c946 15 the given encoding).
7c913512
FM
16
17 To do this, you just have to call one of EnumerateXXX() functions - either
0b70c946
FM
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.
7c913512 29
23324ae1 30 @library{wxcore}
0b70c946 31 @category{gdi}
7c913512 32
674d80a7 33 @see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
23324ae1 34*/
7c913512 35class wxFontEnumerator
23324ae1
FM
36{
37public:
e1b7217e
RD
38 wxFontEnumerator();
39 virtual ~wxFontEnumerator();
40
23324ae1 41 /**
0b70c946
FM
42 Call OnFontEncoding() for each encoding supported by the given font -
43 or for each encoding supported by at least some font if @a font is not specified.
23324ae1 44 */
43c48e1e 45 virtual bool EnumerateEncodings(const wxString& font = wxEmptyString);
23324ae1
FM
46
47 /**
0b70c946
FM
48 Call OnFacename() for each font which supports given encoding (only if
49 it is not @c wxFONTENCODING_SYSTEM) and is of fixed width
50 (if @a fixedWidthOnly is @true).
51
23324ae1
FM
52 Calling this function with default arguments will result in enumerating all
53 fonts available on the system.
54 */
55 virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
4cc4bfaf 56 bool fixedWidthOnly = false);
23324ae1
FM
57
58 /**
7c913512 59 Return array of strings containing all encodings found by
23324ae1
FM
60 EnumerateEncodings().
61 */
e9c3992c 62 static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
23324ae1
FM
63
64 /**
7c913512 65 Return array of strings containing all facenames found by
23324ae1
FM
66 EnumerateFacenames().
67 */
68 static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
4cc4bfaf 69 bool fixedWidthOnly = false);
23324ae1
FM
70
71 /**
72 Returns @true if the given string is valid face name, i.e. it's the face name
0b70c946 73 of an installed font and it can safely be used with wxFont::SetFaceName.
23324ae1 74 */
4cc4bfaf 75 static bool IsValidFacename(const wxString& facename);
23324ae1
FM
76
77 /**
0b70c946
FM
78 Called by EnumerateFacenames() for each match.
79
80 Return @true to continue enumeration or @false to stop it.
23324ae1
FM
81 */
82 virtual bool OnFacename(const wxString& font);
83
84 /**
0b70c946
FM
85 Called by EnumerateEncodings() for each match.
86
87 Return @true to continue enumeration or @false to stop it.
23324ae1
FM
88 */
89 virtual bool OnFontEncoding(const wxString& font,
90 const wxString& encoding);
91};
e54c96f1 92