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:
29 I recommend using the @b TAGS_MODULE_* macros.
32 Pointer to the parser that requested tables filling.
34 virtual void FillHandlersTable(wxHtmlWinParser parser
);
39 @class wxHtmlWinTagHandler
40 @headerfile winpars.h wx/html/winpars.h
42 This is basically wxHtmlTagHandler except that
43 it is extended with protected member m_WParser pointing to
44 the wxHtmlWinParser object (value of this member is identical
45 to wxHtmlParser's m_Parser).
50 class wxHtmlWinTagHandler
: public wxHtmlTagHandler
54 @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 @e wndIface parameter (@e 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
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().
135 Returns average char width in standard font. It is used as DC-independent
138 @b Note: This function doesn't return the @e actual width. If you want to
139 know the height of the current font, call @c GetDC - GetCharWidth()
144 Returns pointer to the currently opened container (see Overview).
147 wxHtmlContainerCell
* GetContainer();
150 Returns pointer to the DC used during parsing.
152 #define wxDC* GetDC() /* implementation is private */
155 Returns wxEncodingConverter class used
156 to do conversion between @ref getinputencoding() "input encoding"
157 and @ref getoutputencoding() "output encoding".
159 wxEncodingConverter
* GetEncodingConverter();
162 Returns @true if actual font is bold, @false otherwise.
167 Returns actual font face name.
169 wxString
GetFontFace();
172 Returns @true if actual font is fixed face, @false otherwise.
177 Returns @true if actual font is italic, @false otherwise.
182 Returns actual font size (HTML size varies from -2 to +4)
187 Returns @true if actual font is underlined, @false otherwise.
189 int GetFontUnderlined();
192 Returns input encoding.
194 wxFontEncoding
GetInputEncoding();
197 Returns actual hypertext link. (This value has a non-empty
198 @ref wxHtmlLinkInfo::gethref Href string
199 if the parser is between @c A and @c /A tags,
200 wxEmptyString otherwise.)
202 const wxHtmlLinkInfo
GetLink();
205 Returns the colour of hypertext link text.
207 const wxColour
GetLinkColor();
210 Returns output encoding, i.e. closest match to document's input encoding
211 that is supported by operating system.
213 wxFontEncoding
GetOutputEncoding();
216 Returns associated window (wxHtmlWindow). This may be @NULL! (You should always
217 test if it is non-@NULL. For example @c TITLE handler sets window
218 title only if some window is associated, otherwise it does nothing)
220 wxHtmlWindow
* GetWindow();
223 Opens new container and returns pointer to it (see Overview).
225 wxHtmlContainerCell
* OpenContainer();
228 Sets actual text colour. Note: this DOESN'T change the colour!
229 You must create wxHtmlColourCell yourself.
231 void SetActualColor(const wxColour
& clr
);
234 Sets default horizontal alignment (see
235 wxHtmlContainerCell::SetAlignHor.)
236 Alignment of newly opened container is set to this value.
238 void SetAlign(int a
);
241 Allows you to directly set opened container. This is not recommended - you
242 should use OpenContainer
245 wxHtmlContainerCell
* SetContainer(wxHtmlContainerCell
* c
);
248 Sets the DC. This must be called before wxHtmlParser::Parse!
249 @e pixel_scale can be used when rendering to high-resolution
250 DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in
251 HTML are given in pixels -- e.g. image sizes. 300x300 image would be only one
252 inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
254 #define virtual void SetDC(wxDC dc, double pixel_scale = 1.0) /* implementation is private */
257 Sets bold flag of actualfont. @e x is either @true of @false.
259 void SetFontBold(int x
);
262 Sets current font face to @e face. This affects either fixed size
263 font or proportional, depending on context (whether the parser is
264 inside @c TT tag or not).
266 void SetFontFace(const wxString
& face
);
269 Sets fixed face flag of actualfont. @e x is either @true of @false.
271 void SetFontFixed(int x
);
274 Sets italic flag of actualfont. @e x is either @true of @false.
276 void SetFontItalic(int x
);
279 Sets actual font size (HTML size varies from 1 to 7)
281 void SetFontSize(int s
);
284 Sets underlined flag of actualfont. @e x is either @true of @false.
286 void SetFontUnderlined(int x
);
289 Sets fonts. See wxHtmlWindow::SetFonts for
290 detailed description.
292 void SetFonts(const wxString
& normal_face
,
293 const wxString
& fixed_face
,
294 const int sizes
= @NULL
);
297 Sets input encoding. The parser uses this information to build conversion
298 tables from document's encoding to some encoding supported by operating
301 void SetInputEncoding(wxFontEncoding enc
);
304 Sets actual hypertext link. Empty link is represented
305 by wxHtmlLinkInfo with @e Href equal
308 void SetLink(const wxHtmlLinkInfo
& link
);
311 Sets colour of hypertext link.
313 void SetLinkColor(const wxColour
& clr
);