]> git.saurik.com Git - wxWidgets.git/blob - interface/fontenum.h
further wxPenStyle/wxBrushStyle fixes for builds with compat off (partially by Marcin...
[wxWidgets.git] / interface / fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fontenum.h
3 // Purpose: interface of wxFontEnumerator
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxFontEnumerator
11 @wxheader{fontenum.h}
12
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
16 the given encoding().
17
18 To do this, you just have to call one of EnumerateXXX() functions - either
19 wxFontEnumerator::EnumerateFacenames or
20 wxFontEnumerator::EnumerateEncodings and the
21 corresponding callback (wxFontEnumerator::OnFacename or
22 wxFontEnumerator::OnFontEncoding) will be called
23 repeatedly until either all fonts satisfying the specified criteria are
24 exhausted or the callback returns @false.
25
26 @library{wxcore}
27 @category{FIXME}
28
29 @see @ref overview_wxfontencodingoverview, @ref overview_samplefont "Font
30 sample", wxFont, wxFontMapper
31 */
32 class wxFontEnumerator
33 {
34 public:
35 /**
36 Call OnFontEncoding() for each
37 encoding supported by the given font - or for each encoding supported by at
38 least some font if @a font is not specified.
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
45 fixed width (if @a fixedWidthOnly is @true).
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,
50 bool fixedWidthOnly = false);
51
52 /**
53 Return array of strings containing all encodings found by
54 EnumerateEncodings().
55 */
56 static wxArrayString GetEncodings(const wxString& facename = "");
57
58 /**
59 Return array of strings containing all facenames found by
60 EnumerateFacenames().
61 */
62 static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
63 bool fixedWidthOnly = false);
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 */
70 static bool IsValidFacename(const wxString& facename);
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 };
85