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