]>
Commit | Line | Data |
---|---|---|
ddc8c2e3 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: fontenum.h | |
3 | // Purpose: wxFontEnumerator class for getting available fonts | |
4 | // Author: Julian Smart, Vadim Zeitlin | |
3c1866e8 VZ |
5 | // Modified by: extended to enumerate more than just font facenames and works |
6 | // not only on Windows now (VZ) | |
ddc8c2e3 VZ |
7 | // Created: 04/01/98 |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Julian Smart, Vadim Zeitlin | |
65571936 | 10 | // Licence: wxWindows licence |
ddc8c2e3 VZ |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _WX_FONTENUM_H_ | |
14 | #define _WX_FONTENUM_H_ | |
15 | ||
c3d15542 | 16 | #include "wx/fontenc.h" |
a6abcf2e | 17 | #include "wx/arrstr.h" |
c3d15542 | 18 | |
ddc8c2e3 VZ |
19 | // ---------------------------------------------------------------------------- |
20 | // wxFontEnumerator enumerates all available fonts on the system or only the | |
21 | // fonts with given attributes | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
d111a89a | 24 | class WXDLLEXPORT wxFontEnumerator |
ddc8c2e3 VZ |
25 | { |
26 | public: | |
6540132f VZ |
27 | wxFontEnumerator() {} |
28 | ||
29 | // virtual dtor for the base class | |
30 | virtual ~wxFontEnumerator() {} | |
435151d7 | 31 | |
3c1866e8 VZ |
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 | |
dabbc6a5 | 35 | // OnFacename returns false) |
3c1866e8 | 36 | virtual bool EnumerateFacenames |
36f210c8 VZ |
37 | ( |
38 | wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all | |
dabbc6a5 | 39 | bool fixedWidthOnly = false |
36f210c8 | 40 | ); |
ddc8c2e3 | 41 | |
3c1866e8 VZ |
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 | |
fda7962d | 45 | virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString); |
ddc8c2e3 VZ |
46 | |
47 | // callbacks which are called after one of EnumerateXXX() functions from | |
dabbc6a5 DS |
48 | // above is invoked - all of them may return false to stop enumeration or |
49 | // true to continue with it | |
ddc8c2e3 | 50 | |
3c1866e8 | 51 | // called by EnumerateFacenames |
6540132f VZ |
52 | virtual bool OnFacename(const wxString& WXUNUSED(facename)) |
53 | { return true; } | |
ddc8c2e3 VZ |
54 | |
55 | // called by EnumerateEncodings | |
3c1866e8 | 56 | virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), |
6540132f VZ |
57 | const wxString& WXUNUSED(encoding)) |
58 | { return true; } | |
dabbc6a5 | 59 | |
dabbc6a5 | 60 | |
22f3361e | 61 | |
6540132f VZ |
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: | |
22f3361e | 71 | DECLARE_NO_COPY_CLASS(wxFontEnumerator) |
ddc8c2e3 VZ |
72 | }; |
73 | ||
74 | #endif // _WX_FONTENUM_H_ |