]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/fontenum.cpp
cleanup - reformat
[wxWidgets.git] / src / palmos / fontenum.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/fontenum.cpp
3 // Purpose: wxFontEnumerator class for Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
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 #if wxUSE_FONTMAP
28
29 #ifndef WX_PRECOMP
30 #include "wx/font.h"
31 #include "wx/encinfo.h"
32 #endif
33
34 #include "wx/palmos/private.h"
35
36 #include "wx/fontutil.h"
37 #include "wx/fontenum.h"
38 #include "wx/fontmap.h"
39
40 // ----------------------------------------------------------------------------
41 // private classes
42 // ----------------------------------------------------------------------------
43
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
48 {
49 public:
50 wxFontEnumeratorHelper(wxFontEnumerator *fontEnum);
51
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);
59
60 // call to start enumeration
61 void DoEnumerate();
62
63 // called by our font enumeration proc
64 bool OnFont(const LPLOGFONT lf, const LPTEXTMETRIC tm) const;
65
66 private:
67 // the object we forward calls to OnFont() to
68 wxFontEnumerator *m_fontEnum;
69
70 // if != -1, enum only fonts which have this encoding
71 int m_charset;
72
73 // if not empty, enum only the fonts with this facename
74 wxString m_facename;
75
76 // if not empty, enum only the fonts in this family
77 wxString m_family;
78
79 // if TRUE, enum only fixed fonts
80 bool m_fixedOnly;
81
82 // if TRUE, we enumerate the encodings, not fonts
83 bool m_enumEncodings;
84
85 // the list of charsets we already found while enumerating charsets
86 wxArrayInt m_charsets;
87
88 // the list of facenames we already found while enumerating facenames
89 wxArrayString m_facenames;
90
91 DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper)
92 };
93
94 // ----------------------------------------------------------------------------
95 // private functions
96 // ----------------------------------------------------------------------------
97
98 #ifndef __WXMICROWIN__
99 int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
100 DWORD dwStyle, LONG lParam);
101 #endif
102
103 // ============================================================================
104 // implementation
105 // ============================================================================
106
107 // ----------------------------------------------------------------------------
108 // wxFontEnumeratorHelper
109 // ----------------------------------------------------------------------------
110
111 wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum)
112 {
113 }
114
115 void wxFontEnumeratorHelper::SetFamily(const wxString& family)
116 {
117 }
118
119 bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
120 {
121 return FALSE;
122 }
123
124 #define wxFONTENUMPROC FONTENUMPROC
125
126 void wxFontEnumeratorHelper::DoEnumerate()
127 {
128 }
129
130 bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf,
131 const LPTEXTMETRIC tm) const
132 {
133 return false;
134 }
135
136 // ----------------------------------------------------------------------------
137 // wxFontEnumerator
138 // ----------------------------------------------------------------------------
139
140 bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
141 bool fixedWidthOnly)
142 {
143 return false;
144 }
145
146 bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
147 {
148 return false;
149 }
150
151 #endif // wxUSE_FONTMAP