1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFontEnumerator class for getting available fonts
4 // Author: Julian Smart, Vadim Zeitlin
5 // Modified by: extended to enumerate more than just font facenames and works
6 // not only on Windows now (VZ)
9 // Copyright: (c) Julian Smart, Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_FONTENUM_H_
14 #define _WX_FONTENUM_H_
16 #include "wx/fontenc.h"
17 #include "wx/arrstr.h"
19 // ----------------------------------------------------------------------------
20 // wxFontEnumerator enumerates all available fonts on the system or only the
21 // fonts with given attributes
22 // ----------------------------------------------------------------------------
24 class WXDLLEXPORT wxFontEnumerator
29 // virtual dtor for the base class
30 virtual ~wxFontEnumerator() {}
32 // start enumerating font facenames (either all of them or those which
33 // support the given encoding) - will result in OnFacename() being
34 // called for each available facename (until they are exhausted or
35 // OnFacename returns false)
36 virtual bool EnumerateFacenames
38 wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
, // all
39 bool fixedWidthOnly
= false
42 // enumerate the different encodings either for given font facename or for
43 // all facenames - will result in OnFontEncoding() being called for each
44 // available (facename, encoding) couple
45 virtual bool EnumerateEncodings(const wxString
& facename
= wxEmptyString
);
47 // callbacks which are called after one of EnumerateXXX() functions from
48 // above is invoked - all of them may return false to stop enumeration or
49 // true to continue with it
51 // called by EnumerateFacenames
52 virtual bool OnFacename(const wxString
& WXUNUSED(facename
))
55 // called by EnumerateEncodings
56 virtual bool OnFontEncoding(const wxString
& WXUNUSED(facename
),
57 const wxString
& WXUNUSED(encoding
))
62 // convenience function that returns array of facenames.
64 GetFacenames(wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
, // all
65 bool fixedWidthOnly
= false);
67 // convenience function that returns array of all available encodings.
68 static wxArrayString
GetEncodings(const wxString
& facename
= wxEmptyString
);
70 // convenience function that returns true if the given face name exist
71 // in the user's system
72 static bool IsValidFacename(const wxString
&str
);
75 DECLARE_NO_COPY_CLASS(wxFontEnumerator
)
78 #endif // _WX_FONTENUM_H_