1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/fontenum.cpp
3 // Purpose: wxFontEnumerator class for Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
31 #include "wx/encinfo.h"
34 #include "wx/palmos/private.h"
36 #include "wx/fontutil.h"
37 #include "wx/fontenum.h"
38 #include "wx/fontmap.h"
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 // the helper class which calls ::EnumFontFamilies() and whose OnFont() is
45 // called from the callback passed to this function and, in its turn, calls the
46 // appropariate wxFontEnumerator method
47 class wxFontEnumeratorHelper
50 wxFontEnumeratorHelper(wxFontEnumerator
*fontEnum
);
52 // control what exactly are we enumerating
53 // we enumerate fonts with given enocding
54 bool SetEncoding(wxFontEncoding encoding
);
55 // we enumerate fixed-width fonts
56 void SetFixedOnly(bool fixedOnly
) { m_fixedOnly
= fixedOnly
; }
57 // we enumerate the encodings available in this family
58 void SetFamily(const wxString
& family
);
60 // call to start enumeration
63 // called by our font enumeration proc
64 bool OnFont(const LPLOGFONT lf
, const LPTEXTMETRIC tm
) const;
67 // the object we forward calls to OnFont() to
68 wxFontEnumerator
*m_fontEnum
;
70 // if != -1, enum only fonts which have this encoding
73 // if not empty, enum only the fonts with this facename
76 // if not empty, enum only the fonts in this family
79 // if TRUE, enum only fixed fonts
82 // if TRUE, we enumerate the encodings, not fonts
85 // the list of charsets we already found while enumerating charsets
86 wxArrayInt m_charsets
;
88 // the list of facenames we already found while enumerating facenames
89 wxArrayString m_facenames
;
91 DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper
)
94 // ----------------------------------------------------------------------------
96 // ----------------------------------------------------------------------------
98 #ifndef __WXMICROWIN__
99 int CALLBACK
wxFontEnumeratorProc(LPLOGFONT lplf
, LPTEXTMETRIC lptm
,
100 DWORD dwStyle
, LONG lParam
);
103 // ============================================================================
105 // ============================================================================
107 // ----------------------------------------------------------------------------
108 // wxFontEnumeratorHelper
109 // ----------------------------------------------------------------------------
111 wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator
*fontEnum
)
115 void wxFontEnumeratorHelper::SetFamily(const wxString
& family
)
119 bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding
)
124 #define wxFONTENUMPROC FONTENUMPROC
126 void wxFontEnumeratorHelper::DoEnumerate()
130 bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf
,
131 const LPTEXTMETRIC tm
) const
136 // ----------------------------------------------------------------------------
138 // ----------------------------------------------------------------------------
140 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding
,
146 bool wxFontEnumerator::EnumerateEncodings(const wxString
& family
)
151 #endif // wxUSE_FONTMAP