]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fontenum.h
58218c892db4a988b8ccf9c58d7f686dd2882a52
[wxWidgets.git] / include / wx / fontenum.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fontenum.h
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)
7 // Created: 04/01/98
8 // RCS-ID: $Id$
9 // Copyright: (c) Julian Smart, Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_FONTENUM_H_
14 #define _WX_FONTENUM_H_
15
16 #include "wx/fontenc.h"
17 #include "wx/arrstr.h"
18
19 // ----------------------------------------------------------------------------
20 // wxFontEnumerator enumerates all available fonts on the system or only the
21 // fonts with given attributes
22 // ----------------------------------------------------------------------------
23
24 class WXDLLEXPORT wxFontEnumerator
25 {
26 public:
27 wxFontEnumerator() {}
28
29 // virtual dtor for the base class
30 virtual ~wxFontEnumerator() {}
31
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
37 (
38 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
39 bool fixedWidthOnly = false
40 );
41
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);
46
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
50
51 // called by EnumerateFacenames
52 virtual bool OnFacename(const wxString& WXUNUSED(facename))
53 { return true; }
54
55 // called by EnumerateEncodings
56 virtual bool OnFontEncoding(const wxString& WXUNUSED(facename),
57 const wxString& WXUNUSED(encoding))
58 { return true; }
59
60
61
62 // convenience function that returns array of facenames.
63 static wxArrayString
64 GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
65 bool fixedWidthOnly = false);
66
67 // convenience function that returns array of all available encodings.
68 static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
69
70 private:
71 DECLARE_NO_COPY_CLASS(wxFontEnumerator)
72 };
73
74 #endif // _WX_FONTENUM_H_