]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: html/winpars.h | |
3 | // Purpose: documentation for wxHtmlTagsModule class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxHtmlTagsModule | |
11 | @headerfile winpars.h wx/html/winpars.h | |
7c913512 | 12 | |
23324ae1 FM |
13 | This class provides easy way of filling wxHtmlWinParser's table of |
14 | tag handlers. It is used almost exclusively together with the set of | |
15 | @ref overview_handlers "TAGS_MODULE_* macros" | |
7c913512 | 16 | |
23324ae1 FM |
17 | @library{wxhtml} |
18 | @category{FIXME} | |
7c913512 | 19 | |
23324ae1 FM |
20 | @seealso |
21 | @ref overview_handlers "Tag Handlers", wxHtmlTagHandler, wxHtmlWinTagHandler, | |
22 | */ | |
23 | class wxHtmlTagsModule : public wxModule | |
24 | { | |
25 | public: | |
26 | /** | |
27 | You must override this method. In most common case its body consists | |
28 | only of lines of the following type: | |
4cc4bfaf | 29 | |
23324ae1 FM |
30 | I recommend using the @b TAGS_MODULE_* macros. |
31 | ||
7c913512 | 32 | @param parser |
4cc4bfaf | 33 | Pointer to the parser that requested tables filling. |
23324ae1 FM |
34 | */ |
35 | virtual void FillHandlersTable(wxHtmlWinParser parser); | |
36 | }; | |
37 | ||
38 | ||
39 | /** | |
40 | @class wxHtmlWinTagHandler | |
41 | @headerfile winpars.h wx/html/winpars.h | |
7c913512 | 42 | |
23324ae1 FM |
43 | This is basically wxHtmlTagHandler except that |
44 | it is extended with protected member m_WParser pointing to | |
45 | the wxHtmlWinParser object (value of this member is identical | |
46 | to wxHtmlParser's m_Parser). | |
7c913512 | 47 | |
23324ae1 FM |
48 | @library{wxhtml} |
49 | @category{html} | |
50 | */ | |
51 | class wxHtmlWinTagHandler : public wxHtmlTagHandler | |
52 | { | |
53 | public: | |
54 | /** | |
55 | @b wxHtmlWinParser* m_WParser | |
23324ae1 FM |
56 | Value of this attribute is identical to value of m_Parser. The only different |
57 | is that m_WParser points to wxHtmlWinParser object while m_Parser | |
58 | points to wxHtmlParser object. (The same object, but overcast.) | |
59 | */ | |
60 | }; | |
61 | ||
62 | ||
63 | /** | |
64 | @class wxHtmlWinParser | |
65 | @headerfile winpars.h wx/html/winpars.h | |
7c913512 | 66 | |
23324ae1 FM |
67 | This class is derived from wxHtmlParser and |
68 | its main goal is to parse HTML input so that it can be displayed in | |
7c913512 | 69 | wxHtmlWindow. It uses a special |
23324ae1 | 70 | wxHtmlWinTagHandler. |
7c913512 | 71 | |
23324ae1 FM |
72 | @library{wxhtml} |
73 | @category{html} | |
7c913512 | 74 | |
23324ae1 FM |
75 | @seealso |
76 | @ref overview_handlers "Handlers overview" | |
77 | */ | |
78 | class wxHtmlWinParser : public wxHtmlParser | |
79 | { | |
80 | public: | |
81 | //@{ | |
82 | /** | |
83 | Constructor. Don't use the default one, use constructor with | |
4cc4bfaf | 84 | @a wndIface parameter (@a wndIface is a pointer to interface object for |
23324ae1 FM |
85 | the associated wxHtmlWindow or other HTML rendering |
86 | window such as wxHtmlListBox). | |
87 | */ | |
88 | wxHtmlWinParser(); | |
7c913512 | 89 | wxHtmlWinParser(wxHtmlWindowInterface wndIface); |
23324ae1 FM |
90 | //@} |
91 | ||
92 | /** | |
93 | Adds module to the list of wxHtmlWinParser tag handler. | |
94 | */ | |
95 | static void AddModule(wxHtmlTagsModule module); | |
96 | ||
97 | /** | |
98 | Closes the container, sets actual container to the parent one | |
99 | and returns pointer to it (see Overview). | |
100 | */ | |
101 | wxHtmlContainerCell* CloseContainer(); | |
102 | ||
103 | /** | |
7c913512 FM |
104 | Creates font based on current setting (see |
105 | SetFontSize(), | |
106 | SetFontBold(), | |
107 | SetFontItalic(), | |
108 | SetFontFixed(), | |
23324ae1 FM |
109 | wxHtmlWinParser::SetFontUnderlined) |
110 | and returns pointer to it. | |
111 | If the font was already created only a pointer is returned. | |
112 | */ | |
113 | virtual wxFont* CreateCurrentFont(); | |
114 | ||
115 | /** | |
116 | Returns actual text colour. | |
117 | */ | |
328f5751 | 118 | const wxColour GetActualColor() const; |
23324ae1 FM |
119 | |
120 | /** | |
121 | Returns default horizontal alignment. | |
122 | */ | |
328f5751 | 123 | int GetAlign() const; |
23324ae1 FM |
124 | |
125 | /** | |
126 | Returns (average) char height in standard font. It is used as DC-independent | |
127 | metrics. | |
23324ae1 FM |
128 | @b Note: This function doesn't return the @e actual height. If you want to |
129 | know the height of the current font, call @c GetDC - GetCharHeight(). | |
130 | */ | |
328f5751 | 131 | int GetCharHeight() const; |
23324ae1 FM |
132 | |
133 | /** | |
134 | Returns average char width in standard font. It is used as DC-independent | |
135 | metrics. | |
23324ae1 FM |
136 | @b Note: This function doesn't return the @e actual width. If you want to |
137 | know the height of the current font, call @c GetDC - GetCharWidth() | |
138 | */ | |
328f5751 | 139 | int GetCharWidth() const; |
23324ae1 FM |
140 | |
141 | /** | |
142 | Returns pointer to the currently opened container (see Overview). | |
143 | Common use: | |
144 | */ | |
328f5751 | 145 | wxHtmlContainerCell* GetContainer() const; |
23324ae1 FM |
146 | |
147 | /** | |
148 | Returns pointer to the DC used during parsing. | |
149 | */ | |
4cc4bfaf | 150 | wxDC* GetDC(); |
23324ae1 FM |
151 | |
152 | /** | |
153 | Returns wxEncodingConverter class used | |
7c913512 | 154 | to do conversion between @ref getinputencoding() "input encoding" |
23324ae1 FM |
155 | and @ref getoutputencoding() "output encoding". |
156 | */ | |
328f5751 | 157 | wxEncodingConverter* GetEncodingConverter() const; |
23324ae1 FM |
158 | |
159 | /** | |
160 | Returns @true if actual font is bold, @false otherwise. | |
161 | */ | |
328f5751 | 162 | int GetFontBold() const; |
23324ae1 FM |
163 | |
164 | /** | |
165 | Returns actual font face name. | |
166 | */ | |
328f5751 | 167 | wxString GetFontFace() const; |
23324ae1 FM |
168 | |
169 | /** | |
170 | Returns @true if actual font is fixed face, @false otherwise. | |
171 | */ | |
328f5751 | 172 | int GetFontFixed() const; |
23324ae1 FM |
173 | |
174 | /** | |
175 | Returns @true if actual font is italic, @false otherwise. | |
176 | */ | |
328f5751 | 177 | int GetFontItalic() const; |
23324ae1 FM |
178 | |
179 | /** | |
180 | Returns actual font size (HTML size varies from -2 to +4) | |
181 | */ | |
328f5751 | 182 | int GetFontSize() const; |
23324ae1 FM |
183 | |
184 | /** | |
185 | Returns @true if actual font is underlined, @false otherwise. | |
186 | */ | |
328f5751 | 187 | int GetFontUnderlined() const; |
23324ae1 FM |
188 | |
189 | /** | |
190 | Returns input encoding. | |
191 | */ | |
328f5751 | 192 | wxFontEncoding GetInputEncoding() const; |
23324ae1 FM |
193 | |
194 | /** | |
7c913512 | 195 | Returns actual hypertext link. (This value has a non-empty |
23324ae1 FM |
196 | @ref wxHtmlLinkInfo::gethref Href string |
197 | if the parser is between @c A and @c /A tags, | |
198 | wxEmptyString otherwise.) | |
199 | */ | |
328f5751 | 200 | const wxHtmlLinkInfo GetLink() const; |
23324ae1 FM |
201 | |
202 | /** | |
203 | Returns the colour of hypertext link text. | |
204 | */ | |
328f5751 | 205 | const wxColour GetLinkColor() const; |
23324ae1 FM |
206 | |
207 | /** | |
208 | Returns output encoding, i.e. closest match to document's input encoding | |
209 | that is supported by operating system. | |
210 | */ | |
328f5751 | 211 | wxFontEncoding GetOutputEncoding() const; |
23324ae1 FM |
212 | |
213 | /** | |
214 | Returns associated window (wxHtmlWindow). This may be @NULL! (You should always | |
215 | test if it is non-@NULL. For example @c TITLE handler sets window | |
216 | title only if some window is associated, otherwise it does nothing) | |
217 | */ | |
218 | wxHtmlWindow* GetWindow(); | |
219 | ||
220 | /** | |
221 | Opens new container and returns pointer to it (see Overview). | |
222 | */ | |
223 | wxHtmlContainerCell* OpenContainer(); | |
224 | ||
225 | /** | |
226 | Sets actual text colour. Note: this DOESN'T change the colour! | |
227 | You must create wxHtmlColourCell yourself. | |
228 | */ | |
229 | void SetActualColor(const wxColour& clr); | |
230 | ||
231 | /** | |
7c913512 | 232 | Sets default horizontal alignment (see |
23324ae1 FM |
233 | wxHtmlContainerCell::SetAlignHor.) |
234 | Alignment of newly opened container is set to this value. | |
235 | */ | |
236 | void SetAlign(int a); | |
237 | ||
238 | /** | |
239 | Allows you to directly set opened container. This is not recommended - you | |
240 | should use OpenContainer | |
241 | wherever possible. | |
242 | */ | |
4cc4bfaf | 243 | wxHtmlContainerCell* SetContainer(wxHtmlContainerCell* c); |
23324ae1 FM |
244 | |
245 | /** | |
246 | Sets the DC. This must be called before wxHtmlParser::Parse! | |
4cc4bfaf | 247 | @a pixel_scale can be used when rendering to high-resolution |
7c913512 | 248 | DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in |
23324ae1 FM |
249 | HTML are given in pixels -- e.g. image sizes. 300x300 image would be only one |
250 | inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.) | |
251 | */ | |
4cc4bfaf | 252 | virtual void SetDC(wxDC dc, double pixel_scale = 1.0); |
23324ae1 FM |
253 | |
254 | /** | |
4cc4bfaf | 255 | Sets bold flag of actualfont. @a x is either @true of @false. |
23324ae1 FM |
256 | */ |
257 | void SetFontBold(int x); | |
258 | ||
259 | /** | |
260 | Sets current font face to @e face. This affects either fixed size | |
7c913512 | 261 | font or proportional, depending on context (whether the parser is |
23324ae1 FM |
262 | inside @c TT tag or not). |
263 | */ | |
264 | void SetFontFace(const wxString& face); | |
265 | ||
266 | /** | |
4cc4bfaf | 267 | Sets fixed face flag of actualfont. @a x is either @true of @false. |
23324ae1 FM |
268 | */ |
269 | void SetFontFixed(int x); | |
270 | ||
271 | /** | |
4cc4bfaf | 272 | Sets italic flag of actualfont. @a x is either @true of @false. |
23324ae1 FM |
273 | */ |
274 | void SetFontItalic(int x); | |
275 | ||
276 | /** | |
277 | Sets actual font size (HTML size varies from 1 to 7) | |
278 | */ | |
279 | void SetFontSize(int s); | |
280 | ||
281 | /** | |
4cc4bfaf | 282 | Sets underlined flag of actualfont. @a x is either @true of @false. |
23324ae1 FM |
283 | */ |
284 | void SetFontUnderlined(int x); | |
285 | ||
286 | /** | |
287 | Sets fonts. See wxHtmlWindow::SetFonts for | |
288 | detailed description. | |
289 | */ | |
290 | void SetFonts(const wxString& normal_face, | |
291 | const wxString& fixed_face, | |
4cc4bfaf | 292 | const int sizes = NULL); |
23324ae1 FM |
293 | |
294 | /** | |
295 | Sets input encoding. The parser uses this information to build conversion | |
296 | tables from document's encoding to some encoding supported by operating | |
297 | system. | |
298 | */ | |
299 | void SetInputEncoding(wxFontEncoding enc); | |
300 | ||
301 | /** | |
302 | Sets actual hypertext link. Empty link is represented | |
303 | by wxHtmlLinkInfo with @e Href equal | |
304 | to wxEmptyString. | |
305 | */ | |
306 | void SetLink(const wxHtmlLinkInfo& link); | |
307 | ||
308 | /** | |
309 | Sets colour of hypertext link. | |
310 | */ | |
311 | void SetLinkColor(const wxColour& clr); | |
312 | }; |