]>
Commit | Line | Data |
---|---|---|
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
21 | #pragma implementation "fontenum.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #if wxUSE_FONTMAP | |
32 | ||
33 | #ifndef WX_PRECOMP | |
34 | #include "wx/font.h" | |
35 | #include "wx/encinfo.h" | |
36 | #endif | |
37 | ||
38 | #include "wx/palmos/private.h" | |
39 | ||
40 | #include "wx/fontutil.h" | |
41 | #include "wx/fontenum.h" | |
42 | #include "wx/fontmap.h" | |
43 | ||
44 | // ---------------------------------------------------------------------------- | |
45 | // private classes | |
46 | // ---------------------------------------------------------------------------- | |
47 | ||
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 | |
52 | { | |
53 | public: | |
54 | wxFontEnumeratorHelper(wxFontEnumerator *fontEnum); | |
55 | ||
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); | |
63 | ||
64 | // call to start enumeration | |
65 | void DoEnumerate(); | |
66 | ||
67 | // called by our font enumeration proc | |
68 | bool OnFont(const LPLOGFONT lf, const LPTEXTMETRIC tm) const; | |
69 | ||
70 | private: | |
71 | // the object we forward calls to OnFont() to | |
72 | wxFontEnumerator *m_fontEnum; | |
73 | ||
74 | // if != -1, enum only fonts which have this encoding | |
75 | int m_charset; | |
76 | ||
77 | // if not empty, enum only the fonts with this facename | |
78 | wxString m_facename; | |
79 | ||
80 | // if not empty, enum only the fonts in this family | |
81 | wxString m_family; | |
82 | ||
83 | // if TRUE, enum only fixed fonts | |
84 | bool m_fixedOnly; | |
85 | ||
86 | // if TRUE, we enumerate the encodings, not fonts | |
87 | bool m_enumEncodings; | |
88 | ||
89 | // the list of charsets we already found while enumerating charsets | |
90 | wxArrayInt m_charsets; | |
91 | ||
92 | // the list of facenames we already found while enumerating facenames | |
93 | wxArrayString m_facenames; | |
94 | ||
95 | DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper) | |
96 | }; | |
97 | ||
98 | // ---------------------------------------------------------------------------- | |
99 | // private functions | |
100 | // ---------------------------------------------------------------------------- | |
101 | ||
102 | #ifndef __WXMICROWIN__ | |
103 | int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, | |
104 | DWORD dwStyle, LONG lParam); | |
105 | #endif | |
106 | ||
107 | // ============================================================================ | |
108 | // implementation | |
109 | // ============================================================================ | |
110 | ||
111 | // ---------------------------------------------------------------------------- | |
112 | // wxFontEnumeratorHelper | |
113 | // ---------------------------------------------------------------------------- | |
114 | ||
115 | wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum) | |
116 | { | |
117 | } | |
118 | ||
119 | void wxFontEnumeratorHelper::SetFamily(const wxString& family) | |
120 | { | |
121 | } | |
122 | ||
123 | bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) | |
124 | { | |
125 | return FALSE; | |
126 | } | |
127 | ||
128 | #define wxFONTENUMPROC FONTENUMPROC | |
129 | ||
130 | void wxFontEnumeratorHelper::DoEnumerate() | |
131 | { | |
132 | } | |
133 | ||
134 | bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, | |
135 | const LPTEXTMETRIC tm) const | |
136 | { | |
137 | return false; | |
138 | } | |
139 | ||
140 | // ---------------------------------------------------------------------------- | |
141 | // wxFontEnumerator | |
142 | // ---------------------------------------------------------------------------- | |
143 | ||
144 | bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, | |
145 | bool fixedWidthOnly) | |
146 | { | |
147 | return false; | |
148 | } | |
149 | ||
150 | bool wxFontEnumerator::EnumerateEncodings(const wxString& family) | |
151 | { | |
152 | return false; | |
153 | } | |
154 | ||
155 | #endif // wxUSE_FONTMAP |