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