]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: html/htmlcell.h | |
5bddd46d | 3 | // Purpose: interface of wxHtml*Cell |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
f21dd16b FM |
9 | |
10 | ||
23324ae1 | 11 | /** |
f21dd16b | 12 | @class wxHtmlRenderingStyle |
7c913512 | 13 | |
f21dd16b FM |
14 | Allows HTML rendering customizations. |
15 | This class is used when rendering wxHtmlCells as a callback. | |
7c913512 | 16 | |
23324ae1 | 17 | @library{wxhtml} |
8067ee11 | 18 | @category{html} |
f21dd16b FM |
19 | |
20 | @see wxHtmlRenderingInfo | |
23324ae1 | 21 | */ |
f21dd16b | 22 | class wxHtmlRenderingStyle |
23324ae1 FM |
23 | { |
24 | public: | |
25 | /** | |
f21dd16b FM |
26 | Returns the colour to use for the selected text. |
27 | */ | |
28 | virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0; | |
8067ee11 | 29 | |
f21dd16b FM |
30 | /** |
31 | Returns the colour to use for the selected text's background. | |
23324ae1 | 32 | */ |
f21dd16b | 33 | virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0; |
23324ae1 FM |
34 | }; |
35 | ||
36 | ||
37 | /** | |
f21dd16b | 38 | @class wxHtmlRenderingInfo |
7c913512 | 39 | |
f21dd16b FM |
40 | This class contains information given to cells when drawing them. |
41 | Contains rendering state, selection information and rendering style object | |
42 | that can be used to customize the output. | |
7c913512 | 43 | |
23324ae1 | 44 | @library{wxhtml} |
5bddd46d | 45 | @category{html} |
f21dd16b FM |
46 | |
47 | @see @ref overview_html_cells, wxHtmlCell | |
23324ae1 | 48 | */ |
f21dd16b | 49 | class wxHtmlRenderingInfo |
23324ae1 FM |
50 | { |
51 | public: | |
52 | /** | |
f21dd16b FM |
53 | Default ctor. |
54 | */ | |
55 | wxHtmlRenderingInfo(); | |
8067ee11 | 56 | |
f21dd16b FM |
57 | //@{ |
58 | /** | |
59 | Accessors. | |
23324ae1 | 60 | */ |
f21dd16b FM |
61 | void SetSelection(wxHtmlSelection *s); |
62 | wxHtmlSelection *GetSelection() const; | |
63 | ||
64 | void SetStyle(wxHtmlRenderingStyle *style); | |
65 | wxHtmlRenderingStyle& GetStyle(); | |
23324ae1 | 66 | |
f21dd16b FM |
67 | wxHtmlRenderingState& GetState(); |
68 | //@} | |
69 | }; | |
23324ae1 | 70 | |
e54c96f1 | 71 | |
23324ae1 FM |
72 | /** |
73 | @class wxHtmlCell | |
7c913512 | 74 | |
5bddd46d FM |
75 | Internal data structure. It represents fragments of parsed HTML page, the |
76 | so-called @b cell - a word, picture, table, horizontal line and so on. | |
77 | It is used by wxHtmlWindow and wxHtmlWinParser to represent HTML page in memory. | |
7c913512 | 78 | |
23324ae1 | 79 | You can divide cells into two groups : @e visible cells with non-zero width and |
5bddd46d FM |
80 | height and @e helper cells (usually with zero width and height) that perform |
81 | special actions such as color or font change. | |
7c913512 | 82 | |
23324ae1 | 83 | @library{wxhtml} |
5bddd46d | 84 | @category{html} |
7c913512 | 85 | |
5bddd46d | 86 | @see @ref overview_html_cells, wxHtmlContainerCell |
23324ae1 FM |
87 | */ |
88 | class wxHtmlCell : public wxObject | |
89 | { | |
90 | public: | |
91 | /** | |
92 | Constructor. | |
93 | */ | |
94 | wxHtmlCell(); | |
95 | ||
96 | /** | |
5bddd46d | 97 | This method is used to adjust pagebreak position. |
846f4568 | 98 | The first parameter is a variable that contains the y-coordinate of the page break |
5bddd46d FM |
99 | (= horizontal line that should not be crossed by words, images etc.). |
100 | If this cell cannot be divided into two pieces (each one on another page) | |
846f4568 VZ |
101 | then it either moves the pagebreak a few pixels up, if possible, or, if |
102 | the cell cannot fit on the page at all, then the cell is forced to | |
103 | split unconditionally. | |
104 | ||
5bddd46d FM |
105 | Returns @true if pagebreak was modified, @false otherwise. |
106 | ||
846f4568 VZ |
107 | @param pagebreak |
108 | position in pixel of the pagebreak. | |
109 | ||
110 | @param known_pagebreaks | |
111 | the list of the previous pagebreaks | |
112 | ||
113 | @param pageHeight | |
114 | the height in pixel of the page drawable area | |
115 | ||
23324ae1 | 116 | Usage: |
5bddd46d | 117 | @code |
846f4568 | 118 | while (container->AdjustPagebreak(&p, kp, ph)) {} |
5bddd46d | 119 | @endcode |
846f4568 | 120 | |
23324ae1 | 121 | */ |
5267aefd | 122 | virtual bool AdjustPagebreak(int* pagebreak, |
846f4568 VZ |
123 | const wxArrayInt& known_pagebreaks, |
124 | int pageHeight) const; | |
23324ae1 FM |
125 | |
126 | /** | |
127 | Renders the cell. | |
8067ee11 | 128 | |
7c913512 | 129 | @param dc |
f21dd16b | 130 | Device context to which the cell is to be drawn. |
7c913512 | 131 | @param x,y |
4cc4bfaf FM |
132 | Coordinates of parent's upper left corner (origin). You must |
133 | add this to m_PosX,m_PosY when passing coordinates to dc's methods | |
5bddd46d FM |
134 | Example: |
135 | @code | |
136 | dc->DrawText("hello", x + m_PosX, y + m_PosY) | |
137 | @endcode | |
7c913512 | 138 | @param view_y1 |
5bddd46d | 139 | y-coord of the first line visible in window. |
f21dd16b | 140 | This is used to optimize rendering speed. |
7c913512 | 141 | @param view_y2 |
5bddd46d | 142 | y-coord of the last line visible in window. |
f21dd16b FM |
143 | This is used to optimize rendering speed. |
144 | @param info | |
145 | Additional information for the rendering of the cell. | |
23324ae1 | 146 | */ |
5267aefd | 147 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, wxHtmlRenderingInfo& info); |
23324ae1 FM |
148 | |
149 | /** | |
5bddd46d FM |
150 | This method is called instead of Draw() when the cell is certainly out of |
151 | the screen (and thus invisible). This is not nonsense - some tags (like | |
152 | wxHtmlColourCell or font setter) must be drawn even if they are invisible! | |
8067ee11 | 153 | |
7c913512 | 154 | @param dc |
5bddd46d | 155 | Device context to which the cell is to be drawn. |
7c913512 | 156 | @param x,y |
4cc4bfaf FM |
157 | Coordinates of parent's upper left corner. You must |
158 | add this to m_PosX,m_PosY when passing coordinates to dc's methods | |
5bddd46d FM |
159 | Example: |
160 | @code | |
161 | dc->DrawText("hello", x + m_PosX, y + m_PosY) | |
162 | @endcode | |
f21dd16b FM |
163 | @param info |
164 | Additional information for the rendering of the cell. | |
23324ae1 | 165 | */ |
f21dd16b | 166 | virtual void DrawInvisible(wxDC& dc, int x , int y, wxHtmlRenderingInfo& info); |
23324ae1 FM |
167 | |
168 | /** | |
5bddd46d FM |
169 | Returns pointer to itself if this cell matches condition (or if any of the |
170 | cells following in the list matches), @NULL otherwise. | |
171 | (In other words if you call top-level container's Find() it will | |
23324ae1 | 172 | return pointer to the first cell that matches the condition) |
5bddd46d | 173 | |
23324ae1 | 174 | It is recommended way how to obtain pointer to particular cell or |
5bddd46d FM |
175 | to cell of some type (e.g. wxHtmlAnchorCell reacts on wxHTML_COND_ISANCHOR |
176 | condition). | |
8067ee11 | 177 | |
7c913512 | 178 | @param condition |
4cc4bfaf | 179 | Unique integer identifier of condition |
7c913512 | 180 | @param param |
4cc4bfaf | 181 | Optional parameters |
23324ae1 | 182 | */ |
adaaa686 | 183 | virtual const wxHtmlCell* Find(int condition, const void* param) const; |
23324ae1 FM |
184 | |
185 | /** | |
7c913512 | 186 | Returns descent value of the cell (m_Descent member). |
23324ae1 | 187 | See explanation: |
fd779edb | 188 | @image html htmlcell_descent.png |
23324ae1 | 189 | */ |
328f5751 | 190 | int GetDescent() const; |
23324ae1 FM |
191 | |
192 | /** | |
193 | Returns pointer to the first cell in the list. | |
5bddd46d FM |
194 | You can then use child's GetNext() method to obtain pointer to the next |
195 | cell in list. | |
196 | ||
cdbcf4c2 | 197 | @note This shouldn't be used by the end user. If you need some way of |
5bddd46d | 198 | finding particular cell in the list, try Find() method instead. |
23324ae1 | 199 | */ |
adaaa686 | 200 | virtual wxHtmlCell* GetFirstChild() const; |
23324ae1 FM |
201 | |
202 | /** | |
203 | Returns height of the cell (m_Height member). | |
204 | */ | |
328f5751 | 205 | int GetHeight() const; |
23324ae1 FM |
206 | |
207 | /** | |
5bddd46d | 208 | Returns unique cell identifier if there is any, the empty string otherwise. |
23324ae1 | 209 | */ |
5267aefd | 210 | const wxString& GetId() const; |
23324ae1 FM |
211 | |
212 | /** | |
213 | Returns hypertext link if associated with this cell or @NULL otherwise. | |
5bddd46d | 214 | See wxHtmlLinkInfo. (Note: this makes sense only for visible tags). |
8067ee11 | 215 | |
7c913512 | 216 | @param x,y |
4cc4bfaf FM |
217 | Coordinates of position where the user pressed mouse button. |
218 | These coordinates are used e.g. by COLORMAP. Values are relative to the | |
219 | upper left corner of THIS cell (i.e. from 0 to m_Width or m_Height) | |
23324ae1 | 220 | */ |
328f5751 | 221 | virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; |
23324ae1 FM |
222 | |
223 | /** | |
224 | Returns cursor to show when mouse pointer is over the cell. | |
8067ee11 | 225 | |
7c913512 | 226 | @param window |
4cc4bfaf | 227 | interface to the parent HTML window |
23324ae1 | 228 | */ |
adaaa686 | 229 | virtual wxCursor GetMouseCursor(wxHtmlWindowInterface* window) const; |
23324ae1 FM |
230 | |
231 | /** | |
232 | Returns pointer to the next cell in list (see htmlcell.h if you're | |
233 | interested in details). | |
234 | */ | |
328f5751 | 235 | wxHtmlCell* GetNext() const; |
23324ae1 FM |
236 | |
237 | /** | |
238 | Returns pointer to parent container. | |
239 | */ | |
328f5751 | 240 | wxHtmlContainerCell* GetParent() const; |
23324ae1 FM |
241 | |
242 | /** | |
243 | Returns X position within parent (the value is relative to parent's | |
244 | upper left corner). The returned value is meaningful only if | |
245 | parent's Layout() was called before! | |
246 | */ | |
328f5751 | 247 | int GetPosX() const; |
23324ae1 FM |
248 | |
249 | /** | |
250 | Returns Y position within parent (the value is relative to parent's | |
251 | upper left corner). The returned value is meaningful only if | |
252 | parent's Layout() was called before! | |
253 | */ | |
328f5751 | 254 | int GetPosY() const; |
23324ae1 FM |
255 | |
256 | /** | |
257 | Returns width of the cell (m_Width member). | |
258 | */ | |
328f5751 | 259 | int GetWidth() const; |
23324ae1 FM |
260 | |
261 | /** | |
61b6c822 FM |
262 | Layouts the cell. |
263 | ||
23324ae1 | 264 | This method performs two actions: |
5bddd46d | 265 | -# adjusts the cell's width according to the fact that maximal possible |
61b6c822 | 266 | width is @e w (this has sense when working with horizontal lines, tables etc.) |
5bddd46d FM |
267 | -# prepares layout (=fill-in m_PosX, m_PosY (and sometimes m_Height) members) |
268 | based on actual width @e w | |
269 | ||
270 | It must be called before displaying cells structure because m_PosX and | |
271 | m_PosY are undefined (or invalid) before calling Layout(). | |
23324ae1 FM |
272 | */ |
273 | virtual void Layout(int w); | |
274 | ||
275 | /** | |
5bddd46d FM |
276 | This function is simple event handler. |
277 | Each time the user clicks mouse button over a cell within wxHtmlWindow | |
278 | this method of that cell is called. | |
4c51a665 | 279 | Default behaviour is to call wxHtmlWindow::LoadPage. |
8067ee11 | 280 | |
7c913512 | 281 | @param window |
4cc4bfaf | 282 | interface to the parent HTML window |
7c913512 | 283 | @param pos |
4cc4bfaf | 284 | coordinates of mouse click (this is relative to cell's origin |
7c913512 | 285 | @param event |
4cc4bfaf | 286 | mouse event that triggered the call |
8067ee11 | 287 | |
d29a9a8a | 288 | @return @true if a link was clicked, @false otherwise. |
5bddd46d FM |
289 | |
290 | @since 2.7.0 (before OnMouseClick() method served a similar purpose). | |
291 | ||
292 | @note | |
293 | If you need more "advanced" event handling you should use wxHtmlBinderCell instead. | |
23324ae1 FM |
294 | */ |
295 | virtual bool ProcessMouseClick(wxHtmlWindowInterface* window, | |
296 | const wxPoint& pos, | |
297 | const wxMouseEvent& event); | |
298 | ||
299 | /** | |
300 | Sets unique cell identifier. Default value is no identifier, i.e. empty string. | |
301 | */ | |
302 | void SetId(const wxString& id); | |
303 | ||
304 | /** | |
5bddd46d FM |
305 | Sets the hypertext link associated with this cell. |
306 | (Default value is wxHtmlLinkInfo("", "") (no link)) | |
23324ae1 FM |
307 | */ |
308 | void SetLink(const wxHtmlLinkInfo& link); | |
309 | ||
310 | /** | |
311 | Sets the next cell in the list. This shouldn't be called by user - it is | |
312 | to be used only by wxHtmlContainerCell::InsertCell. | |
313 | */ | |
5267aefd | 314 | void SetNext(wxHtmlCell* cell); |
23324ae1 FM |
315 | |
316 | /** | |
5bddd46d FM |
317 | Sets parent container of this cell. |
318 | This is called from wxHtmlContainerCell::InsertCell. | |
23324ae1 | 319 | */ |
5267aefd | 320 | void SetParent(wxHtmlContainerCell* p); |
23324ae1 FM |
321 | |
322 | /** | |
323 | Sets the cell's position within parent container. | |
324 | */ | |
adaaa686 | 325 | virtual void SetPos(int x, int y); |
23324ae1 FM |
326 | }; |
327 | ||
328 | ||
e54c96f1 | 329 | |
23324ae1 FM |
330 | /** |
331 | @class wxHtmlContainerCell | |
7c913512 | 332 | |
23324ae1 FM |
333 | The wxHtmlContainerCell class is an implementation of a cell that may |
334 | contain more cells in it. It is heavily used in the wxHTML layout algorithm. | |
7c913512 | 335 | |
23324ae1 | 336 | @library{wxhtml} |
5bddd46d | 337 | @category{html} |
7c913512 | 338 | |
5bddd46d | 339 | @see @ref overview_html_cells |
23324ae1 FM |
340 | */ |
341 | class wxHtmlContainerCell : public wxHtmlCell | |
342 | { | |
343 | public: | |
344 | /** | |
4cc4bfaf | 345 | Constructor. @a parent is pointer to parent container or @NULL. |
23324ae1 | 346 | */ |
8067ee11 | 347 | wxHtmlContainerCell(wxHtmlContainerCell* parent); |
23324ae1 FM |
348 | |
349 | /** | |
350 | Returns container's horizontal alignment. | |
351 | */ | |
328f5751 | 352 | int GetAlignHor() const; |
23324ae1 FM |
353 | |
354 | /** | |
355 | Returns container's vertical alignment. | |
356 | */ | |
328f5751 | 357 | int GetAlignVer() const; |
23324ae1 FM |
358 | |
359 | /** | |
360 | Returns the background colour of the container or @c wxNullColour if no | |
5bddd46d | 361 | background colour is set. |
23324ae1 FM |
362 | */ |
363 | wxColour GetBackgroundColour(); | |
364 | ||
365 | /** | |
4cc4bfaf | 366 | Returns the indentation. @a ind is one of the @b wxHTML_INDENT_* constants. |
5bddd46d FM |
367 | |
368 | @note You must call GetIndentUnits() with same @a ind parameter in order | |
369 | to correctly interpret the returned integer value. | |
370 | It is NOT always in pixels! | |
23324ae1 | 371 | */ |
328f5751 | 372 | int GetIndent(int ind) const; |
23324ae1 FM |
373 | |
374 | /** | |
4cc4bfaf | 375 | Returns the units of indentation for @a ind where @a ind is one |
23324ae1 FM |
376 | of the @b wxHTML_INDENT_* constants. |
377 | */ | |
328f5751 | 378 | int GetIndentUnits(int ind) const; |
23324ae1 FM |
379 | |
380 | /** | |
5bddd46d | 381 | Inserts a new cell into the container. |
23324ae1 | 382 | */ |
5267aefd | 383 | void InsertCell(wxHtmlCell* cell); |
23324ae1 FM |
384 | |
385 | /** | |
386 | Sets the container's alignment (both horizontal and vertical) according to | |
5bddd46d FM |
387 | the values stored in @e tag. (Tags @c ALIGN parameter is extracted.) |
388 | In fact it is only a front-end to SetAlignHor() and SetAlignVer(). | |
23324ae1 FM |
389 | */ |
390 | void SetAlign(const wxHtmlTag& tag); | |
391 | ||
392 | /** | |
5bddd46d FM |
393 | Sets the container's @e horizontal alignment. |
394 | During wxHtmlCell::Layout each line is aligned according to @a al value. | |
8067ee11 | 395 | |
7c913512 | 396 | @param al |
4cc4bfaf | 397 | new horizontal alignment. May be one of these values: |
5bddd46d FM |
398 | - wxHTML_ALIGN_LEFT: lines are left-aligned (default) |
399 | - wxHTML_ALIGN_JUSTIFY: lines are justified | |
400 | - wxHTML_ALIGN_CENTER: lines are centered | |
401 | - wxHTML_ALIGN_RIGHT: lines are right-aligned | |
23324ae1 FM |
402 | */ |
403 | void SetAlignHor(int al); | |
404 | ||
405 | /** | |
406 | Sets the container's @e vertical alignment. This is per-line alignment! | |
8067ee11 | 407 | |
7c913512 | 408 | @param al |
4cc4bfaf | 409 | new vertical alignment. May be one of these values: |
5bddd46d FM |
410 | - wxHTML_ALIGN_BOTTOM: cells are over the line (default) |
411 | - wxHTML_ALIGN_CENTER: cells are centered on line | |
412 | - wxHTML_ALIGN_TOP: cells are under the line | |
8067ee11 | 413 | |
fd779edb | 414 | @image html htmlcontcell_alignv.png |
23324ae1 FM |
415 | */ |
416 | void SetAlignVer(int al); | |
417 | ||
418 | /** | |
419 | Sets the background colour for this container. | |
420 | */ | |
421 | void SetBackgroundColour(const wxColour& clr); | |
422 | ||
423 | /** | |
424 | Sets the border (frame) colours. A border is a rectangle around the container. | |
8067ee11 | 425 | |
7c913512 | 426 | @param clr1 |
4cc4bfaf | 427 | Colour of top and left lines |
7c913512 | 428 | @param clr2 |
4cc4bfaf | 429 | Colour of bottom and right lines |
3aaaf1aa VZ |
430 | @param border |
431 | Size of the border in pixels | |
23324ae1 | 432 | */ |
3aaaf1aa | 433 | void SetBorder(const wxColour& clr1, const wxColour& clr2, int border = 1); |
23324ae1 FM |
434 | |
435 | /** | |
436 | Sets the indentation (free space between borders of container and subcells). | |
8067ee11 | 437 | |
fd779edb | 438 | @image html htmlcontcell_indent.png |
5bddd46d | 439 | |
7c913512 | 440 | @param i |
4cc4bfaf | 441 | Indentation value. |
7c913512 | 442 | @param what |
4cc4bfaf FM |
443 | Determines which of the four borders we're setting. It is OR |
444 | combination of following constants: | |
5bddd46d FM |
445 | - wxHTML_INDENT_TOP: top border |
446 | - wxHTML_INDENT_BOTTOM: bottom | |
447 | - wxHTML_INDENT_LEFT: left | |
448 | - wxHTML_INDENT_RIGHT: right | |
449 | - wxHTML_INDENT_HORIZONTAL: left and right | |
450 | - wxHTML_INDENT_VERTICAL: top and bottom | |
451 | - wxHTML_INDENT_ALL: all 4 borders | |
7c913512 | 452 | @param units |
5bddd46d FM |
453 | Units of i. This parameter affects interpretation of value. |
454 | - wxHTML_UNITS_PIXELS: @a i is number of pixels | |
455 | - wxHTML_UNITS_PERCENT: @a i is interpreted as percents of width | |
456 | of parent container | |
23324ae1 FM |
457 | */ |
458 | void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS); | |
459 | ||
460 | /** | |
461 | Sets minimal height of the container. | |
5bddd46d FM |
462 | When container's wxHtmlCell::Layout is called, m_Height is set depending |
463 | on layout of subcells to the height of area covered by layed-out subcells. | |
464 | Calling this method guarantees you that the height of container is never | |
465 | smaller than @a h - even if the subcells cover much smaller area. | |
8067ee11 | 466 | |
7c913512 | 467 | @param h |
4cc4bfaf | 468 | The minimal height. |
7c913512 | 469 | @param align |
4cc4bfaf | 470 | If height of the container is lower than the minimum height, empty space |
5bddd46d FM |
471 | must be inserted somewhere in order to ensure minimal height. |
472 | This parameter is one of @c wxHTML_ALIGN_TOP, @c wxHTML_ALIGN_BOTTOM, | |
473 | @c wxHTML_ALIGN_CENTER. It refers to the contents, not to the | |
4cc4bfaf | 474 | empty place. |
23324ae1 FM |
475 | */ |
476 | void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP); | |
477 | ||
23324ae1 FM |
478 | /** |
479 | Sets floating width adjustment. | |
5bddd46d | 480 | |
23324ae1 FM |
481 | The normal behaviour of container is that its width is the same as the width of |
482 | parent container (and thus you can have only one sub-container per line). | |
5bddd46d | 483 | You can change this by setting the floating width adjustment. |
8067ee11 | 484 | |
7c913512 | 485 | @param w |
4cc4bfaf | 486 | Width of the container. If the value is negative it means |
5bddd46d FM |
487 | complement to full width of parent container. |
488 | E.g. @code SetWidthFloat(-50, wxHTML_UNITS_PIXELS) @endcode sets the | |
489 | width of container to parent's width minus 50 pixels. This is useful when | |
490 | creating tables - you can call SetWidthFloat(50) and SetWidthFloat(-50). | |
7c913512 | 491 | @param units |
4cc4bfaf | 492 | Units of w This parameter affects the interpretation of value. |
5bddd46d FM |
493 | - wxHTML_UNITS_PIXELS: @a w is number of pixels |
494 | - wxHTML_UNITS_PERCENT: @a w is interpreted as percents of width | |
495 | of parent container | |
496 | */ | |
497 | void SetWidthFloat(int w, int units); | |
8067ee11 | 498 | |
5bddd46d FM |
499 | /** |
500 | Sets floating width adjustment. | |
8067ee11 | 501 | |
5bddd46d FM |
502 | The normal behaviour of container is that its width is the same as the width of |
503 | parent container (and thus you can have only one sub-container per line). | |
504 | You can change this by setting the floating width adjustment. | |
8067ee11 | 505 | |
7c913512 | 506 | @param tag |
5bddd46d FM |
507 | In the second version of method, @a w and @a units info is extracted |
508 | from tag's WIDTH parameter. | |
509 | @param pixel_scale | |
510 | This is number of real pixels that equals to 1 HTML pixel. | |
23324ae1 | 511 | */ |
7c913512 FM |
512 | void SetWidthFloat(const wxHtmlTag& tag, |
513 | double pixel_scale = 1.0); | |
23324ae1 FM |
514 | }; |
515 | ||
516 | ||
e54c96f1 | 517 | |
23324ae1 FM |
518 | /** |
519 | @class wxHtmlLinkInfo | |
7c913512 | 520 | |
5bddd46d FM |
521 | This class stores all necessary information about hypertext links |
522 | (as represented by \<A\> tag in HTML documents). | |
523 | In current implementation it stores URL and target frame name. | |
524 | ||
525 | @note Frames are not currently supported by wxHTML! | |
7c913512 | 526 | |
23324ae1 | 527 | @library{wxhtml} |
5bddd46d | 528 | @category{html} |
23324ae1 FM |
529 | */ |
530 | class wxHtmlLinkInfo : public wxObject | |
531 | { | |
532 | public: | |
23324ae1 | 533 | /** |
5bddd46d | 534 | Default ctor. |
23324ae1 FM |
535 | */ |
536 | wxHtmlLinkInfo(); | |
5bddd46d FM |
537 | |
538 | /** | |
539 | Construct hypertext link from HREF (aka URL) and TARGET (name of target frame). | |
540 | */ | |
7c913512 FM |
541 | wxHtmlLinkInfo(const wxString& href, |
542 | const wxString& target = wxEmptyString); | |
23324ae1 FM |
543 | |
544 | /** | |
5bddd46d FM |
545 | Return pointer to event that generated OnLinkClicked() event. |
546 | Valid only within wxHtmlWindow::OnLinkClicked, @NULL otherwise. | |
23324ae1 | 547 | */ |
adaaa686 | 548 | const wxMouseEvent* GetEvent() const; |
23324ae1 FM |
549 | |
550 | /** | |
5bddd46d | 551 | Return @e HREF value of the \<A\> tag. |
23324ae1 | 552 | */ |
adaaa686 | 553 | wxString GetHref() const; |
23324ae1 FM |
554 | |
555 | /** | |
5bddd46d FM |
556 | Return pointer to the cell that was clicked. |
557 | Valid only within wxHtmlWindow::OnLinkClicked, @NULL otherwise. | |
23324ae1 | 558 | */ |
adaaa686 | 559 | const wxHtmlCell* GetHtmlCell() const; |
23324ae1 FM |
560 | |
561 | /** | |
5bddd46d FM |
562 | Return @e TARGET value of the \<A\> tag (this value is used to specify |
563 | in which frame should be the page pointed by @ref GetHref() Href opened). | |
23324ae1 | 564 | */ |
adaaa686 | 565 | wxString GetTarget() const; |
23324ae1 | 566 | }; |
e54c96f1 | 567 | |
f21dd16b FM |
568 | /** |
569 | @class wxHtmlColourCell | |
570 | ||
571 | This cell changes the colour of either the background or the foreground. | |
572 | ||
573 | @library{wxhtml} | |
574 | @category{html} | |
575 | */ | |
576 | class wxHtmlColourCell : public wxHtmlCell | |
577 | { | |
578 | public: | |
579 | /** | |
580 | Constructor. | |
581 | ||
582 | @param clr | |
583 | The color | |
584 | @param flags | |
585 | Can be one of following: | |
586 | - wxHTML_CLR_FOREGROUND: change color of text | |
587 | - wxHTML_CLR_BACKGROUND: change background color | |
588 | */ | |
589 | wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND); | |
590 | }; | |
591 | ||
592 | ||
593 | ||
594 | /** | |
595 | @class wxHtmlWidgetCell | |
596 | ||
597 | wxHtmlWidgetCell is a class that provides a connection between HTML cells and | |
598 | widgets (an object derived from wxWindow). | |
599 | You can use it to display things like forms, input boxes etc. in an HTML window. | |
600 | ||
601 | wxHtmlWidgetCell takes care of resizing and moving window. | |
602 | ||
603 | @library{wxhtml} | |
604 | @category{html} | |
605 | */ | |
606 | class wxHtmlWidgetCell : public wxHtmlCell | |
607 | { | |
608 | public: | |
609 | /** | |
610 | Constructor. | |
611 | ||
612 | @param wnd | |
613 | Connected window. It is parent window @b must be the wxHtmlWindow object | |
614 | within which it is displayed! | |
615 | @param w | |
616 | Floating width. If non-zero width of wnd window is adjusted so that it is | |
617 | always w percents of parent container's width. (For example w = 100 means | |
618 | that the window will always have same width as parent container). | |
619 | */ | |
620 | wxHtmlWidgetCell(wxWindow* wnd, int w = 0); | |
621 | }; |