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