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