1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/fontenum.cpp
3 // Purpose: wxFontEnumerator class for Palm OS
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "fontenum.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
35 #include "wx/encinfo.h"
38 #include "wx/palmos/private.h"
40 #include "wx/fontutil.h"
41 #include "wx/fontenum.h"
42 #include "wx/fontmap.h"
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 // the helper class which calls ::EnumFontFamilies() and whose OnFont() is
49 // called from the callback passed to this function and, in its turn, calls the
50 // appropariate wxFontEnumerator method
51 class wxFontEnumeratorHelper
54 wxFontEnumeratorHelper(wxFontEnumerator
*fontEnum
);
56 // control what exactly are we enumerating
57 // we enumerate fonts with given enocding
58 bool SetEncoding(wxFontEncoding encoding
);
59 // we enumerate fixed-width fonts
60 void SetFixedOnly(bool fixedOnly
) { m_fixedOnly
= fixedOnly
; }
61 // we enumerate the encodings available in this family
62 void SetFamily(const wxString
& family
);
64 // call to start enumeration
67 // called by our font enumeration proc
68 bool OnFont(const LPLOGFONT lf
, const LPTEXTMETRIC tm
) const;
71 // the object we forward calls to OnFont() to
72 wxFontEnumerator
*m_fontEnum
;
74 // if != -1, enum only fonts which have this encoding
77 // if not empty, enum only the fonts with this facename
80 // if not empty, enum only the fonts in this family
83 // if TRUE, enum only fixed fonts
86 // if TRUE, we enumerate the encodings, not fonts
89 // the list of charsets we already found while enumerating charsets
90 wxArrayInt m_charsets
;
92 // the list of facenames we already found while enumerating facenames
93 wxArrayString m_facenames
;
95 DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper
)
98 // ----------------------------------------------------------------------------
100 // ----------------------------------------------------------------------------
102 #ifndef __WXMICROWIN__
103 int CALLBACK
wxFontEnumeratorProc(LPLOGFONT lplf
, LPTEXTMETRIC lptm
,
104 DWORD dwStyle
, LONG lParam
);
107 // ============================================================================
109 // ============================================================================
111 // ----------------------------------------------------------------------------
112 // wxFontEnumeratorHelper
113 // ----------------------------------------------------------------------------
115 wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator
*fontEnum
)
119 void wxFontEnumeratorHelper::SetFamily(const wxString
& family
)
123 bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding
)
128 #define wxFONTENUMPROC FONTENUMPROC
130 void wxFontEnumeratorHelper::DoEnumerate()
134 bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf
,
135 const LPTEXTMETRIC tm
) const
140 // ----------------------------------------------------------------------------
142 // ----------------------------------------------------------------------------
144 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding
,
150 bool wxFontEnumerator::EnumerateEncodings(const wxString
& family
)
155 #endif // wxUSE_FONTMAP