]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: fontenum.h | |
e54c96f1 | 3 | // Purpose: interface of wxFontEnumerator |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
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 | |
e54c96f1 | 15 | the given encoding(). |
7c913512 FM |
16 | |
17 | To do this, you just have to call one of EnumerateXXX() functions - either | |
18 | wxFontEnumerator::EnumerateFacenames or | |
23324ae1 | 19 | wxFontEnumerator::EnumerateEncodings and the |
7c913512 | 20 | corresponding callback (wxFontEnumerator::OnFacename or |
23324ae1 FM |
21 | wxFontEnumerator::OnFontEncoding) will be called |
22 | repeatedly until either all fonts satisfying the specified criteria are | |
23 | exhausted or the callback returns @false. | |
7c913512 | 24 | |
23324ae1 FM |
25 | @library{wxcore} |
26 | @category{FIXME} | |
7c913512 | 27 | |
e54c96f1 FM |
28 | @see @ref overview_wxfontencodingoverview, @ref overview_samplefont "Font |
29 | sample", wxFont, wxFontMapper | |
23324ae1 | 30 | */ |
7c913512 | 31 | class wxFontEnumerator |
23324ae1 FM |
32 | { |
33 | public: | |
34 | /** | |
35 | Call OnFontEncoding() for each | |
36 | encoding supported by the given font - or for each encoding supported by at | |
4cc4bfaf | 37 | least some font if @a font is not specified. |
23324ae1 FM |
38 | */ |
39 | virtual bool EnumerateEncodings(const wxString& font = ""); | |
40 | ||
41 | /** | |
42 | Call OnFacename() for each font which | |
43 | supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of | |
4cc4bfaf | 44 | fixed width (if @a fixedWidthOnly is @true). |
23324ae1 FM |
45 | Calling this function with default arguments will result in enumerating all |
46 | fonts available on the system. | |
47 | */ | |
48 | virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, | |
4cc4bfaf | 49 | bool fixedWidthOnly = false); |
23324ae1 FM |
50 | |
51 | /** | |
7c913512 | 52 | Return array of strings containing all encodings found by |
23324ae1 FM |
53 | EnumerateEncodings(). |
54 | */ | |
55 | static wxArrayString GetEncodings(const wxString& facename = ""); | |
56 | ||
57 | /** | |
7c913512 | 58 | Return array of strings containing all facenames found by |
23324ae1 FM |
59 | EnumerateFacenames(). |
60 | */ | |
61 | static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, | |
4cc4bfaf | 62 | bool fixedWidthOnly = false); |
23324ae1 FM |
63 | |
64 | /** | |
65 | Returns @true if the given string is valid face name, i.e. it's the face name | |
66 | of an installed | |
67 | font and it can safely be used with wxFont::SetFaceName. | |
68 | */ | |
4cc4bfaf | 69 | static bool IsValidFacename(const wxString& facename); |
23324ae1 FM |
70 | |
71 | /** | |
72 | Called by EnumerateFacenames() for | |
73 | each match. Return @true to continue enumeration or @false to stop it. | |
74 | */ | |
75 | virtual bool OnFacename(const wxString& font); | |
76 | ||
77 | /** | |
78 | Called by EnumerateEncodings() for | |
79 | each match. Return @true to continue enumeration or @false to stop it. | |
80 | */ | |
81 | virtual bool OnFontEncoding(const wxString& font, | |
82 | const wxString& encoding); | |
83 | }; | |
e54c96f1 | 84 |