]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontenum.h
general docview.cpp code cleanup; use wxVector<> instead of manually-allocated arrays...
[wxWidgets.git] / interface / wx / 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
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
15 the given encoding().
16
17 To do this, you just have to call one of EnumerateXXX() functions - either
18 wxFontEnumerator::EnumerateFacenames or
19 wxFontEnumerator::EnumerateEncodings and the
20 corresponding callback (wxFontEnumerator::OnFacename or
21 wxFontEnumerator::OnFontEncoding) will be called
22 repeatedly until either all fonts satisfying the specified criteria are
23 exhausted or the callback returns @false.
24
25 @library{wxcore}
26 @category{FIXME}
27
28 @see @ref overview_wxfontencodingoverview, @ref overview_samplefont "Font
29 sample", wxFont, wxFontMapper
30 */
31 class wxFontEnumerator
32 {
33 public:
34 /**
35 Call OnFontEncoding() for each
36 encoding supported by the given font - or for each encoding supported by at
37 least some font if @a font is not specified.
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
44 fixed width (if @a fixedWidthOnly is @true).
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,
49 bool fixedWidthOnly = false);
50
51 /**
52 Return array of strings containing all encodings found by
53 EnumerateEncodings().
54 */
55 static wxArrayString GetEncodings(const wxString& facename = "");
56
57 /**
58 Return array of strings containing all facenames found by
59 EnumerateFacenames().
60 */
61 static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
62 bool fixedWidthOnly = false);
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 */
69 static bool IsValidFacename(const wxString& facename);
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 };
84