Centralized wxDefaultPosition and TRUE->true, FALSE->false replacements. After previo...
[wxWidgets.git] / src / html / htmlcell.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: htmlcell.cpp
3 // Purpose: wxHtmlCell - basic element of HTML output
4 // Author: Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows Licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11 #pragma implementation "htmlcell.h"
12 #endif
13
14 #include "wx/wxprec.h"
15
16 #include "wx/defs.h"
17
18 #if wxUSE_HTML && wxUSE_STREAMS
19
20 #ifdef __BORLANDC__
21 #pragma hdrstop
22 #endif
23
24 #ifndef WXPRECOMP
25 #include "wx/brush.h"
26 #include "wx/colour.h"
27 #include "wx/dc.h"
28 #endif
29
30 #include "wx/html/htmlcell.h"
31 #include "wx/html/htmlwin.h"
32 #include "wx/settings.h"
33 #include "wx/module.h"
34 #include "wx/dynarray.h"
35
36 #include <stdlib.h>
37
38 //-----------------------------------------------------------------------------
39 // Global variables
40 //-----------------------------------------------------------------------------
41
42 static wxCursor *gs_cursorLink = NULL;
43 static wxCursor *gs_cursorText = NULL;
44
45
46 //-----------------------------------------------------------------------------
47 // Helper classes
48 //-----------------------------------------------------------------------------
49
50 void wxHtmlSelection::Set(const wxPoint& fromPos, const wxHtmlCell *fromCell,
51 const wxPoint& toPos, const wxHtmlCell *toCell)
52 {
53 m_fromCell = fromCell;
54 m_toCell = toCell;
55 m_fromPos = fromPos;
56 m_toPos = toPos;
57 }
58
59 void wxHtmlSelection::Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell)
60 {
61 wxPoint p1 = fromCell ? fromCell->GetAbsPos() : wxDefaultPosition;
62 wxPoint p2 = toCell ? toCell->GetAbsPos() : wxDefaultPosition;
63 if ( toCell )
64 {
65 p2.x += toCell->GetWidth();
66 p2.y += toCell->GetHeight();
67 }
68 Set(p1, fromCell, p2, toCell);
69 }
70
71 wxColour
72 wxDefaultHtmlRenderingStyle::
73 GetSelectedTextColour(const wxColour& WXUNUSED(clr))
74 {
75 return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
76 }
77
78 wxColour
79 wxDefaultHtmlRenderingStyle::
80 GetSelectedTextBgColour(const wxColour& WXUNUSED(clr))
81 {
82 return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
83 }
84
85
86 //-----------------------------------------------------------------------------
87 // wxHtmlCell
88 //-----------------------------------------------------------------------------
89
90 IMPLEMENT_ABSTRACT_CLASS(wxHtmlCell, wxObject)
91
92 wxHtmlCell::wxHtmlCell() : wxObject()
93 {
94 m_Next = NULL;
95 m_Parent = NULL;
96 m_Width = m_Height = m_Descent = 0;
97 m_CanLiveOnPagebreak = true;
98 m_Link = NULL;
99 }
100
101 wxHtmlCell::~wxHtmlCell()
102 {
103 delete m_Link;
104 }
105
106
107 void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
108 const wxMouseEvent& event)
109 {
110 wxHtmlLinkInfo *lnk = GetLink(x, y);
111 if (lnk != NULL)
112 {
113 wxHtmlLinkInfo lnk2(*lnk);
114 lnk2.SetEvent(&event);
115 lnk2.SetHtmlCell(this);
116
117 // note : this cast is legal because parent is *always* wxHtmlWindow
118 wxStaticCast(parent, wxHtmlWindow)->OnLinkClicked(lnk2);
119 }
120 }
121
122
123 wxCursor wxHtmlCell::GetCursor() const
124 {
125 if ( GetLink() )
126 {
127 if ( !gs_cursorLink )
128 gs_cursorLink = new wxCursor(wxCURSOR_HAND);
129 return *gs_cursorLink;
130 }
131 else
132 return *wxSTANDARD_CURSOR;
133 }
134
135
136 bool wxHtmlCell::AdjustPagebreak(int *pagebreak, int* WXUNUSED(known_pagebreaks), int WXUNUSED(number_of_pages)) const
137 {
138 if ((!m_CanLiveOnPagebreak) &&
139 m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
140 {
141 *pagebreak = m_PosY;
142 return true;
143 }
144
145 return false;
146 }
147
148
149
150 void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
151 {
152 if (m_Link) delete m_Link;
153 m_Link = NULL;
154 if (link.GetHref() != wxEmptyString)
155 m_Link = new wxHtmlLinkInfo(link);
156 }
157
158
159 void wxHtmlCell::Layout(int WXUNUSED(w))
160 {
161 SetPos(0, 0);
162 }
163
164
165
166 const wxHtmlCell* wxHtmlCell::Find(int WXUNUSED(condition), const void* WXUNUSED(param)) const
167 {
168 return NULL;
169 }
170
171
172 wxHtmlCell *wxHtmlCell::FindCellByPos(wxCoord x, wxCoord y,
173 unsigned flags) const
174 {
175 if ( x >= 0 && x < m_Width && y >= 0 && y < m_Height )
176 {
177 return wxConstCast(this, wxHtmlCell);
178 }
179 else
180 {
181 if ((flags & wxHTML_FIND_NEAREST_AFTER) &&
182 (y < 0 || (y < 0+m_Height && x < 0+m_Width)))
183 return wxConstCast(this, wxHtmlCell);
184 else if ((flags & wxHTML_FIND_NEAREST_BEFORE) &&
185 (y >= 0+m_Height || (y >= 0 && x >= 0)))
186 return wxConstCast(this, wxHtmlCell);
187 else
188 return NULL;
189 }
190 }
191
192
193 wxPoint wxHtmlCell::GetAbsPos() const
194 {
195 wxPoint p(m_PosX, m_PosY);
196 for (wxHtmlCell *parent = m_Parent; parent; parent = parent->m_Parent)
197 {
198 p.x += parent->m_PosX;
199 p.y += parent->m_PosY;
200 }
201 return p;
202 }
203
204 unsigned wxHtmlCell::GetDepth() const
205 {
206 unsigned d = 0;
207 for (wxHtmlCell *p = m_Parent; p; p = p->m_Parent)
208 d++;
209 return d;
210 }
211
212 bool wxHtmlCell::IsBefore(wxHtmlCell *cell) const
213 {
214 const wxHtmlCell *c1 = this;
215 const wxHtmlCell *c2 = cell;
216 unsigned d1 = GetDepth();
217 unsigned d2 = cell->GetDepth();
218
219 if ( d1 > d2 )
220 for (; d1 != d2; d1-- )
221 c1 = c1->m_Parent;
222 else if ( d1 < d2 )
223 for (; d1 != d2; d2-- )
224 c2 = c2->m_Parent;
225
226 if ( cell == this )
227 return true;
228
229 while ( c1 && c2 )
230 {
231 if ( c1->m_Parent == c2->m_Parent )
232 {
233 while ( c1 )
234 {
235 if ( c1 == c2 )
236 return true;
237 c1 = c1->GetNext();
238 }
239 return false;
240 }
241 else
242 {
243 c1 = c1->m_Parent;
244 c2 = c2->m_Parent;
245 }
246 }
247
248 wxFAIL_MSG(_T("Cells are in different trees"));
249 return false;
250 }
251
252
253 //-----------------------------------------------------------------------------
254 // wxHtmlWordCell
255 //-----------------------------------------------------------------------------
256
257 IMPLEMENT_ABSTRACT_CLASS(wxHtmlWordCell, wxHtmlCell)
258
259 wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
260 {
261 m_Word = word;
262 dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
263 SetCanLiveOnPagebreak(false);
264 m_allowLinebreak = true;
265 }
266
267 void wxHtmlWordCell::SetPreviousWord(wxHtmlWordCell *cell)
268 {
269 if ( cell && m_Parent == cell->m_Parent &&
270 !wxIsspace(cell->m_Word.Last()) && !wxIsspace(m_Word[0u]) )
271 {
272 m_allowLinebreak = false;
273 }
274 }
275
276 // Splits m_Word into up to three parts according to selection, returns
277 // substring before, in and after selection and the points (in relative coords)
278 // where s2 and s3 start:
279 void wxHtmlWordCell::Split(wxDC& dc,
280 const wxPoint& selFrom, const wxPoint& selTo,
281 unsigned& pos1, unsigned& pos2) const
282 {
283 wxPoint pt1 = (selFrom == wxDefaultPosition) ?
284 wxDefaultPosition : selFrom - GetAbsPos();
285 wxPoint pt2 = (selTo == wxDefaultPosition) ?
286 wxPoint(m_Width, wxDefaultPosition.y) : selTo - GetAbsPos();
287
288 wxCoord charW, charH;
289 unsigned len = m_Word.length();
290 unsigned i = 0;
291 pos1 = 0;
292
293 // adjust for cases when the start/end position is completely
294 // outside the cell:
295 if ( pt1.y < 0 )
296 pt1.x = 0;
297 if ( pt2.y >= m_Height )
298 pt2.x = m_Width;
299
300 // before selection:
301 while ( pt1.x > 0 && i < len )
302 {
303 dc.GetTextExtent(m_Word[i], &charW, &charH);
304 pt1.x -= charW;
305 if ( pt1.x >= 0 )
306 {
307 pos1 += charW;
308 i++;
309 }
310 }
311
312 // in selection:
313 unsigned j = i;
314 pos2 = pos1;
315 pt2.x -= pos2;
316 while ( pt2.x > 0 && j < len )
317 {
318 dc.GetTextExtent(m_Word[j], &charW, &charH);
319 pt2.x -= charW;
320 if ( pt2.x >= 0 )
321 {
322 pos2 += charW;
323 j++;
324 }
325 }
326
327 pos1 = i;
328 pos2 = j;
329 }
330
331 void wxHtmlWordCell::SetSelectionPrivPos(wxDC& dc, wxHtmlSelection *s) const
332 {
333 unsigned p1, p2;
334
335 Split(dc,
336 this == s->GetFromCell() ? s->GetFromPos() : wxDefaultPosition,
337 this == s->GetToCell() ? s->GetToPos() : wxDefaultPosition,
338 p1, p2);
339
340 wxPoint p(0, m_Word.length());
341
342 if ( this == s->GetFromCell() )
343 p.x = p1; // selection starts here
344 if ( this == s->GetToCell() )
345 p.y = p2; // selection ends here
346
347 if ( this == s->GetFromCell() )
348 s->SetFromPrivPos(p);
349 if ( this == s->GetToCell() )
350 s->SetToPrivPos(p);
351 }
352
353
354 static void SwitchSelState(wxDC& dc, wxHtmlRenderingInfo& info,
355 bool toSelection)
356 {
357 wxColour fg = info.GetState().GetFgColour();
358 wxColour bg = info.GetState().GetBgColour();
359
360 if ( toSelection )
361 {
362 dc.SetBackgroundMode(wxSOLID);
363 dc.SetTextForeground(info.GetStyle().GetSelectedTextColour(fg));
364 dc.SetTextBackground(info.GetStyle().GetSelectedTextBgColour(bg));
365 dc.SetBackground(wxBrush(info.GetStyle().GetSelectedTextBgColour(bg),
366 wxSOLID));
367 }
368 else
369 {
370 dc.SetBackgroundMode(wxTRANSPARENT);
371 dc.SetTextForeground(fg);
372 dc.SetTextBackground(bg);
373 dc.SetBackground(wxBrush(bg, wxSOLID));
374 }
375 }
376
377
378 void wxHtmlWordCell::Draw(wxDC& dc, int x, int y,
379 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
380 wxHtmlRenderingInfo& info)
381 {
382 #if 0 // useful for debugging
383 dc.SetPen(*wxBLACK_PEN);
384 dc.DrawRectangle(x+m_PosX,y+m_PosY,m_Width,m_Height);
385 #endif
386
387 bool drawSelectionAfterCell = false;
388
389 if ( info.GetState().GetSelectionState() == wxHTML_SEL_CHANGING )
390 {
391 // Selection changing, we must draw the word piecewise:
392 wxHtmlSelection *s = info.GetSelection();
393 wxString txt;
394 int w, h;
395 int ofs = 0;
396
397 wxPoint priv = (this == s->GetFromCell()) ?
398 s->GetFromPrivPos() : s->GetToPrivPos();
399
400 // NB: this is quite a hack: in order to compute selection boundaries
401 // (in word's characters) we must know current font, which is only
402 // possible inside rendering code. Therefore we update the
403 // information here and store it in wxHtmlSelection so that
404 // ConvertToText can use it later:
405 if ( priv == wxDefaultPosition )
406 {
407 SetSelectionPrivPos(dc, s);
408 priv = (this == s->GetFromCell()) ?
409 s->GetFromPrivPos() : s->GetToPrivPos();
410 }
411
412 int part1 = priv.x;
413 int part2 = priv.y;
414
415 if ( part1 > 0 )
416 {
417 txt = m_Word.Mid(0, part1);
418 dc.DrawText(txt, x + m_PosX, y + m_PosY);
419 dc.GetTextExtent(txt, &w, &h);
420 ofs += w;
421 }
422
423 SwitchSelState(dc, info, true);
424
425 txt = m_Word.Mid(part1, part2-part1);
426 dc.DrawText(txt, ofs + x + m_PosX, y + m_PosY);
427
428 if ( (size_t)part2 < m_Word.length() )
429 {
430 dc.GetTextExtent(txt, &w, &h);
431 ofs += w;
432 SwitchSelState(dc, info, false);
433 txt = m_Word.Mid(part2);
434 dc.DrawText(txt, ofs + x + m_PosX, y + m_PosY);
435 }
436 else
437 drawSelectionAfterCell = true;
438 }
439 else
440 {
441 wxHtmlSelectionState selstate = info.GetState().GetSelectionState();
442 // Not changing selection state, draw the word in single mode:
443 if ( selstate != wxHTML_SEL_OUT &&
444 dc.GetBackgroundMode() != wxSOLID )
445 {
446 SwitchSelState(dc, info, true);
447 }
448 else if ( selstate == wxHTML_SEL_OUT &&
449 dc.GetBackgroundMode() == wxSOLID )
450 {
451 SwitchSelState(dc, info, false);
452 }
453 dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
454 drawSelectionAfterCell = (selstate != wxHTML_SEL_OUT);
455 }
456
457 // NB: If the text is justified then there is usually some free space
458 // between adjacent cells and drawing the selection only onto cells
459 // would result in ugly unselected spaces. The code below detects
460 // this special case and renders the selection *outside* the sell,
461 // too.
462 if ( m_Parent->GetAlignHor() == wxHTML_ALIGN_JUSTIFY &&
463 drawSelectionAfterCell )
464 {
465 wxHtmlCell *nextCell = m_Next;
466 while ( nextCell && nextCell->IsFormattingCell() )
467 nextCell = nextCell->GetNext();
468 if ( nextCell )
469 {
470 int nextX = nextCell->GetPosX();
471 if ( m_PosX + m_Width < nextX )
472 {
473 dc.SetBrush(dc.GetBackground());
474 dc.SetPen(*wxTRANSPARENT_PEN);
475 dc.DrawRectangle(x + m_PosX + m_Width, y + m_PosY,
476 nextX - m_PosX - m_Width, m_Height);
477 }
478 }
479 }
480 }
481
482
483 wxString wxHtmlWordCell::ConvertToText(wxHtmlSelection *s) const
484 {
485 if ( s && (this == s->GetFromCell() || this == s->GetToCell()) )
486 {
487 wxPoint priv = this == s->GetFromCell() ? s->GetFromPrivPos()
488 : s->GetToPrivPos();
489
490 // VZ: we may be called before we had a chance to re-render ourselves
491 // and in this case GetFrom/ToPrivPos() is not set yet -- assume
492 // that this only happens in case of a double/triple click (which
493 // seems to be the case now) and so it makes sense to select the
494 // entire contents of the cell in this case
495 //
496 // TODO: but this really needs to be fixed in some better way later...
497 if ( priv != wxDefaultPosition )
498 {
499 int part1 = priv.x;
500 int part2 = priv.y;
501 return m_Word.Mid(part1, part2-part1);
502 }
503 //else: return the whole word below
504 }
505
506 return m_Word;
507 }
508
509 wxCursor wxHtmlWordCell::GetCursor() const
510 {
511 if ( !GetLink() )
512 {
513 if ( !gs_cursorText )
514 gs_cursorText = new wxCursor(wxCURSOR_IBEAM);
515 return *gs_cursorText;
516 }
517 else
518 return wxHtmlCell::GetCursor();
519 }
520
521
522 //-----------------------------------------------------------------------------
523 // wxHtmlContainerCell
524 //-----------------------------------------------------------------------------
525
526 IMPLEMENT_ABSTRACT_CLASS(wxHtmlContainerCell, wxHtmlCell)
527
528 wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCell()
529 {
530 m_Cells = m_LastCell = NULL;
531 m_Parent = parent;
532 m_MaxTotalWidth = 0;
533 if (m_Parent) m_Parent->InsertCell(this);
534 m_AlignHor = wxHTML_ALIGN_LEFT;
535 m_AlignVer = wxHTML_ALIGN_BOTTOM;
536 m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
537 m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT;
538 m_UseBkColour = false;
539 m_UseBorder = false;
540 m_MinHeight = 0;
541 m_MinHeightAlign = wxHTML_ALIGN_TOP;
542 m_LastLayout = -1;
543 }
544
545 wxHtmlContainerCell::~wxHtmlContainerCell()
546 {
547 wxHtmlCell *cell = m_Cells;
548 while ( cell )
549 {
550 wxHtmlCell *cellNext = cell->GetNext();
551 delete cell;
552 cell = cellNext;
553 }
554 }
555
556
557
558 void wxHtmlContainerCell::SetIndent(int i, int what, int units)
559 {
560 int val = (units == wxHTML_UNITS_PIXELS) ? i : -i;
561 if (what & wxHTML_INDENT_LEFT) m_IndentLeft = val;
562 if (what & wxHTML_INDENT_RIGHT) m_IndentRight = val;
563 if (what & wxHTML_INDENT_TOP) m_IndentTop = val;
564 if (what & wxHTML_INDENT_BOTTOM) m_IndentBottom = val;
565 m_LastLayout = -1;
566 }
567
568
569
570 int wxHtmlContainerCell::GetIndent(int ind) const
571 {
572 if (ind & wxHTML_INDENT_LEFT) return m_IndentLeft;
573 else if (ind & wxHTML_INDENT_RIGHT) return m_IndentRight;
574 else if (ind & wxHTML_INDENT_TOP) return m_IndentTop;
575 else if (ind & wxHTML_INDENT_BOTTOM) return m_IndentBottom;
576 else return -1; /* BUG! Should not be called... */
577 }
578
579
580
581
582 int wxHtmlContainerCell::GetIndentUnits(int ind) const
583 {
584 bool p = false;
585 if (ind & wxHTML_INDENT_LEFT) p = m_IndentLeft < 0;
586 else if (ind & wxHTML_INDENT_RIGHT) p = m_IndentRight < 0;
587 else if (ind & wxHTML_INDENT_TOP) p = m_IndentTop < 0;
588 else if (ind & wxHTML_INDENT_BOTTOM) p = m_IndentBottom < 0;
589 if (p) return wxHTML_UNITS_PERCENT;
590 else return wxHTML_UNITS_PIXELS;
591 }
592
593
594
595 bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak, int* known_pagebreaks, int number_of_pages) const
596 {
597 if (!m_CanLiveOnPagebreak)
598 return wxHtmlCell::AdjustPagebreak(pagebreak, known_pagebreaks, number_of_pages);
599
600 else
601 {
602 wxHtmlCell *c = GetFirstChild();
603 bool rt = false;
604 int pbrk = *pagebreak - m_PosY;
605
606 while (c)
607 {
608 if (c->AdjustPagebreak(&pbrk, known_pagebreaks, number_of_pages))
609 rt = true;
610 c = c->GetNext();
611 }
612 if (rt)
613 *pagebreak = pbrk + m_PosY;
614 return rt;
615 }
616 }
617
618
619
620 void wxHtmlContainerCell::Layout(int w)
621 {
622 wxHtmlCell::Layout(w);
623
624 if (m_LastLayout == w) return;
625
626 // VS: Any attempt to layout with negative or zero width leads to hell,
627 // but we can't ignore such attempts completely, since it sometimes
628 // happen (e.g. when trying how small a table can be). The best thing we
629 // can do is to set the width of child cells to zero
630 if (w < 1)
631 {
632 m_Width = 0;
633 for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
634 cell->Layout(0);
635 // this does two things: it recursively calls this code on all
636 // child contrainers and resets children's position to (0,0)
637 return;
638 }
639
640 wxHtmlCell *cell = m_Cells,
641 *line = m_Cells;
642 wxHtmlCell *nextCell;
643 long xpos = 0, ypos = m_IndentTop;
644 int xdelta = 0, ybasicpos = 0, ydiff;
645 int s_width, nextWordWidth, s_indent;
646 int ysizeup = 0, ysizedown = 0;
647 int MaxLineWidth = 0;
648 int curLineWidth = 0;
649 m_MaxTotalWidth = 0;
650
651
652 /*
653
654 WIDTH ADJUSTING :
655
656 */
657
658 if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
659 {
660 if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
661 else m_Width = m_WidthFloat * w / 100;
662 }
663 else
664 {
665 if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
666 else m_Width = m_WidthFloat;
667 }
668
669 if (m_Cells)
670 {
671 int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
672 int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
673 for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
674 cell->Layout(m_Width - (l + r));
675 }
676
677 /*
678
679 LAYOUTING :
680
681 */
682
683 // adjust indentation:
684 s_indent = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
685 s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
686
687 // my own layouting:
688 while (cell != NULL)
689 {
690 switch (m_AlignVer)
691 {
692 case wxHTML_ALIGN_TOP : ybasicpos = 0; break;
693 case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
694 case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
695 }
696 ydiff = cell->GetHeight() + ybasicpos;
697
698 if (cell->GetDescent() + ydiff > ysizedown) ysizedown = cell->GetDescent() + ydiff;
699 if (ybasicpos + cell->GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell->GetDescent());
700
701 // layout nonbreakable run of cells:
702 cell->SetPos(xpos, ybasicpos + cell->GetDescent());
703 xpos += cell->GetWidth();
704 if (!cell->IsTerminalCell())
705 {
706 // Container cell indicates new line
707 if (curLineWidth > m_MaxTotalWidth)
708 m_MaxTotalWidth = curLineWidth;
709
710 if (wxMax(cell->GetWidth(), cell->GetMaxTotalWidth()) > m_MaxTotalWidth)
711 m_MaxTotalWidth = cell->GetMaxTotalWidth();
712 curLineWidth = 0;
713 }
714 else
715 // Normal cell, add maximum cell width to line width
716 curLineWidth += cell->GetMaxTotalWidth();
717
718 cell = cell->GetNext();
719
720 // compute length of the next word that would be added:
721 nextWordWidth = 0;
722 if (cell)
723 {
724 nextCell = cell;
725 do
726 {
727 nextWordWidth += nextCell->GetWidth();
728 nextCell = nextCell->GetNext();
729 } while (nextCell && !nextCell->IsLinebreakAllowed());
730 }
731
732 // force new line if occured:
733 if ((cell == NULL) ||
734 (xpos + nextWordWidth > s_width && cell->IsLinebreakAllowed()))
735 {
736 if (xpos > MaxLineWidth) MaxLineWidth = xpos;
737 if (ysizeup < 0) ysizeup = 0;
738 if (ysizedown < 0) ysizedown = 0;
739 switch (m_AlignHor) {
740 case wxHTML_ALIGN_LEFT :
741 case wxHTML_ALIGN_JUSTIFY :
742 xdelta = 0;
743 break;
744 case wxHTML_ALIGN_RIGHT :
745 xdelta = 0 + (s_width - xpos);
746 break;
747 case wxHTML_ALIGN_CENTER :
748 xdelta = 0 + (s_width - xpos) / 2;
749 break;
750 }
751 if (xdelta < 0) xdelta = 0;
752 xdelta += s_indent;
753
754 ypos += ysizeup;
755
756 if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL)
757 {
758 while (line != cell)
759 {
760 line->SetPos(line->GetPosX() + xdelta,
761 ypos + line->GetPosY());
762 line = line->GetNext();
763 }
764 }
765 else // align == justify
766 {
767 // we have to distribute the extra horz space between the cells
768 // on this line
769
770 // an added complication is that some cells have fixed size and
771 // shouldn't get any increment (it so happens that these cells
772 // also don't allow line break on them which provides with an
773 // easy way to test for this)
774
775 const int step = s_width - xpos;
776 if ( step > 0 )
777 {
778 // first count the cells which will get extra space
779 int total = 0;
780 for ( wxHtmlCell *c = line; c != cell; c = c->GetNext() )
781 {
782 if ( c->IsLinebreakAllowed() )
783 total++;
784 }
785
786 // and now extra space to those cells which merit it
787 if ( total )
788 {
789 for ( int n = 0; line != cell; line = line->GetNext() )
790 {
791 line->SetPos(line->GetPosX() + s_indent +
792 ((n * step) / total),
793 line->GetPosY() + ypos);
794
795 if ( line->IsLinebreakAllowed() )
796 {
797 // offset the next cell relative to this one
798 // thus increasing our size
799 n++;
800 }
801 }
802 }
803 }
804 else // no extra space to distribute
805 {
806 // just set the indent properly
807 while (line != cell)
808 {
809 line->SetPos(line->GetPosX() + s_indent,
810 line->GetPosY() + ypos);
811 line = line->GetNext();
812 }
813 }
814 }
815
816 ypos += ysizedown;
817 xpos = 0;
818 ysizeup = ysizedown = 0;
819 line = cell;
820 }
821 }
822
823 // setup height & width, depending on container layout:
824 m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
825
826 if (m_Height < m_MinHeight)
827 {
828 if (m_MinHeightAlign != wxHTML_ALIGN_TOP)
829 {
830 int diff = m_MinHeight - m_Height;
831 if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
832 cell = m_Cells;
833 while (cell)
834 {
835 cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff);
836 cell = cell->GetNext();
837 }
838 }
839 m_Height = m_MinHeight;
840 }
841
842 if (curLineWidth > m_MaxTotalWidth)
843 m_MaxTotalWidth = curLineWidth;
844
845 m_MaxTotalWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
846 MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
847 if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;
848
849 m_LastLayout = w;
850 }
851
852 void wxHtmlContainerCell::UpdateRenderingStatePre(wxHtmlRenderingInfo& info,
853 wxHtmlCell *cell) const
854 {
855 wxHtmlSelection *s = info.GetSelection();
856 if (!s) return;
857 if (s->GetFromCell() == cell || s->GetToCell() == cell)
858 {
859 info.GetState().SetSelectionState(wxHTML_SEL_CHANGING);
860 }
861 }
862
863 void wxHtmlContainerCell::UpdateRenderingStatePost(wxHtmlRenderingInfo& info,
864 wxHtmlCell *cell) const
865 {
866 wxHtmlSelection *s = info.GetSelection();
867 if (!s) return;
868 if (s->GetToCell() == cell)
869 info.GetState().SetSelectionState(wxHTML_SEL_OUT);
870 else if (s->GetFromCell() == cell)
871 info.GetState().SetSelectionState(wxHTML_SEL_IN);
872 }
873
874 #define mMin(a, b) (((a) < (b)) ? (a) : (b))
875 #define mMax(a, b) (((a) < (b)) ? (b) : (a))
876
877 void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
878 wxHtmlRenderingInfo& info)
879 {
880 #if 0 // useful for debugging
881 dc.SetPen(*wxRED_PEN);
882 dc.DrawRectangle(x+m_PosX,y+m_PosY,m_Width,m_Height);
883 #endif
884 // container visible, draw it:
885 if ((y + m_PosY <= view_y2) && (y + m_PosY + m_Height > view_y1))
886 {
887 if (m_UseBkColour)
888 {
889 wxBrush myb = wxBrush(m_BkColour, wxSOLID);
890
891 int real_y1 = mMax(y + m_PosY, view_y1);
892 int real_y2 = mMin(y + m_PosY + m_Height - 1, view_y2);
893
894 dc.SetBrush(myb);
895 dc.SetPen(*wxTRANSPARENT_PEN);
896 dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
897 }
898
899 if (m_UseBorder)
900 {
901 wxPen mypen1(m_BorderColour1, 1, wxSOLID);
902 wxPen mypen2(m_BorderColour2, 1, wxSOLID);
903
904 dc.SetPen(mypen1);
905 dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX, y + m_PosY + m_Height - 1);
906 dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX + m_Width, y + m_PosY);
907 dc.SetPen(mypen2);
908 dc.DrawLine(x + m_PosX + m_Width - 1, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
909 dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width, y + m_PosY + m_Height - 1);
910 }
911
912 if (m_Cells)
913 {
914 // draw container's contents:
915 for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
916 {
917 UpdateRenderingStatePre(info, cell);
918 cell->Draw(dc,
919 x + m_PosX, y + m_PosY, view_y1, view_y2,
920 info);
921 UpdateRenderingStatePost(info, cell);
922 }
923 }
924 }
925 // container invisible, just proceed font+color changing:
926 else
927 {
928 DrawInvisible(dc, x, y, info);
929 }
930 }
931
932
933
934 void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y,
935 wxHtmlRenderingInfo& info)
936 {
937 if (m_Cells)
938 {
939 for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
940 {
941 UpdateRenderingStatePre(info, cell);
942 cell->DrawInvisible(dc, x + m_PosX, y + m_PosY, info);
943 UpdateRenderingStatePost(info, cell);
944 }
945 }
946 }
947
948
949 wxColour wxHtmlContainerCell::GetBackgroundColour()
950 {
951 if (m_UseBkColour)
952 return m_BkColour;
953 else
954 return wxNullColour;
955 }
956
957
958
959 wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
960 {
961 wxHtmlCell *cell = FindCellByPos(x, y);
962
963 // VZ: I don't know if we should pass absolute or relative coords to
964 // wxHtmlCell::GetLink()? As the base class version just ignores them
965 // anyhow, it hardly matters right now but should still be clarified
966 return cell ? cell->GetLink(x, y) : NULL;
967 }
968
969
970
971 void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
972 {
973 if (!m_Cells) m_Cells = m_LastCell = f;
974 else
975 {
976 m_LastCell->SetNext(f);
977 m_LastCell = f;
978 if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext();
979 }
980 f->SetParent(this);
981 m_LastLayout = -1;
982 }
983
984
985
986 void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
987 {
988 if (tag.HasParam(wxT("ALIGN")))
989 {
990 wxString alg = tag.GetParam(wxT("ALIGN"));
991 alg.MakeUpper();
992 if (alg == wxT("CENTER"))
993 SetAlignHor(wxHTML_ALIGN_CENTER);
994 else if (alg == wxT("LEFT"))
995 SetAlignHor(wxHTML_ALIGN_LEFT);
996 else if (alg == wxT("JUSTIFY"))
997 SetAlignHor(wxHTML_ALIGN_JUSTIFY);
998 else if (alg == wxT("RIGHT"))
999 SetAlignHor(wxHTML_ALIGN_RIGHT);
1000 m_LastLayout = -1;
1001 }
1002 }
1003
1004
1005
1006 void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
1007 {
1008 if (tag.HasParam(wxT("WIDTH")))
1009 {
1010 int wdi;
1011 wxString wd = tag.GetParam(wxT("WIDTH"));
1012
1013 if (wd[wd.Length()-1] == wxT('%'))
1014 {
1015 wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
1016 SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
1017 }
1018 else
1019 {
1020 wxSscanf(wd.c_str(), wxT("%i"), &wdi);
1021 SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
1022 }
1023 m_LastLayout = -1;
1024 }
1025 }
1026
1027
1028
1029 const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const
1030 {
1031 if (m_Cells)
1032 {
1033 for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
1034 {
1035 const wxHtmlCell *r = cell->Find(condition, param);
1036 if (r) return r;
1037 }
1038 }
1039 return NULL;
1040 }
1041
1042
1043 wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y,
1044 unsigned flags) const
1045 {
1046 if ( flags & wxHTML_FIND_EXACT )
1047 {
1048 for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
1049 {
1050 int cx = cell->GetPosX(),
1051 cy = cell->GetPosY();
1052
1053 if ( (cx <= x) && (cx + cell->GetWidth() > x) &&
1054 (cy <= y) && (cy + cell->GetHeight() > y) )
1055 {
1056 return cell->FindCellByPos(x - cx, y - cy, flags);
1057 }
1058 }
1059 }
1060 else if ( flags & wxHTML_FIND_NEAREST_AFTER )
1061 {
1062 wxHtmlCell *c;
1063 for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
1064 {
1065 if ( cell->IsFormattingCell() )
1066 continue;
1067 int cellY = cell->GetPosY();
1068 if (!( y < cellY || (y < cellY + cell->GetHeight() &&
1069 x < cell->GetPosX() + cell->GetWidth()) ))
1070 continue;
1071
1072 c = cell->FindCellByPos(x - cell->GetPosX(), y - cellY, flags);
1073 if (c) return c;
1074 }
1075 }
1076 else if ( flags & wxHTML_FIND_NEAREST_BEFORE )
1077 {
1078 wxHtmlCell *c2, *c = NULL;
1079 for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
1080 {
1081 if ( cell->IsFormattingCell() )
1082 continue;
1083 int cellY = cell->GetPosY();
1084 if (!( cellY + cell->GetHeight() <= y ||
1085 (y >= cellY && x >= cell->GetPosX()) ))
1086 break;
1087 c2 = cell->FindCellByPos(x - cell->GetPosX(), y - cellY, flags);
1088 if (c2)
1089 c = c2;
1090 }
1091 if (c) return c;
1092 }
1093
1094 return NULL;
1095 }
1096
1097
1098 void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
1099 {
1100 wxHtmlCell *cell = FindCellByPos(x, y);
1101 if ( cell )
1102 cell->OnMouseClick(parent, x, y, event);
1103 }
1104
1105
1106
1107 wxHtmlCell *wxHtmlContainerCell::GetFirstTerminal() const
1108 {
1109 if ( m_Cells )
1110 {
1111 wxHtmlCell *c2;
1112 for (wxHtmlCell *c = m_Cells; c; c = c->GetNext())
1113 {
1114 c2 = c->GetFirstTerminal();
1115 if ( c2 )
1116 return c2;
1117 }
1118 }
1119 return NULL;
1120 }
1121
1122 wxHtmlCell *wxHtmlContainerCell::GetLastTerminal() const
1123 {
1124 if ( m_Cells )
1125 {
1126 // most common case first:
1127 wxHtmlCell *c = m_LastCell->GetLastTerminal();
1128 if ( c )
1129 return c;
1130
1131 wxHtmlCell *ctmp;
1132 wxHtmlCell *c2 = NULL;
1133 for (c = m_Cells; c; c = c->GetNext())
1134 {
1135 ctmp = c->GetLastTerminal();
1136 if ( ctmp )
1137 c2 = ctmp;
1138 }
1139 return c2;
1140 }
1141 else
1142 return NULL;
1143 }
1144
1145
1146 static bool IsEmptyContainer(wxHtmlContainerCell *cell)
1147 {
1148 for ( wxHtmlCell *c = cell->GetFirstChild(); c; c = c->GetNext() )
1149 {
1150 if ( !c->IsTerminalCell() || !c->IsFormattingCell() )
1151 return false;
1152 }
1153 return true;
1154 }
1155
1156 void wxHtmlContainerCell::RemoveExtraSpacing(bool top, bool bottom)
1157 {
1158 if ( top )
1159 SetIndent(0, wxHTML_INDENT_TOP);
1160 if ( bottom )
1161 SetIndent(0, wxHTML_INDENT_BOTTOM);
1162
1163 if ( m_Cells )
1164 {
1165 wxHtmlCell *c;
1166 wxHtmlContainerCell *cont;
1167 if ( top )
1168 {
1169 for ( c = m_Cells; c; c = c->GetNext() )
1170 {
1171 if ( c->IsTerminalCell() )
1172 {
1173 if ( !c->IsFormattingCell() )
1174 break;
1175 }
1176 else
1177 {
1178 cont = (wxHtmlContainerCell*)c;
1179 if ( IsEmptyContainer(cont) )
1180 {
1181 cont->SetIndent(0, wxHTML_INDENT_VERTICAL);
1182 }
1183 else
1184 {
1185 cont->RemoveExtraSpacing(true, false);
1186 break;
1187 }
1188 }
1189 }
1190 }
1191
1192 if ( bottom )
1193 {
1194 wxArrayPtrVoid arr;
1195 for ( c = m_Cells; c; c = c->GetNext() )
1196 arr.Add((void*)c);
1197
1198 for ( int i = arr.GetCount() - 1; i >= 0; i--)
1199 {
1200 c = (wxHtmlCell*)arr[i];
1201 if ( c->IsTerminalCell() )
1202 {
1203 if ( !c->IsFormattingCell() )
1204 break;
1205 }
1206 else
1207 {
1208 cont = (wxHtmlContainerCell*)c;
1209 if ( IsEmptyContainer(cont) )
1210 {
1211 cont->SetIndent(0, wxHTML_INDENT_VERTICAL); }
1212 else
1213 {
1214 cont->RemoveExtraSpacing(false, true);
1215 break;
1216 }
1217 }
1218 }
1219 }
1220 }
1221 }
1222
1223
1224
1225
1226 // --------------------------------------------------------------------------
1227 // wxHtmlColourCell
1228 // --------------------------------------------------------------------------
1229
1230 IMPLEMENT_ABSTRACT_CLASS(wxHtmlColourCell, wxHtmlCell)
1231
1232 void wxHtmlColourCell::Draw(wxDC& dc,
1233 int x, int y,
1234 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
1235 wxHtmlRenderingInfo& info)
1236 {
1237 DrawInvisible(dc, x, y, info);
1238 }
1239
1240 void wxHtmlColourCell::DrawInvisible(wxDC& dc,
1241 int WXUNUSED(x), int WXUNUSED(y),
1242 wxHtmlRenderingInfo& info)
1243 {
1244 wxHtmlRenderingState& state = info.GetState();
1245 if (m_Flags & wxHTML_CLR_FOREGROUND)
1246 {
1247 state.SetFgColour(m_Colour);
1248 if (state.GetSelectionState() != wxHTML_SEL_IN)
1249 dc.SetTextForeground(m_Colour);
1250 else
1251 dc.SetTextForeground(
1252 info.GetStyle().GetSelectedTextColour(m_Colour));
1253 }
1254 if (m_Flags & wxHTML_CLR_BACKGROUND)
1255 {
1256 state.SetBgColour(m_Colour);
1257 if (state.GetSelectionState() != wxHTML_SEL_IN)
1258 {
1259 dc.SetTextBackground(m_Colour);
1260 dc.SetBackground(wxBrush(m_Colour, wxSOLID));
1261 }
1262 else
1263 {
1264 wxColour c = info.GetStyle().GetSelectedTextBgColour(m_Colour);
1265 dc.SetTextBackground(c);
1266 dc.SetBackground(wxBrush(c, wxSOLID));
1267 }
1268 }
1269 }
1270
1271
1272
1273
1274 // ---------------------------------------------------------------------------
1275 // wxHtmlFontCell
1276 // ---------------------------------------------------------------------------
1277
1278 IMPLEMENT_ABSTRACT_CLASS(wxHtmlFontCell, wxHtmlCell)
1279
1280 void wxHtmlFontCell::Draw(wxDC& dc,
1281 int WXUNUSED(x), int WXUNUSED(y),
1282 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
1283 wxHtmlRenderingInfo& WXUNUSED(info))
1284 {
1285 dc.SetFont(m_Font);
1286 }
1287
1288 void wxHtmlFontCell::DrawInvisible(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y),
1289 wxHtmlRenderingInfo& WXUNUSED(info))
1290 {
1291 dc.SetFont(m_Font);
1292 }
1293
1294
1295
1296
1297
1298
1299
1300
1301 // ---------------------------------------------------------------------------
1302 // wxHtmlWidgetCell
1303 // ---------------------------------------------------------------------------
1304
1305 IMPLEMENT_ABSTRACT_CLASS(wxHtmlWidgetCell, wxHtmlCell)
1306
1307 wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow *wnd, int w)
1308 {
1309 int sx, sy;
1310 m_Wnd = wnd;
1311 m_Wnd->GetSize(&sx, &sy);
1312 m_Width = sx, m_Height = sy;
1313 m_WidthFloat = w;
1314 }
1315
1316
1317 void wxHtmlWidgetCell::Draw(wxDC& WXUNUSED(dc),
1318 int WXUNUSED(x), int WXUNUSED(y),
1319 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
1320 wxHtmlRenderingInfo& WXUNUSED(info))
1321 {
1322 int absx = 0, absy = 0, stx, sty;
1323 wxHtmlCell *c = this;
1324
1325 while (c)
1326 {
1327 absx += c->GetPosX();
1328 absy += c->GetPosY();
1329 c = c->GetParent();
1330 }
1331
1332 ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
1333 m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
1334 }
1335
1336
1337
1338 void wxHtmlWidgetCell::DrawInvisible(wxDC& WXUNUSED(dc),
1339 int WXUNUSED(x), int WXUNUSED(y),
1340 wxHtmlRenderingInfo& WXUNUSED(info))
1341 {
1342 int absx = 0, absy = 0, stx, sty;
1343 wxHtmlCell *c = this;
1344
1345 while (c)
1346 {
1347 absx += c->GetPosX();
1348 absy += c->GetPosY();
1349 c = c->GetParent();
1350 }
1351
1352 ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
1353 m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
1354 }
1355
1356
1357
1358 void wxHtmlWidgetCell::Layout(int w)
1359 {
1360 if (m_WidthFloat != 0)
1361 {
1362 m_Width = (w * m_WidthFloat) / 100;
1363 m_Wnd->SetSize(m_Width, m_Height);
1364 }
1365
1366 wxHtmlCell::Layout(w);
1367 }
1368
1369
1370
1371 // ----------------------------------------------------------------------------
1372 // wxHtmlTerminalCellsInterator
1373 // ----------------------------------------------------------------------------
1374
1375 const wxHtmlCell* wxHtmlTerminalCellsInterator::operator++()
1376 {
1377 if ( !m_pos )
1378 return NULL;
1379
1380 do
1381 {
1382 if ( m_pos == m_to )
1383 {
1384 m_pos = NULL;
1385 return NULL;
1386 }
1387
1388 if ( m_pos->GetNext() )
1389 m_pos = m_pos->GetNext();
1390 else
1391 {
1392 // we must go up the hierarchy until we reach container where this
1393 // is not the last child, and then go down to first terminal cell:
1394 while ( m_pos->GetNext() == NULL )
1395 {
1396 m_pos = m_pos->GetParent();
1397 if ( !m_pos )
1398 return NULL;
1399 }
1400 m_pos = m_pos->GetNext();
1401 }
1402 while ( m_pos->GetFirstChild() != NULL )
1403 m_pos = m_pos->GetFirstChild();
1404 } while ( !m_pos->IsTerminalCell() );
1405
1406 return m_pos;
1407 }
1408
1409
1410
1411
1412
1413
1414
1415 //-----------------------------------------------------------------------------
1416 // Cleanup
1417 //-----------------------------------------------------------------------------
1418
1419 class wxHtmlCellModule: public wxModule
1420 {
1421 DECLARE_DYNAMIC_CLASS(wxHtmlCellModule)
1422 public:
1423 wxHtmlCellModule() : wxModule() {}
1424 bool OnInit() { return true; }
1425 void OnExit()
1426 {
1427 wxDELETE(gs_cursorLink);
1428 wxDELETE(gs_cursorText);
1429 }
1430 };
1431
1432 IMPLEMENT_DYNAMIC_CLASS(wxHtmlCellModule, wxModule)
1433
1434 #endif