File/dir dialog styles and other changes (patch 1488371):
[wxWidgets.git] / src / common / fontenumcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/fontenumcmn.cpp
3 // Purpose: wxFontEnumerator class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 7/5/2006
7 // RCS-ID: $Id$
8 // Copyright: (c) 1999-2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #include "wx/fontenum.h"
28
29 // ============================================================================
30 // implementation
31 // ============================================================================
32
33 // A simple wxFontEnumerator which doesn't perform any filtering and
34 // just returns all facenames and encodings found in the system
35 class WXDLLEXPORT wxSimpleFontEnumerator : public wxFontEnumerator
36 {
37 public:
38 wxSimpleFontEnumerator() { }
39
40 // called by EnumerateFacenames
41 virtual bool OnFacename(const wxString& facename)
42 {
43 m_arrFacenames.Add(facename);
44 return true;
45 }
46
47 // called by EnumerateEncodings
48 virtual bool OnFontEncoding(const wxString& WXUNUSED(facename),
49 const wxString& encoding)
50 {
51 m_arrEncodings.Add(encoding);
52 return true;
53 }
54
55 public:
56 wxArrayString m_arrFacenames, m_arrEncodings;
57 };
58
59
60 /* static */
61 wxArrayString wxFontEnumerator::GetFacenames(wxFontEncoding encoding, bool fixedWidthOnly)
62 {
63 wxSimpleFontEnumerator temp;
64 temp.EnumerateFacenames(encoding, fixedWidthOnly);
65 return temp.m_arrFacenames;
66 }
67
68 /* static */
69 wxArrayString wxFontEnumerator::GetEncodings(const wxString& facename)
70 {
71 wxSimpleFontEnumerator temp;
72 temp.EnumerateEncodings(facename);
73 return temp.m_arrEncodings;
74 }