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