]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/fontenum.h
Somehow, setting a tint color makes gauge work :/.
[wxWidgets.git] / interface / wx / fontenum.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: fontenum.h
e54c96f1 3// Purpose: interface of wxFontEnumerator
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxFontEnumerator
7c913512 10
23324ae1
FM
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
0b70c946 14 the given encoding).
7c913512
FM
15
16 To do this, you just have to call one of EnumerateXXX() functions - either
0b70c946
FM
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.
7c913512 28
23324ae1 29 @library{wxcore}
0b70c946 30 @category{gdi}
7c913512 31
674d80a7 32 @see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
23324ae1 33*/
7c913512 34class wxFontEnumerator
23324ae1
FM
35{
36public:
e1b7217e
RD
37 wxFontEnumerator();
38 virtual ~wxFontEnumerator();
39
23324ae1 40 /**
0b70c946
FM
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.
23324ae1 43 */
43c48e1e 44 virtual bool EnumerateEncodings(const wxString& font = wxEmptyString);
23324ae1
FM
45
46 /**
0b70c946
FM
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
23324ae1
FM
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,
4cc4bfaf 55 bool fixedWidthOnly = false);
23324ae1
FM
56
57 /**
7c913512 58 Return array of strings containing all encodings found by
23324ae1
FM
59 EnumerateEncodings().
60 */
e9c3992c 61 static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
23324ae1
FM
62
63 /**
7c913512 64 Return array of strings containing all facenames found by
23324ae1
FM
65 EnumerateFacenames().
66 */
67 static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
4cc4bfaf 68 bool fixedWidthOnly = false);
23324ae1
FM
69
70 /**
71 Returns @true if the given string is valid face name, i.e. it's the face name
0b70c946 72 of an installed font and it can safely be used with wxFont::SetFaceName.
23324ae1 73 */
4cc4bfaf 74 static bool IsValidFacename(const wxString& facename);
23324ae1
FM
75
76 /**
0b70c946
FM
77 Called by EnumerateFacenames() for each match.
78
79 Return @true to continue enumeration or @false to stop it.
23324ae1
FM
80 */
81 virtual bool OnFacename(const wxString& font);
82
83 /**
0b70c946
FM
84 Called by EnumerateEncodings() for each match.
85
86 Return @true to continue enumeration or @false to stop it.
23324ae1
FM
87 */
88 virtual bool OnFontEncoding(const wxString& font,
89 const wxString& encoding);
90};
e54c96f1 91