]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fontenum.h
Add lambda-friendly wxDialog::ShowWindowModalThenDo().
[wxWidgets.git] / include / wx / fontenum.h
CommitLineData
ddc8c2e3 1/////////////////////////////////////////////////////////////////////////////
dd74a8f6 2// Name: wx/fontenum.h
ddc8c2e3
VZ
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 7// Created: 04/01/98
ddc8c2e3 8// Copyright: (c) Julian Smart, Vadim Zeitlin
65571936 9// Licence: wxWindows licence
ddc8c2e3
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONTENUM_H_
13#define _WX_FONTENUM_H_
14
ff427585
VZ
15#include "wx/defs.h"
16
17#if wxUSE_FONTENUM
18
c3d15542 19#include "wx/fontenc.h"
a6abcf2e 20#include "wx/arrstr.h"
c3d15542 21
ddc8c2e3
VZ
22// ----------------------------------------------------------------------------
23// wxFontEnumerator enumerates all available fonts on the system or only the
24// fonts with given attributes
25// ----------------------------------------------------------------------------
26
53a2db12 27class WXDLLIMPEXP_CORE wxFontEnumerator
ddc8c2e3
VZ
28{
29public:
6540132f
VZ
30 wxFontEnumerator() {}
31
32 // virtual dtor for the base class
33 virtual ~wxFontEnumerator() {}
435151d7 34
3c1866e8
VZ
35 // start enumerating font facenames (either all of them or those which
36 // support the given encoding) - will result in OnFacename() being
37 // called for each available facename (until they are exhausted or
dabbc6a5 38 // OnFacename returns false)
3c1866e8 39 virtual bool EnumerateFacenames
36f210c8
VZ
40 (
41 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
dabbc6a5 42 bool fixedWidthOnly = false
36f210c8 43 );
ddc8c2e3 44
3c1866e8
VZ
45 // enumerate the different encodings either for given font facename or for
46 // all facenames - will result in OnFontEncoding() being called for each
47 // available (facename, encoding) couple
fda7962d 48 virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString);
ddc8c2e3
VZ
49
50 // callbacks which are called after one of EnumerateXXX() functions from
dabbc6a5
DS
51 // above is invoked - all of them may return false to stop enumeration or
52 // true to continue with it
ddc8c2e3 53
3c1866e8 54 // called by EnumerateFacenames
6540132f
VZ
55 virtual bool OnFacename(const wxString& WXUNUSED(facename))
56 { return true; }
ddc8c2e3
VZ
57
58 // called by EnumerateEncodings
3c1866e8 59 virtual bool OnFontEncoding(const wxString& WXUNUSED(facename),
6540132f
VZ
60 const wxString& WXUNUSED(encoding))
61 { return true; }
dabbc6a5 62
dabbc6a5 63
22f3361e 64
6540132f
VZ
65 // convenience function that returns array of facenames.
66 static wxArrayString
67 GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
68 bool fixedWidthOnly = false);
69
70 // convenience function that returns array of all available encodings.
71 static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
72
85ab460e
VZ
73 // convenience function that returns true if the given face name exist
74 // in the user's system
75 static bool IsValidFacename(const wxString &str);
76
6540132f 77private:
4e1d79d3
VS
78#ifdef wxHAS_UTF8_FONTS
79 // helper for ports that only use UTF-8 encoding natively
80 bool EnumerateEncodingsUTF8(const wxString& facename);
81#endif
82
c0c133e1 83 wxDECLARE_NO_COPY_CLASS(wxFontEnumerator);
ddc8c2e3
VZ
84};
85
ff427585
VZ
86#endif // wxUSE_FONTENUM
87
ddc8c2e3 88#endif // _WX_FONTENUM_H_