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