]> git.saurik.com Git - wxWidgets.git/blob - include/wx/html/htmlcell.h
cleanup - added whitespace around operators, some blank lines, fixed comment typos...
[wxWidgets.git] / include / wx / html / htmlcell.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: htmlcell.h
3 // Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser
4 // as a basic visual element of HTML page
5 // Author: Vaclav Slavik
6 // RCS-ID: $Id$
7 // Copyright: (c) 1999-2003 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_HTMLCELL_H_
12 #define _WX_HTMLCELL_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_HTML
17
18 #include "wx/html/htmltag.h"
19 #include "wx/html/htmldefs.h"
20 #include "wx/window.h"
21
22
23 class WXDLLIMPEXP_HTML wxHtmlLinkInfo;
24 class WXDLLIMPEXP_HTML wxHtmlCell;
25 class WXDLLIMPEXP_HTML wxHtmlContainerCell;
26
27
28 // wxHtmlSelection is data holder with information about text selection.
29 // Selection is defined by two positions (beginning and end of the selection)
30 // and two leaf(!) cells at these positions.
31 class WXDLLIMPEXP_HTML wxHtmlSelection
32 {
33 public:
34 wxHtmlSelection()
35 : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition),
36 m_fromPrivPos(wxDefaultPosition), m_toPrivPos(wxDefaultPosition),
37 m_fromCell(NULL), m_toCell(NULL) {}
38
39 void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
40 const wxPoint& toPos, const wxHtmlCell *toCell);
41 void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell);
42
43 const wxHtmlCell *GetFromCell() const { return m_fromCell; }
44 const wxHtmlCell *GetToCell() const { return m_toCell; }
45
46 // these values are in absolute coordinates:
47 const wxPoint& GetFromPos() const { return m_fromPos; }
48 const wxPoint& GetToPos() const { return m_toPos; }
49
50 // these are From/ToCell's private data
51 const wxPoint& GetFromPrivPos() const { return m_fromPrivPos; }
52 const wxPoint& GetToPrivPos() const { return m_toPrivPos; }
53 void SetFromPrivPos(const wxPoint& pos) { m_fromPrivPos = pos; }
54 void SetToPrivPos(const wxPoint& pos) { m_toPrivPos = pos; }
55 void ClearPrivPos() { m_toPrivPos = m_fromPrivPos = wxDefaultPosition; }
56
57 bool IsEmpty() const
58 { return m_fromPos == wxDefaultPosition &&
59 m_toPos == wxDefaultPosition; }
60
61 private:
62 wxPoint m_fromPos, m_toPos;
63 wxPoint m_fromPrivPos, m_toPrivPos;
64 const wxHtmlCell *m_fromCell, *m_toCell;
65 };
66
67
68
69 enum wxHtmlSelectionState
70 {
71 wxHTML_SEL_OUT, // currently rendered cell is outside the selection
72 wxHTML_SEL_IN, // ... is inside selection
73 wxHTML_SEL_CHANGING // ... is the cell on which selection state changes
74 };
75
76 // Selection state is passed to wxHtmlCell::Draw so that it can render itself
77 // differently e.g. when inside text selection or outside it.
78 class WXDLLIMPEXP_HTML wxHtmlRenderingState
79 {
80 public:
81 wxHtmlRenderingState() : m_selState(wxHTML_SEL_OUT) {}
82
83 void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; }
84 wxHtmlSelectionState GetSelectionState() const { return m_selState; }
85
86 void SetFgColour(const wxColour& c) { m_fgColour = c; }
87 const wxColour& GetFgColour() const { return m_fgColour; }
88 void SetBgColour(const wxColour& c) { m_bgColour = c; }
89 const wxColour& GetBgColour() const { return m_bgColour; }
90
91 private:
92 wxHtmlSelectionState m_selState;
93 wxColour m_fgColour, m_bgColour;
94 };
95
96
97 // HTML rendering customization. This class is used when rendering wxHtmlCells
98 // as a callback:
99 class WXDLLIMPEXP_HTML wxHtmlRenderingStyle
100 {
101 public:
102 virtual ~wxHtmlRenderingStyle() {}
103 virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
104 virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
105 };
106
107 // Standard style:
108 class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
109 {
110 public:
111 virtual wxColour GetSelectedTextColour(const wxColour& clr);
112 virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
113 };
114
115
116 // Information given to cells when drawing them. Contains rendering state,
117 // selection information and rendering style object that can be used to
118 // customize the output.
119 class WXDLLIMPEXP_HTML wxHtmlRenderingInfo
120 {
121 public:
122 wxHtmlRenderingInfo() : m_selection(NULL), m_style(NULL) {}
123
124 void SetSelection(wxHtmlSelection *s) { m_selection = s; }
125 wxHtmlSelection *GetSelection() const { return m_selection; }
126
127 void SetStyle(wxHtmlRenderingStyle *style) { m_style = style; }
128 wxHtmlRenderingStyle& GetStyle() { return *m_style; }
129
130 wxHtmlRenderingState& GetState() { return m_state; }
131
132 protected:
133 wxHtmlSelection *m_selection;
134 wxHtmlRenderingStyle *m_style;
135 wxHtmlRenderingState m_state;
136 };
137
138
139 // Flags for wxHtmlCell::FindCellByPos
140 enum
141 {
142 wxHTML_FIND_EXACT = 1,
143 wxHTML_FIND_NEAREST_BEFORE = 2,
144 wxHTML_FIND_NEAREST_AFTER = 4
145 };
146
147
148 // Superscript/subscript/normal script mode of a cell
149 enum wxHtmlScriptMode
150 {
151 wxHTML_SCRIPT_NORMAL,
152 wxHTML_SCRIPT_SUB,
153 wxHTML_SCRIPT_SUP
154 };
155
156
157 // ---------------------------------------------------------------------------
158 // wxHtmlCell
159 // Internal data structure. It represents fragments of parsed
160 // HTML page - a word, picture, table, horizontal line and so
161 // on. It is used by wxHtmlWindow to represent HTML page in
162 // memory.
163 // ---------------------------------------------------------------------------
164
165
166 class WXDLLIMPEXP_HTML wxHtmlCell : public wxObject
167 {
168 public:
169 wxHtmlCell();
170 virtual ~wxHtmlCell();
171
172 void SetParent(wxHtmlContainerCell *p) {m_Parent = p;}
173 wxHtmlContainerCell *GetParent() const {return m_Parent;}
174
175 int GetPosX() const {return m_PosX;}
176 int GetPosY() const {return m_PosY;}
177 int GetWidth() const {return m_Width;}
178
179 // Returns the maximum possible length of the cell.
180 // Call Layout at least once before using GetMaxTotalWidth()
181 virtual int GetMaxTotalWidth() const { return m_Width; }
182
183 int GetHeight() const {return m_Height;}
184 int GetDescent() const {return m_Descent;}
185
186 void SetScriptMode(wxHtmlScriptMode mode, long previousBase);
187 wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; }
188 long GetScriptBaseline() { return m_ScriptBaseline; }
189
190 // Formatting cells are not visible on the screen, they only alter
191 // renderer's state.
192 bool IsFormattingCell() const { return m_Width == 0 && m_Height == 0; }
193
194 const wxString& GetId() const { return m_id; }
195 void SetId(const wxString& id) { m_id = id; }
196
197 // returns the link associated with this cell. The position is position
198 // within the cell so it varies from 0 to m_Width, from 0 to m_Height
199 virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0,
200 int WXUNUSED(y) = 0) const
201 { return m_Link; }
202
203 // Returns cursor to be used when mouse is over the cell:
204 virtual wxCursor GetCursor() const;
205
206 // return next cell among parent's cells
207 wxHtmlCell *GetNext() const {return m_Next;}
208 // returns first child cell (if there are any, i.e. if this is container):
209 virtual wxHtmlCell* GetFirstChild() const { return NULL; }
210
211 // members writing methods
212 virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;}
213 void SetLink(const wxHtmlLinkInfo& link);
214 void SetNext(wxHtmlCell *cell) {m_Next = cell;}
215
216 // 1. adjust cell's width according to the fact that maximal possible width
217 // is w. (this has sense when working with horizontal lines, tables
218 // etc.)
219 // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height)
220 // members) = place items to fit window, according to the width w
221 virtual void Layout(int w);
222
223 // renders the cell
224 virtual void Draw(wxDC& WXUNUSED(dc),
225 int WXUNUSED(x), int WXUNUSED(y),
226 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
227 wxHtmlRenderingInfo& WXUNUSED(info)) {}
228
229 // proceed drawing actions in case the cell is not visible (scrolled out of
230 // screen). This is needed to change fonts, colors and so on.
231 virtual void DrawInvisible(wxDC& WXUNUSED(dc),
232 int WXUNUSED(x), int WXUNUSED(y),
233 wxHtmlRenderingInfo& WXUNUSED(info)) {}
234
235 // This method returns pointer to the FIRST cell for that
236 // the condition
237 // is true. It first checks if the condition is true for this
238 // cell and then calls m_Next->Find(). (Note: it checks
239 // all subcells if the cell is container)
240 // Condition is unique condition identifier (see htmldefs.h)
241 // (user-defined condition IDs should start from 10000)
242 // and param is optional parameter
243 // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news");
244 // returns pointer to anchor news
245 virtual const wxHtmlCell* Find(int condition, const void* param) const;
246
247 // This function is called when mouse button is clicked over the cell.
248 //
249 // Parent is pointer to wxHtmlWindow that generated the event
250 // HINT: if this handling is not enough for you you should use
251 // wxHtmlWidgetCell
252 virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
253
254 // This method used to adjust pagebreak position. The parameter is variable
255 // that contains y-coordinate of page break (= horizontal line that should
256 // not be crossed by words, images etc.). If this cell cannot be divided
257 // into two pieces (each one on another page) then it moves the pagebreak
258 // few pixels up.
259 //
260 // Returned value : true if pagebreak was modified, false otherwise
261 // Usage : while (container->AdjustPagebreak(&p)) {}
262 virtual bool AdjustPagebreak(int *pagebreak,
263 int *known_pagebreaks = NULL,
264 int number_of_pages = 0) const;
265
266 // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default
267 // is true - the cell can be split on two pages
268 void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; }
269
270 // Can the line be broken before this cell?
271 virtual bool IsLinebreakAllowed() const
272 { return !IsFormattingCell(); }
273
274 // Returns true for simple == terminal cells, i.e. not composite ones.
275 // This if for internal usage only and may disappear in future versions!
276 virtual bool IsTerminalCell() const { return true; }
277
278 // Find a cell inside this cell positioned at the given coordinates
279 // (relative to this's positions). Returns NULL if no such cell exists.
280 // The flag can be used to specify whether to look for terminal or
281 // nonterminal cells or both. In either case, returned cell is deepest
282 // cell in cells tree that contains [x,y].
283 virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
284 unsigned flags = wxHTML_FIND_EXACT) const;
285
286 // Returns absolute position of the cell on HTML canvas
287 wxPoint GetAbsPos() const;
288
289 // Returns first (last) terminal cell inside this cell. It may return NULL,
290 // but it is rare -- only if there are no terminals in the tree.
291 virtual wxHtmlCell *GetFirstTerminal() const
292 { return wxConstCast(this, wxHtmlCell); }
293 virtual wxHtmlCell *GetLastTerminal() const
294 { return wxConstCast(this, wxHtmlCell); }
295
296 // Returns cell's depth, i.e. how far under the root cell it is
297 // (if it is the root, depth is 0)
298 unsigned GetDepth() const;
299
300 // Returns true if the cell appears before 'cell' in natural order of
301 // cells (= as they are read). If cell A is (grand)parent of cell B,
302 // then both A.IsBefore(B) and B.IsBefore(A) always return true.
303 bool IsBefore(wxHtmlCell *cell) const;
304
305 // Converts the cell into text representation. If sel != NULL then
306 // only part of the cell inside the selection is converted.
307 virtual wxString ConvertToText(wxHtmlSelection *WXUNUSED(sel)) const
308 { return wxEmptyString; }
309
310 protected:
311 // pointer to the next cell
312 wxHtmlCell *m_Next;
313 // pointer to parent cell
314 wxHtmlContainerCell *m_Parent;
315
316 // dimensions of fragment (m_Descent is used to position text & images)
317 long m_Width, m_Height, m_Descent;
318 // position where the fragment is drawn:
319 long m_PosX, m_PosY;
320
321 // superscript/subscript/normal:
322 wxHtmlScriptMode m_ScriptMode;
323 long m_ScriptBaseline;
324
325 // destination address if this fragment is hypertext link, NULL otherwise
326 wxHtmlLinkInfo *m_Link;
327 // true if this cell can be placed on pagebreak, false otherwise
328 bool m_CanLiveOnPagebreak;
329 // unique identifier of the cell, generated from "id" property of tags
330 wxString m_id;
331
332 DECLARE_ABSTRACT_CLASS(wxHtmlCell)
333 DECLARE_NO_COPY_CLASS(wxHtmlCell)
334 };
335
336
337
338
339 // ----------------------------------------------------------------------------
340 // Inherited cells:
341 // ----------------------------------------------------------------------------
342
343
344 // ----------------------------------------------------------------------------
345 // wxHtmlWordCell
346 // Single word in input stream.
347 // ----------------------------------------------------------------------------
348
349 class WXDLLIMPEXP_HTML wxHtmlWordCell : public wxHtmlCell
350 {
351 public:
352 wxHtmlWordCell(const wxString& word, const wxDC& dc);
353 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
354 wxHtmlRenderingInfo& info);
355 wxCursor GetCursor() const;
356 wxString ConvertToText(wxHtmlSelection *sel) const;
357 bool IsLinebreakAllowed() const { return m_allowLinebreak; }
358
359 void SetPreviousWord(wxHtmlWordCell *cell);
360
361 protected:
362 void SetSelectionPrivPos(const wxDC& dc, wxHtmlSelection *s) const;
363 void Split(const wxDC& dc,
364 const wxPoint& selFrom, const wxPoint& selTo,
365 unsigned& pos1, unsigned& pos2) const;
366
367 wxString m_Word;
368 bool m_allowLinebreak;
369
370 DECLARE_ABSTRACT_CLASS(wxHtmlWordCell)
371 DECLARE_NO_COPY_CLASS(wxHtmlWordCell)
372 };
373
374
375
376
377
378 // Container contains other cells, thus forming tree structure of rendering
379 // elements. Basic code of layout algorithm is contained in this class.
380 class WXDLLIMPEXP_HTML wxHtmlContainerCell : public wxHtmlCell
381 {
382 public:
383 wxHtmlContainerCell(wxHtmlContainerCell *parent);
384 ~wxHtmlContainerCell();
385
386 virtual void Layout(int w);
387 virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
388 wxHtmlRenderingInfo& info);
389 virtual void DrawInvisible(wxDC& dc, int x, int y,
390 wxHtmlRenderingInfo& info);
391 virtual bool AdjustPagebreak(int *pagebreak, int *known_pagebreaks = NULL, int number_of_pages = 0) const;
392
393 // insert cell at the end of m_Cells list
394 void InsertCell(wxHtmlCell *cell);
395
396 // sets horizontal/vertical alignment
397 void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;}
398 int GetAlignHor() const {return m_AlignHor;}
399 void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;}
400 int GetAlignVer() const {return m_AlignVer;}
401
402 // sets left-border indentation. units is one of wxHTML_UNITS_* constants
403 // what is combination of wxHTML_INDENT_*
404 void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
405 // returns the indentation. ind is one of wxHTML_INDENT_* constants
406 int GetIndent(int ind) const;
407 // returns type of value returned by GetIndent(ind)
408 int GetIndentUnits(int ind) const;
409
410 // sets alignment info based on given tag's params
411 void SetAlign(const wxHtmlTag& tag);
412 // sets floating width adjustment
413 // (examples : 32 percent of parent container,
414 // -15 pixels percent (this means 100 % - 15 pixels)
415 void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;}
416 void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0);
417 // sets minimal height of this container.
418 void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;}
419
420 void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = true; m_BkColour = clr;}
421 // returns background colour (of wxNullColour if none set), so that widgets can
422 // adapt to it:
423 wxColour GetBackgroundColour();
424 void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = true; m_BorderColour1 = clr1, m_BorderColour2 = clr2;}
425 virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const;
426 virtual const wxHtmlCell* Find(int condition, const void* param) const;
427 virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
428
429 virtual wxHtmlCell* GetFirstChild() const { return m_Cells; }
430 #if WXWIN_COMPATIBILITY_2_4
431 wxDEPRECATED( wxHtmlCell* GetFirstCell() const );
432 #endif
433 // returns last child cell:
434 wxHtmlCell* GetLastChild() const { return m_LastCell; }
435
436 // see comment in wxHtmlCell about this method
437 virtual bool IsTerminalCell() const { return false; }
438
439 virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y,
440 unsigned flags = wxHTML_FIND_EXACT) const;
441
442 virtual wxHtmlCell *GetFirstTerminal() const;
443 virtual wxHtmlCell *GetLastTerminal() const;
444
445
446 // Removes indentation on top or bottom of the container (i.e. above or
447 // below first/last terminal cell). For internal use only.
448 virtual void RemoveExtraSpacing(bool top, bool bottom);
449
450 // Returns the maximum possible length of the container.
451 // Call Layout at least once before using GetMaxTotalWidth()
452 virtual int GetMaxTotalWidth() const { return m_MaxTotalWidth; }
453
454 protected:
455 void UpdateRenderingStatePre(wxHtmlRenderingInfo& info,
456 wxHtmlCell *cell) const;
457 void UpdateRenderingStatePost(wxHtmlRenderingInfo& info,
458 wxHtmlCell *cell) const;
459
460 protected:
461 int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom;
462 // indentation of subcells. There is always m_Indent pixels
463 // big space between given border of the container and the subcells
464 // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels
465 int m_MinHeight, m_MinHeightAlign;
466 // minimal height.
467 wxHtmlCell *m_Cells, *m_LastCell;
468 // internal cells, m_Cells points to the first of them, m_LastCell to the last one.
469 // (LastCell is needed only to speed-up InsertCell)
470 int m_AlignHor, m_AlignVer;
471 // alignment horizontal and vertical (left, center, right)
472 int m_WidthFloat, m_WidthFloatUnits;
473 // width float is used in adjustWidth
474 bool m_UseBkColour;
475 wxColour m_BkColour;
476 // background color of this container
477 bool m_UseBorder;
478 wxColour m_BorderColour1, m_BorderColour2;
479 // borders color of this container
480 int m_LastLayout;
481 // if != -1 then call to Layout may be no-op
482 // if previous call to Layout has same argument
483 int m_MaxTotalWidth;
484 // Maximum possible length if ignoring line wrap
485
486
487 DECLARE_ABSTRACT_CLASS(wxHtmlContainerCell)
488 DECLARE_NO_COPY_CLASS(wxHtmlContainerCell)
489 };
490
491 #if WXWIN_COMPATIBILITY_2_4
492 inline wxHtmlCell* wxHtmlContainerCell::GetFirstCell() const
493 { return GetFirstChild(); }
494 #endif
495
496
497
498
499 // ---------------------------------------------------------------------------
500 // wxHtmlColourCell
501 // Color changer.
502 // ---------------------------------------------------------------------------
503
504 class WXDLLIMPEXP_HTML wxHtmlColourCell : public wxHtmlCell
505 {
506 public:
507 wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
508 virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
509 wxHtmlRenderingInfo& info);
510 virtual void DrawInvisible(wxDC& dc, int x, int y,
511 wxHtmlRenderingInfo& info);
512
513 protected:
514 wxColour m_Colour;
515 unsigned m_Flags;
516
517 DECLARE_ABSTRACT_CLASS(wxHtmlColourCell)
518 DECLARE_NO_COPY_CLASS(wxHtmlColourCell)
519 };
520
521
522
523
524 //--------------------------------------------------------------------------------
525 // wxHtmlFontCell
526 // Sets actual font used for text rendering
527 //--------------------------------------------------------------------------------
528
529 class WXDLLIMPEXP_HTML wxHtmlFontCell : public wxHtmlCell
530 {
531 public:
532 wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); }
533 virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
534 wxHtmlRenderingInfo& info);
535 virtual void DrawInvisible(wxDC& dc, int x, int y,
536 wxHtmlRenderingInfo& info);
537
538 protected:
539 wxFont m_Font;
540
541 DECLARE_ABSTRACT_CLASS(wxHtmlFontCell)
542 DECLARE_NO_COPY_CLASS(wxHtmlFontCell)
543 };
544
545
546
547
548
549
550 //--------------------------------------------------------------------------------
551 // wxHtmlwidgetCell
552 // This cell is connected with wxWindow object
553 // You can use it to insert windows into HTML page
554 // (buttons, input boxes etc.)
555 //--------------------------------------------------------------------------------
556
557 class WXDLLIMPEXP_HTML wxHtmlWidgetCell : public wxHtmlCell
558 {
559 public:
560 // !!! wnd must have correct parent!
561 // if w != 0 then the m_Wnd has 'floating' width - it adjust
562 // it's width according to parent container's width
563 // (w is percent of parent's width)
564 wxHtmlWidgetCell(wxWindow *wnd, int w = 0);
565 ~wxHtmlWidgetCell() { m_Wnd->Destroy(); }
566 virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
567 wxHtmlRenderingInfo& info);
568 virtual void DrawInvisible(wxDC& dc, int x, int y,
569 wxHtmlRenderingInfo& info);
570 virtual void Layout(int w);
571
572 protected:
573 wxWindow* m_Wnd;
574 int m_WidthFloat;
575 // width float is used in adjustWidth (it is in percents)
576
577 DECLARE_ABSTRACT_CLASS(wxHtmlWidgetCell)
578 DECLARE_NO_COPY_CLASS(wxHtmlWidgetCell)
579 };
580
581
582
583 //--------------------------------------------------------------------------------
584 // wxHtmlLinkInfo
585 // Internal data structure. It represents hypertext link
586 //--------------------------------------------------------------------------------
587
588 class WXDLLIMPEXP_HTML wxHtmlLinkInfo : public wxObject
589 {
590 public:
591 wxHtmlLinkInfo() : wxObject()
592 { m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; }
593 wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject()
594 { m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; }
595 wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject()
596 { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
597 m_Cell = l.m_Cell; }
598 wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l)
599 { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
600 m_Cell = l.m_Cell; return *this; }
601
602 void SetEvent(const wxMouseEvent *e) { m_Event = e; }
603 void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; }
604
605 wxString GetHref() const { return m_Href; }
606 wxString GetTarget() const { return m_Target; }
607 const wxMouseEvent* GetEvent() const { return m_Event; }
608 const wxHtmlCell* GetHtmlCell() const { return m_Cell; }
609
610 private:
611 wxString m_Href, m_Target;
612 const wxMouseEvent *m_Event;
613 const wxHtmlCell *m_Cell;
614 };
615
616
617
618 // ----------------------------------------------------------------------------
619 // wxHtmlTerminalCellsInterator
620 // ----------------------------------------------------------------------------
621
622 class WXDLLIMPEXP_HTML wxHtmlTerminalCellsInterator
623 {
624 public:
625 wxHtmlTerminalCellsInterator(const wxHtmlCell *from, const wxHtmlCell *to)
626 : m_to(to), m_pos(from) {}
627
628 operator bool() const { return m_pos != NULL; }
629 const wxHtmlCell* operator++();
630 const wxHtmlCell* operator->() const { return m_pos; }
631 const wxHtmlCell* operator*() const { return m_pos; }
632
633 private:
634 const wxHtmlCell *m_to, *m_pos;
635 };
636
637
638
639 #endif // wxUSE_HTML
640
641 #endif // _WX_HTMLCELL_H_
642