1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/winpars.h
3 // Purpose: interface of wxHtmlTagsModule
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"
20 @see @ref overview_handlers "Tag Handlers", wxHtmlTagHandler,
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
);
41 @class wxHtmlWinTagHandler
42 @headerfile winpars.h wx/html/winpars.h
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).
52 class wxHtmlWinTagHandler
: public wxHtmlTagHandler
56 @b wxHtmlWinParser* m_WParser
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.)
66 @class wxHtmlWinParser
67 @headerfile winpars.h wx/html/winpars.h
69 This class is derived from wxHtmlParser and
70 its main goal is to parse HTML input so that it can be displayed in
71 wxHtmlWindow. It uses a special
77 @see @ref overview_handlers "Handlers overview"
79 class wxHtmlWinParser
: public wxHtmlParser
84 Constructor. Don't use the default one, use constructor with
85 @a wndIface parameter (@a wndIface is a pointer to interface object for
86 the associated wxHtmlWindow or other HTML rendering
87 window such as wxHtmlListBox).
90 wxHtmlWinParser(wxHtmlWindowInterface wndIface
);
94 Adds module() to the list of wxHtmlWinParser tag handler.
96 static void AddModule(wxHtmlTagsModule
module);
99 Closes the container, sets actual container to the parent one
100 and returns pointer to it (see Overview()).
102 wxHtmlContainerCell
* CloseContainer();
105 Creates font based on current setting (see
110 wxHtmlWinParser::SetFontUnderlined)
111 and returns pointer to it.
112 If the font was already created only a pointer is returned.
114 virtual wxFont
* CreateCurrentFont();
117 Returns actual text colour.
119 const wxColour
GetActualColor() const;
122 Returns default horizontal alignment.
124 int GetAlign() const;
127 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().
132 int GetCharHeight() const;
135 Returns average char width in standard font. It is used as DC-independent
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()
140 int GetCharWidth() const;
143 Returns pointer to the currently opened container (see Overview()).
146 wxHtmlContainerCell
* GetContainer() const;
149 Returns pointer to the DC used during parsing.
154 Returns wxEncodingConverter class used
155 to do conversion between @ref getinputencoding() "input encoding"
156 and @ref getoutputencoding() "output encoding".
158 wxEncodingConverter
* GetEncodingConverter() const;
161 Returns @true if actual font is bold, @false otherwise.
163 int GetFontBold() const;
166 Returns actual font face name.
168 wxString
GetFontFace() const;
171 Returns @true if actual font is fixed face, @false otherwise.
173 int GetFontFixed() const;
176 Returns @true if actual font is italic, @false otherwise.
178 int GetFontItalic() const;
181 Returns actual font size (HTML size varies from -2 to +4)
183 int GetFontSize() const;
186 Returns @true if actual font is underlined, @false otherwise.
188 int GetFontUnderlined() const;
191 Returns input encoding.
193 wxFontEncoding
GetInputEncoding() const;
196 Returns actual hypertext link. (This value has a non-empty
197 @ref wxHtmlLinkInfo::gethref Href string
198 if the parser is between @c A and @c /A tags,
199 wxEmptyString otherwise.)
201 const wxHtmlLinkInfo
GetLink() const;
204 Returns the colour of hypertext link text.
206 const wxColour
GetLinkColor() const;
209 Returns output encoding, i.e. closest match to document's input encoding
210 that is supported by operating system.
212 wxFontEncoding
GetOutputEncoding() const;
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)
219 wxHtmlWindow
* GetWindow();
222 Opens new container and returns pointer to it (see Overview()).
224 wxHtmlContainerCell
* OpenContainer();
227 Sets actual text colour. Note: this DOESN'T change the colour!
228 You must create wxHtmlColourCell yourself.
230 void SetActualColor(const wxColour
& clr
);
233 Sets default horizontal alignment (see
234 wxHtmlContainerCell::SetAlignHor.)
235 Alignment of newly opened container is set to this value.
237 void SetAlign(int a
);
240 Allows you to directly set opened container. This is not recommended - you
241 should use OpenContainer
244 wxHtmlContainerCell
* SetContainer(wxHtmlContainerCell
* c
);
247 Sets the DC. This must be called before wxHtmlParser::Parse!
248 @a pixel_scale can be used when rendering to high-resolution
249 DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in
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.)
253 virtual void SetDC(wxDC dc
, double pixel_scale
= 1.0);
256 Sets bold flag of actualfont. @a x is either @true of @false.
258 void SetFontBold(int x
);
261 Sets current font face to @e face. This affects either fixed size
262 font or proportional, depending on context (whether the parser is
263 inside @c TT tag or not).
265 void SetFontFace(const wxString
& face
);
268 Sets fixed face flag of actualfont. @a x is either @true of @false.
270 void SetFontFixed(int x
);
273 Sets italic flag of actualfont. @a x is either @true of @false.
275 void SetFontItalic(int x
);
278 Sets actual font size (HTML size varies from 1 to 7)
280 void SetFontSize(int s
);
283 Sets underlined flag of actualfont. @a x is either @true of @false.
285 void SetFontUnderlined(int x
);
288 Sets fonts. See wxHtmlWindow::SetFonts for
289 detailed description.
291 void SetFonts(const wxString
& normal_face
,
292 const wxString
& fixed_face
,
293 const int sizes
= NULL
);
296 Sets input encoding. The parser uses this information to build conversion
297 tables from document's encoding to some encoding supported by operating
300 void SetInputEncoding(wxFontEncoding enc
);
303 Sets actual hypertext link. Empty link is represented
304 by wxHtmlLinkInfo with @e Href equal
307 void SetLink(const wxHtmlLinkInfo
& link
);
310 Sets colour of hypertext link.
312 void SetLinkColor(const wxColour
& clr
);