]> git.saurik.com Git - wxWidgets.git/blob - src/html/htmlcell.cpp
wxHtmlHelpController can now use default wxConfig instance
[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 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include "wx/wxprec.h"
15
16 #include "wx/defs.h"
17 #if wxUSE_HTML
18
19 #ifdef __BORDLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WXPRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 #include "wx/html/htmlcell.h"
28 #include "wx/html/htmlwin.h"
29 #include <stdlib.h>
30
31
32 //-----------------------------------------------------------------------------
33 // wxHtmlCell
34 //-----------------------------------------------------------------------------
35
36 wxHtmlCell::wxHtmlCell() : wxObject()
37 {
38 m_Next = NULL;
39 m_Parent = NULL;
40 m_Width = m_Height = m_Descent = 0;
41 m_CanLiveOnPagebreak = TRUE;
42 m_Link = NULL;
43 }
44
45 wxHtmlCell::~wxHtmlCell()
46 {
47 if (m_Link) delete m_Link;
48 if (m_Next) delete m_Next;
49 }
50
51
52 void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
53 const wxMouseEvent& event)
54 {
55 wxHtmlLinkInfo *lnk = GetLink(x, y);
56 if (lnk != NULL)
57 {
58 wxHtmlLinkInfo lnk2(*lnk);
59 lnk2.SetEvent(&event);
60 lnk2.SetHtmlCell(this);
61 ((wxHtmlWindow*)parent) -> OnLinkClicked(lnk2);
62 // note : this overcasting is legal because parent is *always* wxHtmlWindow
63 }
64 }
65
66
67
68 bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
69 {
70 if ((!m_CanLiveOnPagebreak) &&
71 m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) {
72 *pagebreak = m_PosY;
73 if (m_Next != NULL) m_Next -> AdjustPagebreak(pagebreak);
74 return TRUE;
75 }
76
77 else {
78 if (m_Next != NULL) return m_Next -> AdjustPagebreak(pagebreak);
79 else return FALSE;
80 }
81 }
82
83
84
85 void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
86 {
87 if (m_Link) delete m_Link;
88 m_Link = new wxHtmlLinkInfo(link);
89 }
90
91
92
93 //-----------------------------------------------------------------------------
94 // wxHtmlWordCell
95 //-----------------------------------------------------------------------------
96
97 wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
98 {
99 m_Word = word;
100
101 if (m_Word.Find(wxT('&')) != -1)
102 {
103 #define ESCSEQ(escape, subst) \
104 { wxT("&"escape";"), wxT("&"escape" "), wxT(subst) }
105 static wxChar* substitutions[][3] =
106 {
107 ESCSEQ("quot", "\""),
108 ESCSEQ("lt", "<"),
109 ESCSEQ("gt", ">"),
110
111 ESCSEQ("nbsp", " "),
112 ESCSEQ("iexcl", "!"),
113 ESCSEQ("cent", "¢"),
114
115 ESCSEQ("yen", " "),
116 ESCSEQ("brkbar", " "),
117 ESCSEQ("sect", " "),
118 ESCSEQ("uml", " "),
119
120 ESCSEQ("copy", "(c)"),
121 ESCSEQ("ordf", " "),
122 ESCSEQ("laquo", " "),
123 ESCSEQ("not", " "),
124
125 ESCSEQ("reg", "(r)"),
126
127 ESCSEQ("deg", " "),
128 ESCSEQ("plusm", " "),
129
130 ESCSEQ("acute", " "),
131 ESCSEQ("micro", " "),
132 ESCSEQ("para", " "),
133
134 ESCSEQ("ordm", " "),
135 ESCSEQ("raquo", " "),
136
137 ESCSEQ("iquest", " "),
138 ESCSEQ("Agrave", "À"),
139
140 ESCSEQ("Acirc", "Â"),
141 ESCSEQ("Atilde", "Ã"),
142 ESCSEQ("Auml", "Ä"),
143 ESCSEQ("Aring", " "),
144 ESCSEQ("AElig", " "),
145 ESCSEQ("Ccedil", "ç"),
146 ESCSEQ("Egrave", "È"),
147 ESCSEQ("Eacute", "É"),
148 ESCSEQ("Ecirc", "Ê"),
149 ESCSEQ("Euml", "Ë"),
150 ESCSEQ("Igrave", "Ì"),
151
152 ESCSEQ("Icirc", "Î"),
153 ESCSEQ("Iuml", "Ï"),
154
155 ESCSEQ("Ntilde", "Ñ"),
156 ESCSEQ("Ograve", "Ò"),
157
158 ESCSEQ("Ocirc", "Ô"),
159 ESCSEQ("Otilde", "Õ"),
160 ESCSEQ("Ouml", "Ö"),
161
162 ESCSEQ("Oslash", " "),
163 ESCSEQ("Ugrave", "Ù"),
164
165 ESCSEQ("Ucirc", " "),
166 ESCSEQ("Uuml", "Ü"),
167
168 ESCSEQ("szlig", "§"),
169 ESCSEQ("agrave;","à"),
170 ESCSEQ("aacute", "á"),
171 ESCSEQ("acirc", "â"),
172 ESCSEQ("atilde", "ã"),
173 ESCSEQ("auml", "ä"),
174 ESCSEQ("aring", "a"),
175 ESCSEQ("aelig", "ae"),
176 ESCSEQ("ccedil", "ç"),
177 ESCSEQ("egrave", "è"),
178 ESCSEQ("eacute", "é"),
179 ESCSEQ("ecirc", "ê"),
180 ESCSEQ("euml", "ë"),
181 ESCSEQ("igrave", "ì"),
182 ESCSEQ("iacute", "í"),
183 ESCSEQ("icirc", " "),
184 ESCSEQ("iuml", "ï"),
185 ESCSEQ("eth", " "),
186 ESCSEQ("ntilde", "ñ"),
187 ESCSEQ("ograve", "ò"),
188 ESCSEQ("oacute", "ó"),
189 ESCSEQ("ocirc", "ô"),
190 ESCSEQ("otilde", "õ"),
191 ESCSEQ("ouml", "ö"),
192 ESCSEQ("divide", " "),
193 ESCSEQ("oslash", " "),
194 ESCSEQ("ugrave", "ù"),
195 ESCSEQ("uacute", "ú"),
196 ESCSEQ("ucirc", "û"),
197 ESCSEQ("uuml", "ü"),
198
199 ESCSEQ("yuml", ""),
200
201 /* this one should ALWAYS stay the last one!!! */
202 ESCSEQ("amp", "&"),
203
204 { NULL, NULL, NULL }
205 };
206
207 for (int i = 0; substitutions[i][0] != NULL; i++)
208 {
209 m_Word.Replace(substitutions[i][0], substitutions[i][2], TRUE);
210 m_Word.Replace(substitutions[i][1], substitutions[i][2], TRUE);
211 }
212 }
213
214 dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
215 SetCanLiveOnPagebreak(FALSE);
216 }
217
218
219
220 void wxHtmlWordCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
221 {
222 dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
223 wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
224 }
225
226
227
228 //-----------------------------------------------------------------------------
229 // wxHtmlContainerCell
230 //-----------------------------------------------------------------------------
231
232
233 wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCell()
234 {
235 m_Cells = m_LastCell = NULL;
236 m_Parent = parent;
237 if (m_Parent) m_Parent -> InsertCell(this);
238 m_AlignHor = wxHTML_ALIGN_LEFT;
239 m_AlignVer = wxHTML_ALIGN_BOTTOM;
240 m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
241 m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT;
242 m_UseBkColour = FALSE;
243 m_UseBorder = FALSE;
244 m_MinHeight = m_MaxLineWidth = 0;
245 m_MinHeightAlign = wxHTML_ALIGN_TOP;
246 m_LastLayout = -1;
247 }
248
249
250
251 void wxHtmlContainerCell::SetIndent(int i, int what, int units)
252 {
253 int val = (units == wxHTML_UNITS_PIXELS) ? i : -i;
254 if (what & wxHTML_INDENT_LEFT) m_IndentLeft = val;
255 if (what & wxHTML_INDENT_RIGHT) m_IndentRight = val;
256 if (what & wxHTML_INDENT_TOP) m_IndentTop = val;
257 if (what & wxHTML_INDENT_BOTTOM) m_IndentBottom = val;
258 m_LastLayout = -1;
259 }
260
261
262
263 int wxHtmlContainerCell::GetIndent(int ind) const
264 {
265 if (ind & wxHTML_INDENT_LEFT) return m_IndentLeft;
266 else if (ind & wxHTML_INDENT_RIGHT) return m_IndentRight;
267 else if (ind & wxHTML_INDENT_TOP) return m_IndentTop;
268 else if (ind & wxHTML_INDENT_BOTTOM) return m_IndentBottom;
269 else return -1; /* BUG! Should not be called... */
270 }
271
272
273
274
275 int wxHtmlContainerCell::GetIndentUnits(int ind) const
276 {
277 bool p = FALSE;
278 if (ind & wxHTML_INDENT_LEFT) p = m_IndentLeft < 0;
279 else if (ind & wxHTML_INDENT_RIGHT) p = m_IndentRight < 0;
280 else if (ind & wxHTML_INDENT_TOP) p = m_IndentTop < 0;
281 else if (ind & wxHTML_INDENT_BOTTOM) p = m_IndentBottom < 0;
282 if (p) return wxHTML_UNITS_PERCENT;
283 else return wxHTML_UNITS_PIXELS;
284 }
285
286
287
288 bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
289 {
290 if (!m_CanLiveOnPagebreak)
291 return wxHtmlCell::AdjustPagebreak(pagebreak);
292
293 else {
294 wxHtmlCell *c = GetFirstCell();
295 bool rt = FALSE;
296 int pbrk = *pagebreak - m_PosY;
297
298 while (c) {
299 if (c -> AdjustPagebreak(&pbrk)) rt = TRUE;
300 c = c -> GetNext();
301 }
302 if (rt) *pagebreak = pbrk + m_PosY;
303 return rt;
304 }
305 }
306
307
308
309 void wxHtmlContainerCell::Layout(int w)
310 {
311 if (m_LastLayout == w) {
312 wxHtmlCell::Layout(w);
313 return;
314 }
315
316 wxHtmlCell *cell = m_Cells, *line = m_Cells;
317 long xpos = 0, ypos = m_IndentTop;
318 int xdelta = 0, ybasicpos = 0, ydiff;
319 int s_width, s_indent;
320 int ysizeup = 0, ysizedown = 0;
321
322 /*
323
324 WIDTH ADJUSTING :
325
326 */
327
328 if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) {
329 if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
330 else m_Width = m_WidthFloat * w / 100;
331 }
332 else {
333 if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
334 else m_Width = m_WidthFloat;
335 }
336
337 if (m_Cells) {
338 int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
339 int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
340 m_Cells -> Layout(m_Width - (l + r));
341 }
342
343 /*
344
345 LAYOUTING :
346
347 */
348
349 // adjust indentation:
350 s_indent = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
351 s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
352
353 m_MaxLineWidth = 0;
354
355 // my own layouting:
356 while (cell != NULL) {
357 switch (m_AlignVer) {
358 case wxHTML_ALIGN_TOP : ybasicpos = 0; break;
359 case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell -> GetHeight(); break;
360 case wxHTML_ALIGN_CENTER : ybasicpos = - cell -> GetHeight() / 2; break;
361 }
362 ydiff = cell -> GetHeight() + ybasicpos;
363
364 if (cell -> GetDescent() + ydiff > ysizedown) ysizedown = cell -> GetDescent() + ydiff;
365 if (ybasicpos + cell -> GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell -> GetDescent());
366
367 cell -> SetPos(xpos, ybasicpos + cell -> GetDescent());
368 xpos += cell -> GetWidth();
369 cell = cell -> GetNext();
370
371 // force new line if occured:
372 if ((cell == NULL) || (xpos + cell -> GetWidth() > s_width)) {
373 if (xpos > m_MaxLineWidth) m_MaxLineWidth = xpos;
374 if (ysizeup < 0) ysizeup = 0;
375 if (ysizedown < 0) ysizedown = 0;
376 switch (m_AlignHor) {
377 case wxHTML_ALIGN_LEFT : xdelta = 0; break;
378 case wxHTML_ALIGN_RIGHT : xdelta = 0 + (s_width - xpos); break;
379 case wxHTML_ALIGN_CENTER : xdelta = 0 + (s_width - xpos) / 2; break;
380 }
381 if (xdelta < 0) xdelta = 0;
382 xdelta += s_indent;
383
384 ypos += ysizeup;
385 while (line != cell) {
386 line -> SetPos(line -> GetPosX() + xdelta, ypos + line -> GetPosY());
387 line = line -> GetNext();
388 }
389
390 ypos += ysizedown;
391 xpos = 0;
392 ysizeup = ysizedown = 0;
393 line = cell;
394 }
395 }
396
397 // setup height & width, depending on container layout:
398 m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
399
400 if (m_Height < m_MinHeight) {
401 if (m_MinHeightAlign != wxHTML_ALIGN_TOP) {
402 int diff = m_MinHeight - m_Height;
403 if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
404 cell = m_Cells;
405 while (cell) {
406 cell -> SetPos(cell -> GetPosX(), cell -> GetPosY() + diff);
407 cell = cell -> GetNext();
408 }
409 }
410 m_Height = m_MinHeight;
411 }
412
413 m_MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
414 if (m_Width < m_MaxLineWidth) m_Width = m_MaxLineWidth;
415
416 m_LastLayout = w;
417
418 wxHtmlCell::Layout(w);
419 }
420
421
422 #define mMin(a, b) (((a) < (b)) ? (a) : (b))
423 #define mMax(a, b) (((a) < (b)) ? (b) : (a))
424
425 void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
426 {
427 // container visible, draw it:
428 if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1)) {
429
430 if (m_UseBkColour) {
431 wxBrush myb = wxBrush(m_BkColour, wxSOLID);
432
433 int real_y1 = mMax(y + m_PosY, view_y1);
434 int real_y2 = mMin(y + m_PosY + m_Height - 1, view_y2);
435
436 dc.SetBrush(myb);
437 dc.SetPen(*wxTRANSPARENT_PEN);
438 dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
439 }
440
441 if (m_UseBorder) {
442 wxPen mypen1(m_BorderColour1, 1, wxSOLID);
443 wxPen mypen2(m_BorderColour2, 1, wxSOLID);
444
445 dc.SetPen(mypen1);
446 dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX, y + m_PosY + m_Height - 1);
447 dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY);
448 dc.SetPen(mypen2);
449 dc.DrawLine(x + m_PosX + m_Width - 1, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
450 dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
451 }
452
453 if (m_Cells) m_Cells -> Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
454 }
455 // container invisible, just proceed font+color changing:
456 else {
457 if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY);
458 }
459
460 wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
461 }
462
463
464
465 void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
466 {
467 if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY);
468 wxHtmlCell::DrawInvisible(dc, x, y);
469 }
470
471
472
473 wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
474 {
475 wxHtmlCell *c = m_Cells;
476 int cx, cy, cw, ch;
477
478 while (c) {
479 cx = c -> GetPosX(), cy = c -> GetPosY();
480 cw = c -> GetWidth(), ch = c -> GetHeight();
481 if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
482 return c -> GetLink(x - cx, y - cy);
483 c = c -> GetNext();
484 }
485 return NULL;
486 }
487
488
489
490 void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
491 {
492 if (!m_Cells) m_Cells = m_LastCell = f;
493 else {
494 m_LastCell -> SetNext(f);
495 m_LastCell = f;
496 if (m_LastCell) while (m_LastCell -> GetNext()) m_LastCell = m_LastCell -> GetNext();
497 }
498 f -> SetParent(this);
499 m_LastLayout = -1;
500 }
501
502
503
504 void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
505 {
506 if (tag.HasParam(wxT("ALIGN"))) {
507 wxString alg = tag.GetParam(wxT("ALIGN"));
508 alg.MakeUpper();
509 if (alg == wxT("CENTER"))
510 SetAlignHor(wxHTML_ALIGN_CENTER);
511 else if (alg == wxT("LEFT"))
512 SetAlignHor(wxHTML_ALIGN_LEFT);
513 else if (alg == wxT("RIGHT"))
514 SetAlignHor(wxHTML_ALIGN_RIGHT);
515 m_LastLayout = -1;
516 }
517 }
518
519
520
521 void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
522 {
523 if (tag.HasParam(wxT("WIDTH"))) {
524 int wdi;
525 wxString wd = tag.GetParam(wxT("WIDTH"));
526
527 if (wd[wd.Length()-1] == wxT('%')) {
528 wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
529 SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
530 }
531 else {
532 wxSscanf(wd.c_str(), wxT("%i"), &wdi);
533 SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
534 }
535 m_LastLayout = -1;
536 }
537 }
538
539
540
541 const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const
542 {
543 const wxHtmlCell *r = NULL;
544
545 if (m_Cells) {
546 r = m_Cells -> Find(condition, param);
547 if (r) return r;
548 }
549
550 return wxHtmlCell::Find(condition, param);
551 }
552
553
554
555 void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
556 {
557 if (m_Cells) {
558 wxHtmlCell *c = m_Cells;
559 while (c) {
560 if ( (c -> GetPosX() <= x) &&
561 (c -> GetPosY() <= y) &&
562 (c -> GetPosX() + c -> GetWidth() > x) &&
563 (c -> GetPosY() + c -> GetHeight() > y)) {
564 c -> OnMouseClick(parent, x - c -> GetPosX(), y - c -> GetPosY(), event);
565 break;
566 }
567 c = c -> GetNext();
568 }
569 }
570 }
571
572
573
574
575
576 //--------------------------------------------------------------------------------
577 // wxHtmlColourCell
578 //--------------------------------------------------------------------------------
579
580 void wxHtmlColourCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
581 {
582 if (m_Flags & wxHTML_CLR_FOREGROUND)
583 dc.SetTextForeground(m_Colour);
584 if (m_Flags & wxHTML_CLR_BACKGROUND) {
585 dc.SetBackground(wxBrush(m_Colour, wxSOLID));
586 dc.SetTextBackground(m_Colour);
587 }
588 wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
589 }
590
591 void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
592 {
593 if (m_Flags & wxHTML_CLR_FOREGROUND)
594 dc.SetTextForeground(m_Colour);
595 if (m_Flags & wxHTML_CLR_BACKGROUND) {
596 dc.SetBackground(wxBrush(m_Colour, wxSOLID));
597 dc.SetTextBackground(m_Colour);
598 }
599 wxHtmlCell::DrawInvisible(dc, x, y);
600 }
601
602
603
604
605 //--------------------------------------------------------------------------------
606 // wxHtmlFontCell
607 //--------------------------------------------------------------------------------
608
609 void wxHtmlFontCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
610 {
611 dc.SetFont(m_Font);
612 wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
613 }
614
615 void wxHtmlFontCell::DrawInvisible(wxDC& dc, int x, int y)
616 {
617 dc.SetFont(m_Font);
618 wxHtmlCell::DrawInvisible(dc, x, y);
619 }
620
621
622
623
624
625
626
627
628 //--------------------------------------------------------------------------------
629 // wxHtmlWidgetCell
630 //--------------------------------------------------------------------------------
631
632 wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow *wnd, int w)
633 {
634 int sx, sy;
635 m_Wnd = wnd;
636 m_Wnd -> GetSize(&sx, &sy);
637 m_Width = sx, m_Height = sy;
638 m_WidthFloat = w;
639 }
640
641
642 void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
643 {
644 int absx = 0, absy = 0, stx, sty;
645 wxHtmlCell *c = this;
646
647 while (c) {
648 absx += c -> GetPosX();
649 absy += c -> GetPosY();
650 c = c -> GetParent();
651 }
652
653 ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
654 m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
655
656 wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
657 }
658
659
660
661 void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
662 {
663 int absx = 0, absy = 0, stx, sty;
664 wxHtmlCell *c = this;
665
666 while (c) {
667 absx += c -> GetPosX();
668 absy += c -> GetPosY();
669 c = c -> GetParent();
670 }
671
672 ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
673 m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
674
675 wxHtmlCell::DrawInvisible(dc, x, y);
676 }
677
678
679
680 void wxHtmlWidgetCell::Layout(int w)
681 {
682 if (m_WidthFloat != 0) {
683 m_Width = (w * m_WidthFloat) / 100;
684 m_Wnd -> SetSize(m_Width, m_Height);
685 }
686
687 wxHtmlCell::Layout(w);
688 }
689
690 #endif