]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fontenum.h
Compile fix for wxFileName.
[wxWidgets.git] / include / wx / fontenum.h
CommitLineData
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
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_FONTENUM_H_
14#define _WX_FONTENUM_H_
15
16#ifdef __GNUG__
17 #pragma interface "fontenum.h"
18#endif
19
7beba2fc
VZ
20#include "wx/font.h"
21
ddc8c2e3
VZ
22// ----------------------------------------------------------------------------
23// wxFontEnumerator enumerates all available fonts on the system or only the
24// fonts with given attributes
25// ----------------------------------------------------------------------------
26
d111a89a 27class WXDLLEXPORT wxFontEnumerator
ddc8c2e3
VZ
28{
29public:
435151d7
VS
30 wxFontEnumerator() : m_Facenames(NULL), m_Encodings(NULL) { }
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
35 // OnFacename returns FALSE)
36 virtual bool EnumerateFacenames
36f210c8
VZ
37 (
38 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
39 bool fixedWidthOnly = FALSE
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
45 virtual bool EnumerateEncodings(const wxString& facename = wxT(""));
ddc8c2e3
VZ
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
3c1866e8 51 // called by EnumerateFacenames
435151d7
VS
52 virtual bool OnFacename(const wxString& facename)
53 {
54 if (m_Facenames == NULL) m_Facenames = new wxArrayString;
55 m_Facenames -> Add(facename);
56 return TRUE;
57 }
ddc8c2e3
VZ
58
59 // called by EnumerateEncodings
3c1866e8 60 virtual bool OnFontEncoding(const wxString& WXUNUSED(facename),
435151d7
VS
61 const wxString& encoding)
62 {
63 if (m_Encodings == NULL) m_Encodings = new wxArrayString;
64 m_Encodings -> Add(encoding);
65 return TRUE;
66 }
67
68 // convenience function that returns array of facenames. Cannot be called
69 // before EnumerateFacenames.
70 wxArrayString *GetFacenames()
71 { return m_Facenames; }
36f210c8 72
435151d7
VS
73 // convenience function that returns array of encodings.
74 // Cannot be called before EnumerateEncodings.
75 wxArrayString *GetEncodings()
76 { return m_Encodings; }
77
36f210c8 78 // virtual dtor for the base class
435151d7
VS
79 virtual ~wxFontEnumerator()
80 {
81 if (m_Facenames) delete m_Facenames;
82 if (m_Encodings) delete m_Encodings;
83 }
84
85private:
86 wxArrayString *m_Facenames, *m_Encodings;
ddc8c2e3
VZ
87};
88
89#endif // _WX_FONTENUM_H_