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