]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/html/winpars.h
70227dc3a1e616322df1577e925ca5ff80243c0c
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/winpars.h
3 // Purpose: interface of wxHtmlTagsModule
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxHtmlTagsModule
12 This class provides easy way of filling wxHtmlWinParser's table of
13 tag handlers. It is used almost exclusively together with the set of
14 @ref overview_html_handlers "TAGS_MODULE_* macros"
19 @see @ref overview_html_handlers, wxHtmlTagHandler, wxHtmlWinTagHandler
21 class wxHtmlTagsModule
: public wxModule
25 You must override this method. In most common case its body consists
26 only of lines of the following type:
28 parser -> AddTagHandler(new MyHandler);
31 It's recommended to use the @b TAGS_MODULE_* macros.
34 Pointer to the parser that requested tables filling.
36 virtual void FillHandlersTable(wxHtmlWinParser
* parser
);
42 @class wxHtmlWinTagHandler
44 This is basically wxHtmlTagHandler except that it is extended with protected
45 member m_WParser pointing to the wxHtmlWinParser object (value of this member
46 is identical to wxHtmlParser's m_Parser).
51 class wxHtmlWinTagHandler
: public wxHtmlTagHandler
55 Value of this attribute is identical to value of m_Parser.
56 The only difference is that m_WParser points to wxHtmlWinParser object
57 while m_Parser points to wxHtmlParser object. (The same object, but overcast.)
59 wxHtmlWinParser
* m_WParser
;
65 @class wxHtmlWinParser
67 This class is derived from wxHtmlParser and its main goal is to parse HTML
68 input so that it can be displayed in wxHtmlWindow.
69 It uses a special wxHtmlWinTagHandler.
71 @note The product of parsing is a wxHtmlCell (resp. wxHtmlContainer) object.
76 @see @ref overview_html_handlers
78 class wxHtmlWinParser
: public wxHtmlParser
84 Don't use the default one, use the constructor with @a wndIface parameter
85 (@a wndIface is a pointer to interface object for the associated wxHtmlWindow
86 or other HTML rendering window such as wxHtmlListBox).
88 wxHtmlWinParser(wxHtmlWindowInterface
* wndIface
= NULL
);
91 Adds module() to the list of wxHtmlWinParser tag handler.
93 static void AddModule(wxHtmlTagsModule
* module);
96 Closes the container, sets actual container to the parent one
97 and returns pointer to it (see @ref overview_html_cells).
99 wxHtmlContainerCell
* CloseContainer();
102 Creates font based on current setting (see SetFontSize(), SetFontBold(),
103 SetFontItalic(), SetFontFixed(), wxHtmlWinParser::SetFontUnderlined)
104 and returns pointer to it.
106 If the font was already created only a pointer is returned.
108 virtual wxFont
* CreateCurrentFont();
111 Returns actual text colour.
113 const wxColour
& GetActualColor() const;
116 Returns default horizontal alignment.
118 int GetAlign() const;
121 Returns (average) char height in standard font.
122 It is used as DC-independent metrics.
124 @note This function doesn't return the @e actual height. If you want to
125 know the height of the current font, call @c GetDC->GetCharHeight().
127 int GetCharHeight() const;
130 Returns average char width in standard font.
131 It is used as DC-independent metrics.
133 @note This function doesn't return the @e actual width. If you want to
134 know the height of the current font, call @c GetDC->GetCharWidth().
136 int GetCharWidth() const;
139 Returns pointer to the currently opened container (see @ref overview_html_cells).
142 m_WParser -> GetContainer() -> InsertCell(new ...);
145 wxHtmlContainerCell
* GetContainer() const;
148 Returns pointer to the DC used during parsing.
153 Returns wxEncodingConverter class used to do conversion between the
154 @ref GetInputEncoding() "input encoding" and the
155 @ref GetOutputEncoding() "output encoding".
157 wxEncodingConverter
* GetEncodingConverter() const;
160 Returns @true if actual font is bold, @false otherwise.
162 int GetFontBold() const;
165 Returns actual font face name.
167 wxString
GetFontFace() const;
170 Returns @true if actual font is fixed face, @false otherwise.
172 int GetFontFixed() const;
175 Returns @true if actual font is italic, @false otherwise.
177 int GetFontItalic() const;
180 Returns actual font size (HTML size varies from -2 to +4)
182 int GetFontSize() const;
185 Returns @true if actual font is underlined, @false otherwise.
187 int GetFontUnderlined() const;
190 Returns input encoding.
192 wxFontEncoding
GetInputEncoding() const;
195 Returns actual hypertext link.
196 (This value has a non-empty @ref wxHtmlLinkInfo::GetHref Href string
197 if the parser is between \<A\> and \</A\> tags, wxEmptyString otherwise.)
199 const wxHtmlLinkInfo
& GetLink() const;
202 Returns the colour of hypertext link text.
204 const wxColour
& GetLinkColor() const;
207 Returns output encoding, i.e. closest match to document's input encoding
208 that is supported by operating system.
210 wxFontEncoding
GetOutputEncoding() const;
213 Returns associated window (wxHtmlWindow). This may be @NULL!
214 (You should always test if it is non-@NULL.
215 For example @c TITLE handler sets window title only if some window is
216 associated, otherwise it does nothing.
217 @deprecated use GetWindowInterface()->GetHTMLWindow() instead
219 wxHtmlWindow
* GetWindow();
222 Opens new container and returns pointer to it (see @ref overview_html_cells).
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 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.
240 This is not recommended - you should use OpenContainer() wherever possible.
242 wxHtmlContainerCell
* SetContainer(wxHtmlContainerCell
* c
);
245 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.0e+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 @a 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 detailed description.
289 void SetFonts(const wxString
& normal_face
, const wxString
& fixed_face
,
290 const int* sizes
= 0);
293 Sets input encoding. The parser uses this information to build conversion
294 tables from document's encoding to some encoding supported by operating system.
296 void SetInputEncoding(wxFontEncoding enc
);
299 Sets actual hypertext link.
300 Empty link is represented by wxHtmlLinkInfo with @e Href equal
303 void SetLink(const wxHtmlLinkInfo
& link
);
306 Sets colour of hypertext link.
308 void SetLinkColor(const wxColour
& clr
);