1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/winpars.h
3 // Purpose: documentation for wxHtmlTagsModule class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxHtmlTagsModule
11 @headerfile winpars.h wx/html/winpars.h
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"
21 @ref overview_handlers "Tag Handlers", wxHtmlTagHandler, wxHtmlWinTagHandler,
23 class wxHtmlTagsModule
: public wxModule
27 You must override this method. In most common case its body consists
28 only of lines of the following type:
30 I recommend using the @b TAGS_MODULE_* macros.
33 Pointer to the parser that requested tables filling.
35 virtual void FillHandlersTable(wxHtmlWinParser parser
);
40 @class wxHtmlWinTagHandler
41 @headerfile winpars.h wx/html/winpars.h
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).
51 class wxHtmlWinTagHandler
: public wxHtmlTagHandler
55 @b wxHtmlWinParser* m_WParser
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.)
64 @class wxHtmlWinParser
65 @headerfile winpars.h wx/html/winpars.h
67 This class is derived from wxHtmlParser and
68 its main goal is to parse HTML input so that it can be displayed in
69 wxHtmlWindow. It uses a special
76 @ref overview_handlers "Handlers overview"
78 class wxHtmlWinParser
: public wxHtmlParser
83 Constructor. Don't use the default one, use constructor with
84 @a wndIface parameter (@a wndIface is a pointer to interface object for
85 the associated wxHtmlWindow or other HTML rendering
86 window such as wxHtmlListBox).
89 wxHtmlWinParser(wxHtmlWindowInterface wndIface
);
93 Adds module to the list of wxHtmlWinParser tag handler.
95 static void AddModule(wxHtmlTagsModule
module);
98 Closes the container, sets actual container to the parent one
99 and returns pointer to it (see Overview).
101 wxHtmlContainerCell
* CloseContainer();
104 Creates font based on current setting (see
109 wxHtmlWinParser::SetFontUnderlined)
110 and returns pointer to it.
111 If the font was already created only a pointer is returned.
113 virtual wxFont
* CreateCurrentFont();
116 Returns actual text colour.
118 const wxColour
GetActualColor();
121 Returns default horizontal alignment.
126 Returns (average) char height in standard font. It is used as DC-independent
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().
134 Returns average char width in standard font. It is used as DC-independent
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()
142 Returns pointer to the currently opened container (see Overview).
145 wxHtmlContainerCell
* GetContainer();
148 Returns pointer to the DC used during parsing.
153 Returns wxEncodingConverter class used
154 to do conversion between @ref getinputencoding() "input encoding"
155 and @ref getoutputencoding() "output encoding".
157 wxEncodingConverter
* GetEncodingConverter();
160 Returns @true if actual font is bold, @false otherwise.
165 Returns actual font face name.
167 wxString
GetFontFace();
170 Returns @true if actual font is fixed face, @false otherwise.
175 Returns @true if actual font is italic, @false otherwise.
180 Returns actual font size (HTML size varies from -2 to +4)
185 Returns @true if actual font is underlined, @false otherwise.
187 int GetFontUnderlined();
190 Returns input encoding.
192 wxFontEncoding
GetInputEncoding();
195 Returns actual hypertext link. (This value has a non-empty
196 @ref wxHtmlLinkInfo::gethref Href string
197 if the parser is between @c A and @c /A tags,
198 wxEmptyString otherwise.)
200 const wxHtmlLinkInfo
GetLink();
203 Returns the colour of hypertext link text.
205 const wxColour
GetLinkColor();
208 Returns output encoding, i.e. closest match to document's input encoding
209 that is supported by operating system.
211 wxFontEncoding
GetOutputEncoding();
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)
218 wxHtmlWindow
* GetWindow();
221 Opens new container and returns pointer to it (see Overview).
223 wxHtmlContainerCell
* OpenContainer();
226 Sets actual text colour. Note: this DOESN'T change the colour!
227 You must create wxHtmlColourCell yourself.
229 void SetActualColor(const wxColour
& clr
);
232 Sets default horizontal alignment (see
233 wxHtmlContainerCell::SetAlignHor.)
234 Alignment of newly opened container is set to this value.
236 void SetAlign(int a
);
239 Allows you to directly set opened container. This is not recommended - you
240 should use OpenContainer
243 wxHtmlContainerCell
* SetContainer(wxHtmlContainerCell
* c
);
246 Sets the DC. This must be called before wxHtmlParser::Parse!
247 @a pixel_scale can be used when rendering to high-resolution
248 DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in
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.)
252 virtual void SetDC(wxDC dc
, double pixel_scale
= 1.0);
255 Sets bold flag of actualfont. @a x is either @true of @false.
257 void SetFontBold(int x
);
260 Sets current font face to @e face. This affects either fixed size
261 font or proportional, depending on context (whether the parser is
262 inside @c TT tag or not).
264 void SetFontFace(const wxString
& face
);
267 Sets fixed face flag of actualfont. @a x is either @true of @false.
269 void SetFontFixed(int x
);
272 Sets italic flag of actualfont. @a x is either @true of @false.
274 void SetFontItalic(int x
);
277 Sets actual font size (HTML size varies from 1 to 7)
279 void SetFontSize(int s
);
282 Sets underlined flag of actualfont. @a x is either @true of @false.
284 void SetFontUnderlined(int x
);
287 Sets fonts. See wxHtmlWindow::SetFonts for
288 detailed description.
290 void SetFonts(const wxString
& normal_face
,
291 const wxString
& fixed_face
,
292 const int sizes
= NULL
);
295 Sets input encoding. The parser uses this information to build conversion
296 tables from document's encoding to some encoding supported by operating
299 void SetInputEncoding(wxFontEncoding enc
);
302 Sets actual hypertext link. Empty link is represented
303 by wxHtmlLinkInfo with @e Href equal
306 void SetLink(const wxHtmlLinkInfo
& link
);
309 Sets colour of hypertext link.
311 void SetLinkColor(const wxColour
& clr
);