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