1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/html/htmlcell.cpp 
   3 // Purpose:     wxHtmlCell - basic element of HTML output 
   4 // Author:      Vaclav Slavik 
   6 // Copyright:   (c) 1999 Vaclav Slavik 
   7 // Licence:     wxWindows licence 
   8 ///////////////////////////////////////////////////////////////////////////// 
  10 #include "wx/wxprec.h" 
  16 #if wxUSE_HTML && wxUSE_STREAMS 
  19     #include "wx/dynarray.h" 
  21     #include "wx/colour.h" 
  23     #include "wx/settings.h" 
  24     #include "wx/module.h" 
  27 #include "wx/html/htmlcell.h" 
  28 #include "wx/html/htmlwin.h" 
  32 //----------------------------------------------------------------------------- 
  34 //----------------------------------------------------------------------------- 
  36 void wxHtmlSelection::Set(const wxPoint
& fromPos
, const wxHtmlCell 
*fromCell
, 
  37                           const wxPoint
& toPos
, const wxHtmlCell 
*toCell
) 
  39     m_fromCell 
= fromCell
; 
  45 void wxHtmlSelection::Set(const wxHtmlCell 
*fromCell
, const wxHtmlCell 
*toCell
) 
  47     wxPoint p1 
= fromCell 
? fromCell
->GetAbsPos() : wxDefaultPosition
; 
  48     wxPoint p2 
= toCell 
? toCell
->GetAbsPos() : wxDefaultPosition
; 
  51         p2
.x 
+= toCell
->GetWidth(); 
  52         p2
.y 
+= toCell
->GetHeight(); 
  54     Set(p1
, fromCell
, p2
, toCell
); 
  58 wxDefaultHtmlRenderingStyle:: 
  59 GetSelectedTextColour(const wxColour
& WXUNUSED(clr
)) 
  61     return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
); 
  65 wxDefaultHtmlRenderingStyle:: 
  66 GetSelectedTextBgColour(const wxColour
& WXUNUSED(clr
)) 
  68     return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
); 
  72 //----------------------------------------------------------------------------- 
  74 //----------------------------------------------------------------------------- 
  76 IMPLEMENT_ABSTRACT_CLASS(wxHtmlCell
, wxObject
) 
  78 wxHtmlCell::wxHtmlCell() : wxObject() 
  82     m_Width 
= m_Height 
= m_Descent 
= 0; 
  83     m_ScriptMode 
= wxHTML_SCRIPT_NORMAL
;        // <sub> or <sup> mode 
  84     m_ScriptBaseline 
= 0;                       // <sub> or <sup> baseline 
  85     m_CanLiveOnPagebreak 
= true; 
  89 wxHtmlCell::~wxHtmlCell() 
  94 // Update the descent value when whe are in a <sub> or <sup>. 
  95 // prevbase is the parent base 
  96 void wxHtmlCell::SetScriptMode(wxHtmlScriptMode mode
, long previousBase
) 
 100     if (mode 
== wxHTML_SCRIPT_SUP
) 
 101         m_ScriptBaseline 
= previousBase 
- (m_Height 
+ 1) / 2; 
 102     else if (mode 
== wxHTML_SCRIPT_SUB
) 
 103         m_ScriptBaseline 
= previousBase 
+ (m_Height 
+ 1) / 6; 
 105         m_ScriptBaseline 
= 0; 
 107     m_Descent 
+= m_ScriptBaseline
; 
 110 #if WXWIN_COMPATIBILITY_2_6 
 112 struct wxHtmlCellOnMouseClickCompatHelper
; 
 114 static wxHtmlCellOnMouseClickCompatHelper 
*gs_helperOnMouseClick 
= NULL
; 
 116 // helper for routing calls to new ProcessMouseClick() method to deprecated 
 117 // OnMouseClick() method 
 118 struct wxHtmlCellOnMouseClickCompatHelper
 
 120     wxHtmlCellOnMouseClickCompatHelper(wxHtmlWindowInterface 
*window_
, 
 122                                        const wxMouseEvent
& event_
) 
 123         : window(window_
), pos(pos_
), event(event_
), retval(false) 
 127     bool CallOnMouseClick(wxHtmlCell 
*cell
) 
 129         wxHtmlCellOnMouseClickCompatHelper 
*oldHelper 
= gs_helperOnMouseClick
; 
 130         gs_helperOnMouseClick 
= this; 
 133                 window 
? window
->GetHTMLWindow() : NULL
, 
 137         gs_helperOnMouseClick 
= oldHelper
; 
 141     wxHtmlWindowInterface 
*window
; 
 143     const wxMouseEvent
& event
; 
 146 #endif // WXWIN_COMPATIBILITY_2_6 
 148 bool wxHtmlCell::ProcessMouseClick(wxHtmlWindowInterface 
*window
, 
 150                                    const wxMouseEvent
& event
) 
 152     wxCHECK_MSG( window
, false, _T("window interface must be provided") ); 
 154 #if WXWIN_COMPATIBILITY_2_6 
 155     // NB: this hack puts the body of ProcessMouseClick() into OnMouseClick() 
 156     //     (for which it has to pass the arguments and return value via a 
 157     //     helper variable because these two methods have different 
 158     //     signatures), so that old code overriding OnMouseClick will continue 
 160     wxHtmlCellOnMouseClickCompatHelper 
compat(window
, pos
, event
); 
 161     return compat
.CallOnMouseClick(this); 
 164 void wxHtmlCell::OnMouseClick(wxWindow 
*, int, int, const wxMouseEvent
& event
) 
 166     wxCHECK_RET( gs_helperOnMouseClick
, _T("unexpected call to OnMouseClick") ); 
 167     wxHtmlWindowInterface 
*window 
= gs_helperOnMouseClick
->window
; 
 168     const wxPoint
& pos 
= gs_helperOnMouseClick
->pos
; 
 169 #endif // WXWIN_COMPATIBILITY_2_6 
 171     wxHtmlLinkInfo 
*lnk 
= GetLink(pos
.x
, pos
.y
); 
 176         wxHtmlLinkInfo 
lnk2(*lnk
); 
 177         lnk2
.SetEvent(&event
); 
 178         lnk2
.SetHtmlCell(this); 
 180         window
->OnHTMLLinkClicked(lnk2
); 
 184 #if WXWIN_COMPATIBILITY_2_6 
 185     gs_helperOnMouseClick
->retval 
= retval
; 
 188 #endif // WXWIN_COMPATIBILITY_2_6 
 191 #if WXWIN_COMPATIBILITY_2_6 
 192 wxCursor 
wxHtmlCell::GetCursor() const 
 196 #endif // WXWIN_COMPATIBILITY_2_6 
 198 wxCursor 
wxHtmlCell::GetMouseCursor(wxHtmlWindowInterface 
*window
) const 
 200 #if WXWIN_COMPATIBILITY_2_6 
 201     // NB: Older versions of wx used GetCursor() virtual method in place of 
 202     //     GetMouseCursor(interface). This code ensures that user code that 
 203     //     overriden GetCursor() continues to work. The trick is that the base 
 204     //     wxHtmlCell::GetCursor() method simply returns wxNullCursor, so we 
 205     //     know that GetCursor() was overriden iff it returns valid cursor. 
 206     wxCursor cur 
= GetCursor(); 
 209 #endif // WXWIN_COMPATIBILITY_2_6 
 213         return window
->GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor_Link
); 
 217         return window
->GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor_Default
); 
 222 bool wxHtmlCell::AdjustPagebreak(int *pagebreak
, 
 223                                  wxArrayInt
& WXUNUSED(known_pagebreaks
)) const 
 225     if ((!m_CanLiveOnPagebreak
) && 
 226                 m_PosY 
< *pagebreak 
&& m_PosY 
+ m_Height 
> *pagebreak
) 
 237 void wxHtmlCell::SetLink(const wxHtmlLinkInfo
& link
) 
 239     if (m_Link
) delete m_Link
; 
 241     if (link
.GetHref() != wxEmptyString
) 
 242         m_Link 
= new wxHtmlLinkInfo(link
); 
 246 void wxHtmlCell::Layout(int WXUNUSED(w
)) 
 253 const wxHtmlCell
* wxHtmlCell::Find(int WXUNUSED(condition
), const void* WXUNUSED(param
)) const 
 259 wxHtmlCell 
*wxHtmlCell::FindCellByPos(wxCoord x
, wxCoord y
, 
 260                                       unsigned flags
) const 
 262     if ( x 
>= 0 && x 
< m_Width 
&& y 
>= 0 && y 
< m_Height 
) 
 264         return wxConstCast(this, wxHtmlCell
); 
 268         if ((flags 
& wxHTML_FIND_NEAREST_AFTER
) && 
 269                 (y 
< 0 || (y 
< 0+m_Height 
&& x 
< 0+m_Width
))) 
 270             return wxConstCast(this, wxHtmlCell
); 
 271         else if ((flags 
& wxHTML_FIND_NEAREST_BEFORE
) && 
 272                 (y 
>= 0+m_Height 
|| (y 
>= 0 && x 
>= 0))) 
 273             return wxConstCast(this, wxHtmlCell
); 
 280 wxPoint 
wxHtmlCell::GetAbsPos(wxHtmlCell 
*rootCell
) const 
 282     wxPoint 
p(m_PosX
, m_PosY
); 
 283     for (wxHtmlCell 
*parent 
= m_Parent
; parent 
&& parent 
!= rootCell
; 
 284          parent 
= parent
->m_Parent
) 
 286         p
.x 
+= parent
->m_PosX
; 
 287         p
.y 
+= parent
->m_PosY
; 
 292 wxHtmlCell 
*wxHtmlCell::GetRootCell() const 
 294     wxHtmlCell 
*c 
= wxConstCast(this, wxHtmlCell
); 
 295     while ( c
->m_Parent 
) 
 300 unsigned wxHtmlCell::GetDepth() const 
 303     for (wxHtmlCell 
*p 
= m_Parent
; p
; p 
= p
->m_Parent
) 
 308 bool wxHtmlCell::IsBefore(wxHtmlCell 
*cell
) const 
 310     const wxHtmlCell 
*c1 
= this; 
 311     const wxHtmlCell 
*c2 
= cell
; 
 312     unsigned d1 
= GetDepth(); 
 313     unsigned d2 
= cell
->GetDepth(); 
 316         for (; d1 
!= d2
; d1
-- ) 
 319         for (; d1 
!= d2
; d2
-- ) 
 327         if ( c1
->m_Parent 
== c2
->m_Parent 
) 
 344     wxFAIL_MSG(_T("Cells are in different trees")); 
 349 //----------------------------------------------------------------------------- 
 351 //----------------------------------------------------------------------------- 
 353 IMPLEMENT_ABSTRACT_CLASS(wxHtmlWordCell
, wxHtmlCell
) 
 355 wxHtmlWordCell::wxHtmlWordCell(const wxString
& word
, const wxDC
& dc
) : wxHtmlCell() 
 358     dc
.GetTextExtent(m_Word
, &m_Width
, &m_Height
, &m_Descent
); 
 359     SetCanLiveOnPagebreak(false); 
 360     m_allowLinebreak 
= true; 
 363 void wxHtmlWordCell::SetPreviousWord(wxHtmlWordCell 
*cell
) 
 365     if ( cell 
&& m_Parent 
== cell
->m_Parent 
&& 
 366          !wxIsspace(cell
->m_Word
.Last()) && !wxIsspace(m_Word
[0u]) ) 
 368         m_allowLinebreak 
= false; 
 372 // Splits m_Word into up to three parts according to selection, returns 
 373 // substring before, in and after selection and the points (in relative coords) 
 374 // where s2 and s3 start: 
 375 void wxHtmlWordCell::Split(const wxDC
& dc
, 
 376                            const wxPoint
& selFrom
, const wxPoint
& selTo
, 
 377                            unsigned& pos1
, unsigned& pos2
) const 
 379     wxPoint pt1 
= (selFrom 
== wxDefaultPosition
) ? 
 380                    wxDefaultPosition 
: selFrom 
- GetAbsPos(); 
 381     wxPoint pt2 
= (selTo 
== wxDefaultPosition
) ? 
 382                    wxPoint(m_Width
, wxDefaultCoord
) : selTo 
- GetAbsPos(); 
 384     unsigned len 
= m_Word
.length(); 
 388     // adjust for cases when the start/end position is completely 
 392     if ( pt2
.y 
>= m_Height 
) 
 397     // implementation using PartialExtents to support fractional widths 
 399     dc
.GetPartialTextExtents(m_Word
,widths
) ; 
 400     while( i 
< len 
&& pt1
.x 
>= widths
[i
] ) 
 403     wxCoord charW
, charH
; 
 404     while ( pt1
.x 
> 0 && i 
< len 
) 
 406         dc
.GetTextExtent(m_Word
[i
], &charW
, &charH
); 
 414 #endif // __WXMAC__/!__WXMAC__ 
 419     while( j 
< len 
&& pt2
.x 
>= widths
[j
] ) 
 424     while ( pt2
.x 
> 0 && j 
< len 
) 
 426         dc
.GetTextExtent(m_Word
[j
], &charW
, &charH
); 
 434 #endif // __WXMAC__/!__WXMAC__ 
 440 void wxHtmlWordCell::SetSelectionPrivPos(const wxDC
& dc
, wxHtmlSelection 
*s
) const 
 445           this == s
->GetFromCell() ? s
->GetFromPos() : wxDefaultPosition
, 
 446           this == s
->GetToCell() ? s
->GetToPos() : wxDefaultPosition
, 
 449     wxPoint 
p(0, m_Word
.length()); 
 451     if ( this == s
->GetFromCell() ) 
 452         p
.x 
= p1
; // selection starts here 
 453     if ( this == s
->GetToCell() ) 
 454         p
.y 
= p2
; // selection ends here 
 456     if ( this == s
->GetFromCell() ) 
 457         s
->SetFromPrivPos(p
); 
 458     if ( this == s
->GetToCell() ) 
 463 static void SwitchSelState(wxDC
& dc
, wxHtmlRenderingInfo
& info
, 
 466     wxColour fg 
= info
.GetState().GetFgColour(); 
 467     wxColour bg 
= info
.GetState().GetBgColour(); 
 471         dc
.SetBackgroundMode(wxSOLID
); 
 472         dc
.SetTextForeground(info
.GetStyle().GetSelectedTextColour(fg
)); 
 473         dc
.SetTextBackground(info
.GetStyle().GetSelectedTextBgColour(bg
)); 
 474         dc
.SetBackground(wxBrush(info
.GetStyle().GetSelectedTextBgColour(bg
), 
 479         dc
.SetBackgroundMode(wxTRANSPARENT
); 
 480         dc
.SetTextForeground(fg
); 
 481         dc
.SetTextBackground(bg
); 
 482         dc
.SetBackground(wxBrush(bg
, wxSOLID
)); 
 487 void wxHtmlWordCell::Draw(wxDC
& dc
, int x
, int y
, 
 488                           int WXUNUSED(view_y1
), int WXUNUSED(view_y2
), 
 489                           wxHtmlRenderingInfo
& info
) 
 491 #if 0 // useful for debugging 
 492     dc
.SetPen(*wxBLACK_PEN
); 
 493     dc
.DrawRectangle(x
+m_PosX
,y
+m_PosY
,m_Width 
/* VZ: +1? */ ,m_Height
); 
 496     bool drawSelectionAfterCell 
= false; 
 498     if ( info
.GetState().GetSelectionState() == wxHTML_SEL_CHANGING 
) 
 500         // Selection changing, we must draw the word piecewise: 
 501         wxHtmlSelection 
*s 
= info
.GetSelection(); 
 506         wxPoint priv 
= (this == s
->GetFromCell()) ? 
 507                            s
->GetFromPrivPos() : s
->GetToPrivPos(); 
 509         // NB: this is quite a hack: in order to compute selection boundaries 
 510         //     (in word's characters) we must know current font, which is only 
 511         //     possible inside rendering code. Therefore we update the 
 512         //     information here and store it in wxHtmlSelection so that 
 513         //     ConvertToText can use it later: 
 514         if ( priv 
== wxDefaultPosition 
) 
 516             SetSelectionPrivPos(dc
, s
); 
 517             priv 
= (this == s
->GetFromCell()) ? 
 518                     s
->GetFromPrivPos() : s
->GetToPrivPos(); 
 526             txt 
= m_Word
.Mid(0, part1
); 
 527             dc
.DrawText(txt
, x 
+ m_PosX
, y 
+ m_PosY
); 
 528             dc
.GetTextExtent(txt
, &w
, &h
); 
 532         SwitchSelState(dc
, info
, true); 
 534         txt 
= m_Word
.Mid(part1
, part2
-part1
); 
 535         dc
.DrawText(txt
, ofs 
+ x 
+ m_PosX
, y 
+ m_PosY
); 
 537         if ( (size_t)part2 
< m_Word
.length() ) 
 539             dc
.GetTextExtent(txt
, &w
, &h
); 
 541             SwitchSelState(dc
, info
, false); 
 542             txt 
= m_Word
.Mid(part2
); 
 543             dc
.DrawText(txt
, ofs 
+ x 
+ m_PosX
, y 
+ m_PosY
); 
 546             drawSelectionAfterCell 
= true; 
 550         wxHtmlSelectionState selstate 
= info
.GetState().GetSelectionState(); 
 551         // Not changing selection state, draw the word in single mode: 
 552         if ( selstate 
!= wxHTML_SEL_OUT 
&& 
 553              dc
.GetBackgroundMode() != wxSOLID 
) 
 555             SwitchSelState(dc
, info
, true); 
 557         else if ( selstate 
== wxHTML_SEL_OUT 
&& 
 558                   dc
.GetBackgroundMode() == wxSOLID 
) 
 560             SwitchSelState(dc
, info
, false); 
 562         dc
.DrawText(m_Word
, x 
+ m_PosX
, y 
+ m_PosY
); 
 563         drawSelectionAfterCell 
= (selstate 
!= wxHTML_SEL_OUT
); 
 566     // NB: If the text is justified then there is usually some free space 
 567     //     between adjacent cells and drawing the selection only onto cells 
 568     //     would result in ugly unselected spaces. The code below detects 
 569     //     this special case and renders the selection *outside* the sell, 
 571     if ( m_Parent
->GetAlignHor() == wxHTML_ALIGN_JUSTIFY 
&& 
 572          drawSelectionAfterCell 
) 
 574         wxHtmlCell 
*nextCell 
= m_Next
; 
 575         while ( nextCell 
&& nextCell
->IsFormattingCell() ) 
 576             nextCell 
= nextCell
->GetNext(); 
 579             int nextX 
= nextCell
->GetPosX(); 
 580             if ( m_PosX 
+ m_Width 
< nextX 
) 
 582                 dc
.SetBrush(dc
.GetBackground()); 
 583                 dc
.SetPen(*wxTRANSPARENT_PEN
); 
 584                 dc
.DrawRectangle(x 
+ m_PosX 
+ m_Width
, y 
+ m_PosY
, 
 585                                  nextX 
- m_PosX 
- m_Width
, m_Height
); 
 592 wxString 
wxHtmlWordCell::ConvertToText(wxHtmlSelection 
*s
) const 
 594     if ( s 
&& (this == s
->GetFromCell() || this == s
->GetToCell()) ) 
 596         wxPoint priv 
= this == s
->GetFromCell() ? s
->GetFromPrivPos() 
 599         // VZ: we may be called before we had a chance to re-render ourselves 
 600         //     and in this case GetFrom/ToPrivPos() is not set yet -- assume 
 601         //     that this only happens in case of a double/triple click (which 
 602         //     seems to be the case now) and so it makes sense to select the 
 603         //     entire contents of the cell in this case 
 605         // TODO: but this really needs to be fixed in some better way later... 
 606         if ( priv 
!= wxDefaultPosition 
) 
 610             return m_Word
.Mid(part1
, part2
-part1
); 
 612         //else: return the whole word below 
 618 wxCursor 
wxHtmlWordCell::GetMouseCursor(wxHtmlWindowInterface 
*window
) const 
 622         return window
->GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor_Text
); 
 626         return wxHtmlCell::GetMouseCursor(window
); 
 631 //----------------------------------------------------------------------------- 
 632 // wxHtmlContainerCell 
 633 //----------------------------------------------------------------------------- 
 635 IMPLEMENT_ABSTRACT_CLASS(wxHtmlContainerCell
, wxHtmlCell
) 
 637 wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell 
*parent
) : wxHtmlCell() 
 639     m_Cells 
= m_LastCell 
= NULL
; 
 642     if (m_Parent
) m_Parent
->InsertCell(this); 
 643     m_AlignHor 
= wxHTML_ALIGN_LEFT
; 
 644     m_AlignVer 
= wxHTML_ALIGN_BOTTOM
; 
 645     m_IndentLeft 
= m_IndentRight 
= m_IndentTop 
= m_IndentBottom 
= 0; 
 646     m_WidthFloat 
= 100; m_WidthFloatUnits 
= wxHTML_UNITS_PERCENT
; 
 647     m_UseBkColour 
= false; 
 650     m_MinHeightAlign 
= wxHTML_ALIGN_TOP
; 
 654 wxHtmlContainerCell::~wxHtmlContainerCell() 
 656     wxHtmlCell 
*cell 
= m_Cells
; 
 659         wxHtmlCell 
*cellNext 
= cell
->GetNext(); 
 667 void wxHtmlContainerCell::SetIndent(int i
, int what
, int units
) 
 669     int val 
= (units 
== wxHTML_UNITS_PIXELS
) ? i 
: -i
; 
 670     if (what 
& wxHTML_INDENT_LEFT
) m_IndentLeft 
= val
; 
 671     if (what 
& wxHTML_INDENT_RIGHT
) m_IndentRight 
= val
; 
 672     if (what 
& wxHTML_INDENT_TOP
) m_IndentTop 
= val
; 
 673     if (what 
& wxHTML_INDENT_BOTTOM
) m_IndentBottom 
= val
; 
 679 int wxHtmlContainerCell::GetIndent(int ind
) const 
 681     if (ind 
& wxHTML_INDENT_LEFT
) return m_IndentLeft
; 
 682     else if (ind 
& wxHTML_INDENT_RIGHT
) return m_IndentRight
; 
 683     else if (ind 
& wxHTML_INDENT_TOP
) return m_IndentTop
; 
 684     else if (ind 
& wxHTML_INDENT_BOTTOM
) return m_IndentBottom
; 
 685     else return -1; /* BUG! Should not be called... */ 
 691 int wxHtmlContainerCell::GetIndentUnits(int ind
) const 
 694     if (ind 
& wxHTML_INDENT_LEFT
) p 
= m_IndentLeft 
< 0; 
 695     else if (ind 
& wxHTML_INDENT_RIGHT
) p 
= m_IndentRight 
< 0; 
 696     else if (ind 
& wxHTML_INDENT_TOP
) p 
= m_IndentTop 
< 0; 
 697     else if (ind 
& wxHTML_INDENT_BOTTOM
) p 
= m_IndentBottom 
< 0; 
 698     if (p
) return wxHTML_UNITS_PERCENT
; 
 699     else return wxHTML_UNITS_PIXELS
; 
 703 bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak
, 
 704                                           wxArrayInt
& known_pagebreaks
) const 
 706     if (!m_CanLiveOnPagebreak
) 
 707         return wxHtmlCell::AdjustPagebreak(pagebreak
, known_pagebreaks
); 
 709     wxHtmlCell 
*c 
= GetFirstChild(); 
 711     int pbrk 
= *pagebreak 
- m_PosY
; 
 715         if (c
->AdjustPagebreak(&pbrk
, known_pagebreaks
)) 
 720         *pagebreak 
= pbrk 
+ m_PosY
; 
 725 void wxHtmlContainerCell::Layout(int w
) 
 727     wxHtmlCell::Layout(w
); 
 729     if (m_LastLayout 
== w
) return; 
 731     // VS: Any attempt to layout with negative or zero width leads to hell, 
 732     // but we can't ignore such attempts completely, since it sometimes 
 733     // happen (e.g. when trying how small a table can be). The best thing we 
 734     // can do is to set the width of child cells to zero 
 738        for (wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext()) 
 740             // this does two things: it recursively calls this code on all 
 741             // child contrainers and resets children's position to (0,0) 
 745     wxHtmlCell 
*nextCell
; 
 746     long xpos 
= 0, ypos 
= m_IndentTop
; 
 747     int xdelta 
= 0, ybasicpos 
= 0, ydiff
; 
 748     int s_width
, nextWordWidth
, s_indent
; 
 749     int ysizeup 
= 0, ysizedown 
= 0; 
 750     int MaxLineWidth 
= 0; 
 751     int curLineWidth 
= 0; 
 761     if (m_WidthFloatUnits 
== wxHTML_UNITS_PERCENT
) 
 763         if (m_WidthFloat 
< 0) m_Width 
= (100 + m_WidthFloat
) * w 
/ 100; 
 764         else m_Width 
= m_WidthFloat 
* w 
/ 100; 
 768         if (m_WidthFloat 
< 0) m_Width 
= w 
+ m_WidthFloat
; 
 769         else m_Width 
= m_WidthFloat
; 
 774         int l 
= (m_IndentLeft 
< 0) ? (-m_IndentLeft 
* m_Width 
/ 100) : m_IndentLeft
; 
 775         int r 
= (m_IndentRight 
< 0) ? (-m_IndentRight 
* m_Width 
/ 100) : m_IndentRight
; 
 776         for (wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext()) 
 777             cell
->Layout(m_Width 
- (l 
+ r
)); 
 786     // adjust indentation: 
 787     s_indent 
= (m_IndentLeft 
< 0) ? (-m_IndentLeft 
* m_Width 
/ 100) : m_IndentLeft
; 
 788     s_width 
= m_Width 
- s_indent 
- ((m_IndentRight 
< 0) ? (-m_IndentRight 
* m_Width 
/ 100) : m_IndentRight
); 
 791     wxHtmlCell 
*cell 
= m_Cells
, 
 797             case wxHTML_ALIGN_TOP 
:      ybasicpos 
= 0; break; 
 798             case wxHTML_ALIGN_BOTTOM 
:   ybasicpos 
= - cell
->GetHeight(); break; 
 799             case wxHTML_ALIGN_CENTER 
:   ybasicpos 
= - cell
->GetHeight() / 2; break; 
 801         ydiff 
= cell
->GetHeight() + ybasicpos
; 
 803         if (cell
->GetDescent() + ydiff 
> ysizedown
) ysizedown 
= cell
->GetDescent() + ydiff
; 
 804         if (ybasicpos 
+ cell
->GetDescent() < -ysizeup
) ysizeup 
= - (ybasicpos 
+ cell
->GetDescent()); 
 806         // layout nonbreakable run of cells: 
 807         cell
->SetPos(xpos
, ybasicpos 
+ cell
->GetDescent()); 
 808         xpos 
+= cell
->GetWidth(); 
 809         if (!cell
->IsTerminalCell()) 
 811             // Container cell indicates new line 
 812             if (curLineWidth 
> m_MaxTotalWidth
) 
 813                 m_MaxTotalWidth 
= curLineWidth
; 
 815             if (wxMax(cell
->GetWidth(), cell
->GetMaxTotalWidth()) > m_MaxTotalWidth
) 
 816                 m_MaxTotalWidth 
= cell
->GetMaxTotalWidth(); 
 820             // Normal cell, add maximum cell width to line width 
 821             curLineWidth 
+= cell
->GetMaxTotalWidth(); 
 823         cell 
= cell
->GetNext(); 
 825         // compute length of the next word that would be added: 
 832                 nextWordWidth 
+= nextCell
->GetWidth(); 
 833                 nextCell 
= nextCell
->GetNext(); 
 834             } while (nextCell 
&& !nextCell
->IsLinebreakAllowed()); 
 837         // force new line if occurred: 
 838         if ((cell 
== NULL
) || 
 839             (xpos 
+ nextWordWidth 
> s_width 
&& cell
->IsLinebreakAllowed())) 
 841             if (xpos 
> MaxLineWidth
) MaxLineWidth 
= xpos
; 
 842             if (ysizeup 
< 0) ysizeup 
= 0; 
 843             if (ysizedown 
< 0) ysizedown 
= 0; 
 844             switch (m_AlignHor
) { 
 845                 case wxHTML_ALIGN_LEFT 
: 
 846                 case wxHTML_ALIGN_JUSTIFY 
: 
 849                 case wxHTML_ALIGN_RIGHT 
: 
 850                          xdelta 
= 0 + (s_width 
- xpos
); 
 852                 case wxHTML_ALIGN_CENTER 
: 
 853                          xdelta 
= 0 + (s_width 
- xpos
) / 2; 
 856             if (xdelta 
< 0) xdelta 
= 0; 
 861             if (m_AlignHor 
!= wxHTML_ALIGN_JUSTIFY 
|| cell 
== NULL
) 
 865                     line
->SetPos(line
->GetPosX() + xdelta
, 
 866                                    ypos 
+ line
->GetPosY()); 
 867                     line 
= line
->GetNext(); 
 870             else // align == justify 
 872                 // we have to distribute the extra horz space between the cells 
 875                 // an added complication is that some cells have fixed size and 
 876                 // shouldn't get any increment (it so happens that these cells 
 877                 // also don't allow line break on them which provides with an 
 878                 // easy way to test for this) -- and neither should the cells 
 879                 // adjacent to them as this could result in a visible space 
 880                 // between two cells separated by, e.g. font change, cell which 
 883                 int step 
= s_width 
- xpos
; 
 886                     // first count the cells which will get extra space 
 892                         for ( c 
= line
->GetNext(); c 
!= cell
; c 
= c
->GetNext() ) 
 894                             if ( c
->IsLinebreakAllowed() ) 
 901                     // and now extra space to those cells which merit it 
 904                         // first cell on line is not moved: 
 905                         line
->SetPos(line
->GetPosX() + s_indent
, 
 906                                      line
->GetPosY() + ypos
); 
 908                         line 
= line
->GetNext(); 
 909                         for ( int n 
= 0; line 
!= cell
; line 
= line
->GetNext() ) 
 911                             if ( line
->IsLinebreakAllowed() ) 
 913                                 // offset the next cell relative to this one 
 914                                 // thus increasing our size 
 918                             line
->SetPos(line
->GetPosX() + s_indent 
+ 
 919                                            ((n 
* step
) / total
), 
 920                                            line
->GetPosY() + ypos
); 
 925                         // this will cause the code to enter "else branch" below: 
 930                 if ( step 
<= 0 ) // no extra space to distribute 
 932                     // just set the indent properly 
 935                         line
->SetPos(line
->GetPosX() + s_indent
, 
 936                                      line
->GetPosY() + ypos
); 
 937                         line 
= line
->GetNext(); 
 944             ysizeup 
= ysizedown 
= 0; 
 949     // setup height & width, depending on container layout: 
 950     m_Height 
= ypos 
+ (ysizedown 
+ ysizeup
) + m_IndentBottom
; 
 952     if (m_Height 
< m_MinHeight
) 
 954         if (m_MinHeightAlign 
!= wxHTML_ALIGN_TOP
) 
 956             int diff 
= m_MinHeight 
- m_Height
; 
 957             if (m_MinHeightAlign 
== wxHTML_ALIGN_CENTER
) diff 
/= 2; 
 961                 cell
->SetPos(cell
->GetPosX(), cell
->GetPosY() + diff
); 
 962                 cell 
= cell
->GetNext(); 
 965         m_Height 
= m_MinHeight
; 
 968     if (curLineWidth 
> m_MaxTotalWidth
) 
 969         m_MaxTotalWidth 
= curLineWidth
; 
 971     m_MaxTotalWidth 
+= s_indent 
+ ((m_IndentRight 
< 0) ? (-m_IndentRight 
* m_Width 
/ 100) : m_IndentRight
); 
 972     MaxLineWidth 
+= s_indent 
+ ((m_IndentRight 
< 0) ? (-m_IndentRight 
* m_Width 
/ 100) : m_IndentRight
); 
 973     if (m_Width 
< MaxLineWidth
) m_Width 
= MaxLineWidth
; 
 978 void wxHtmlContainerCell::UpdateRenderingStatePre(wxHtmlRenderingInfo
& info
, 
 979                                                   wxHtmlCell 
*cell
) const 
 981     wxHtmlSelection 
*s 
= info
.GetSelection(); 
 983     if (s
->GetFromCell() == cell 
|| s
->GetToCell() == cell
) 
 985         info
.GetState().SetSelectionState(wxHTML_SEL_CHANGING
); 
 989 void wxHtmlContainerCell::UpdateRenderingStatePost(wxHtmlRenderingInfo
& info
, 
 990                                                    wxHtmlCell 
*cell
) const 
 992     wxHtmlSelection 
*s 
= info
.GetSelection(); 
 994     if (s
->GetToCell() == cell
) 
 995         info
.GetState().SetSelectionState(wxHTML_SEL_OUT
); 
 996     else if (s
->GetFromCell() == cell
) 
 997         info
.GetState().SetSelectionState(wxHTML_SEL_IN
); 
1000 #define mMin(a, b) (((a) < (b)) ? (a) : (b)) 
1001 #define mMax(a, b) (((a) < (b)) ? (b) : (a)) 
1003 void wxHtmlContainerCell::Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
, 
1004                                wxHtmlRenderingInfo
& info
) 
1006 #if 0 // useful for debugging 
1007     dc
.SetPen(*wxRED_PEN
); 
1008     dc
.DrawRectangle(x
+m_PosX
,y
+m_PosY
,m_Width
,m_Height
); 
1011     int xlocal 
= x 
+ m_PosX
; 
1012     int ylocal 
= y 
+ m_PosY
; 
1016         wxBrush myb 
= wxBrush(m_BkColour
, wxSOLID
); 
1018         int real_y1 
= mMax(ylocal
, view_y1
); 
1019         int real_y2 
= mMin(ylocal 
+ m_Height 
- 1, view_y2
); 
1022         dc
.SetPen(*wxTRANSPARENT_PEN
); 
1023         dc
.DrawRectangle(xlocal
, real_y1
, m_Width
, real_y2 
- real_y1 
+ 1); 
1028         wxPen 
mypen1(m_BorderColour1
, 1, wxSOLID
); 
1029         wxPen 
mypen2(m_BorderColour2
, 1, wxSOLID
); 
1032         dc
.DrawLine(xlocal
, ylocal
, xlocal
, ylocal 
+ m_Height 
- 1); 
1033         dc
.DrawLine(xlocal
, ylocal
, xlocal 
+ m_Width
, ylocal
); 
1035         dc
.DrawLine(xlocal 
+ m_Width 
- 1, ylocal
, xlocal 
+  m_Width 
- 1, ylocal 
+ m_Height 
- 1); 
1036         dc
.DrawLine(xlocal
, ylocal 
+ m_Height 
- 1, xlocal 
+ m_Width
, ylocal 
+ m_Height 
- 1); 
1041         // draw container's contents: 
1042         for (wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext()) 
1045             // optimize drawing: don't render off-screen content: 
1046             if ((ylocal 
+ cell
->GetPosY() <= view_y2
) && 
1047                 (ylocal 
+ cell
->GetPosY() + cell
->GetHeight() > view_y1
)) 
1049                 // the cell is visible, draw it: 
1050                 UpdateRenderingStatePre(info
, cell
); 
1052                            xlocal
, ylocal
, view_y1
, view_y2
, 
1054                 UpdateRenderingStatePost(info
, cell
); 
1058                 // the cell is off-screen, proceed with font+color+etc. 
1060                 cell
->DrawInvisible(dc
, xlocal
, ylocal
, info
); 
1068 void wxHtmlContainerCell::DrawInvisible(wxDC
& dc
, int x
, int y
, 
1069                                         wxHtmlRenderingInfo
& info
) 
1073         for (wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext()) 
1075             UpdateRenderingStatePre(info
, cell
); 
1076             cell
->DrawInvisible(dc
, x 
+ m_PosX
, y 
+ m_PosY
, info
); 
1077             UpdateRenderingStatePost(info
, cell
); 
1083 wxColour 
wxHtmlContainerCell::GetBackgroundColour() 
1088         return wxNullColour
; 
1093 wxHtmlLinkInfo 
*wxHtmlContainerCell::GetLink(int x
, int y
) const 
1095     wxHtmlCell 
*cell 
= FindCellByPos(x
, y
); 
1097     // VZ: I don't know if we should pass absolute or relative coords to 
1098     //     wxHtmlCell::GetLink()? As the base class version just ignores them 
1099     //     anyhow, it hardly matters right now but should still be clarified 
1100     return cell 
? cell
->GetLink(x
, y
) : NULL
; 
1105 void wxHtmlContainerCell::InsertCell(wxHtmlCell 
*f
) 
1107     if (!m_Cells
) m_Cells 
= m_LastCell 
= f
; 
1110         m_LastCell
->SetNext(f
); 
1112         if (m_LastCell
) while (m_LastCell
->GetNext()) m_LastCell 
= m_LastCell
->GetNext(); 
1120 void wxHtmlContainerCell::SetAlign(const wxHtmlTag
& tag
) 
1122     if (tag
.HasParam(wxT("ALIGN"))) 
1124         wxString alg 
= tag
.GetParam(wxT("ALIGN")); 
1126         if (alg 
== wxT("CENTER")) 
1127             SetAlignHor(wxHTML_ALIGN_CENTER
); 
1128         else if (alg 
== wxT("LEFT")) 
1129             SetAlignHor(wxHTML_ALIGN_LEFT
); 
1130         else if (alg 
== wxT("JUSTIFY")) 
1131             SetAlignHor(wxHTML_ALIGN_JUSTIFY
); 
1132         else if (alg 
== wxT("RIGHT")) 
1133             SetAlignHor(wxHTML_ALIGN_RIGHT
); 
1140 void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag
& tag
, double pixel_scale
) 
1142     if (tag
.HasParam(wxT("WIDTH"))) 
1145         wxString wd 
= tag
.GetParam(wxT("WIDTH")); 
1147         if (wd
[wd
.length()-1] == wxT('%')) 
1149             wxSscanf(wd
.c_str(), wxT("%i%%"), &wdi
); 
1150             SetWidthFloat(wdi
, wxHTML_UNITS_PERCENT
); 
1154             wxSscanf(wd
.c_str(), wxT("%i"), &wdi
); 
1155             SetWidthFloat((int)(pixel_scale 
* (double)wdi
), wxHTML_UNITS_PIXELS
); 
1163 const wxHtmlCell
* wxHtmlContainerCell::Find(int condition
, const void* param
) const 
1167         for (wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext()) 
1169             const wxHtmlCell 
*r 
= cell
->Find(condition
, param
); 
1177 wxHtmlCell 
*wxHtmlContainerCell::FindCellByPos(wxCoord x
, wxCoord y
, 
1178                                                unsigned flags
) const 
1180     if ( flags 
& wxHTML_FIND_EXACT 
) 
1182         for ( const wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext() ) 
1184             int cx 
= cell
->GetPosX(), 
1185                 cy 
= cell
->GetPosY(); 
1187             if ( (cx 
<= x
) && (cx 
+ cell
->GetWidth() > x
) && 
1188                  (cy 
<= y
) && (cy 
+ cell
->GetHeight() > y
) ) 
1190                 return cell
->FindCellByPos(x 
- cx
, y 
- cy
, flags
); 
1194     else if ( flags 
& wxHTML_FIND_NEAREST_AFTER 
) 
1197         for ( const wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext() ) 
1199             if ( cell
->IsFormattingCell() ) 
1201             int cellY 
= cell
->GetPosY(); 
1202             if (!( y 
< cellY 
|| (y 
< cellY 
+ cell
->GetHeight() && 
1203                                  x 
< cell
->GetPosX() + cell
->GetWidth()) )) 
1206             c 
= cell
->FindCellByPos(x 
- cell
->GetPosX(), y 
- cellY
, flags
); 
1210     else if ( flags 
& wxHTML_FIND_NEAREST_BEFORE 
) 
1212         wxHtmlCell 
*c2
, *c 
= NULL
; 
1213         for ( const wxHtmlCell 
*cell 
= m_Cells
; cell
; cell 
= cell
->GetNext() ) 
1215             if ( cell
->IsFormattingCell() ) 
1217             int cellY 
= cell
->GetPosY(); 
1218             if (!( cellY 
+ cell
->GetHeight() <= y 
|| 
1219                    (y 
>= cellY 
&& x 
>= cell
->GetPosX()) )) 
1221             c2 
= cell
->FindCellByPos(x 
- cell
->GetPosX(), y 
- cellY
, flags
); 
1232 bool wxHtmlContainerCell::ProcessMouseClick(wxHtmlWindowInterface 
*window
, 
1234                                             const wxMouseEvent
& event
) 
1236 #if WXWIN_COMPATIBILITY_2_6 
1237     wxHtmlCellOnMouseClickCompatHelper 
compat(window
, pos
, event
); 
1238     return compat
.CallOnMouseClick(this); 
1241 void wxHtmlContainerCell::OnMouseClick(wxWindow
*, 
1242                                        int, int, const wxMouseEvent
& event
) 
1244     wxCHECK_RET( gs_helperOnMouseClick
, _T("unexpected call to OnMouseClick") ); 
1245     wxHtmlWindowInterface 
*window 
= gs_helperOnMouseClick
->window
; 
1246     const wxPoint
& pos 
= gs_helperOnMouseClick
->pos
; 
1247 #endif // WXWIN_COMPATIBILITY_2_6 
1249     bool retval 
= false; 
1250     wxHtmlCell 
*cell 
= FindCellByPos(pos
.x
, pos
.y
); 
1252         retval 
= cell
->ProcessMouseClick(window
, pos
, event
); 
1254 #if WXWIN_COMPATIBILITY_2_6 
1255     gs_helperOnMouseClick
->retval 
= retval
; 
1258 #endif // WXWIN_COMPATIBILITY_2_6 
1262 wxHtmlCell 
*wxHtmlContainerCell::GetFirstTerminal() const 
1267         for (wxHtmlCell 
*c 
= m_Cells
; c
; c 
= c
->GetNext()) 
1269             c2 
= c
->GetFirstTerminal(); 
1277 wxHtmlCell 
*wxHtmlContainerCell::GetLastTerminal() const 
1281         // most common case first: 
1282         wxHtmlCell 
*c 
= m_LastCell
->GetLastTerminal(); 
1287         wxHtmlCell 
*c2 
= NULL
; 
1288         for (c 
= m_Cells
; c
; c 
= c
->GetNext()) 
1290             ctmp 
= c
->GetLastTerminal(); 
1301 static bool IsEmptyContainer(wxHtmlContainerCell 
*cell
) 
1303     for ( wxHtmlCell 
*c 
= cell
->GetFirstChild(); c
; c 
= c
->GetNext() ) 
1305         if ( !c
->IsTerminalCell() || !c
->IsFormattingCell() ) 
1311 void wxHtmlContainerCell::RemoveExtraSpacing(bool top
, bool bottom
) 
1314         SetIndent(0, wxHTML_INDENT_TOP
); 
1316         SetIndent(0, wxHTML_INDENT_BOTTOM
); 
1321         wxHtmlContainerCell 
*cont
; 
1324             for ( c 
= m_Cells
; c
; c 
= c
->GetNext() ) 
1326                 if ( c
->IsTerminalCell() ) 
1328                     if ( !c
->IsFormattingCell() ) 
1333                     cont 
= (wxHtmlContainerCell
*)c
; 
1334                     if ( IsEmptyContainer(cont
) ) 
1336                         cont
->SetIndent(0, wxHTML_INDENT_VERTICAL
); 
1340                         cont
->RemoveExtraSpacing(true, false); 
1350             for ( c 
= m_Cells
; c
; c 
= c
->GetNext() ) 
1353             for ( int i 
= arr
.GetCount() - 1; i 
>= 0; i
--) 
1355                 c 
= (wxHtmlCell
*)arr
[i
]; 
1356                 if ( c
->IsTerminalCell() ) 
1358                     if ( !c
->IsFormattingCell() ) 
1363                     cont 
= (wxHtmlContainerCell
*)c
; 
1364                     if ( IsEmptyContainer(cont
) ) 
1366                         cont
->SetIndent(0, wxHTML_INDENT_VERTICAL
); 
1370                         cont
->RemoveExtraSpacing(false, true); 
1382 // -------------------------------------------------------------------------- 
1384 // -------------------------------------------------------------------------- 
1386 IMPLEMENT_ABSTRACT_CLASS(wxHtmlColourCell
, wxHtmlCell
) 
1388 void wxHtmlColourCell::Draw(wxDC
& dc
, 
1390                             int WXUNUSED(view_y1
), int WXUNUSED(view_y2
), 
1391                             wxHtmlRenderingInfo
& info
) 
1393     DrawInvisible(dc
, x
, y
, info
); 
1396 void wxHtmlColourCell::DrawInvisible(wxDC
& dc
, 
1397                                      int WXUNUSED(x
), int WXUNUSED(y
), 
1398                                      wxHtmlRenderingInfo
& info
) 
1400     wxHtmlRenderingState
& state 
= info
.GetState(); 
1401     if (m_Flags 
& wxHTML_CLR_FOREGROUND
) 
1403         state
.SetFgColour(m_Colour
); 
1404         if (state
.GetSelectionState() != wxHTML_SEL_IN
) 
1405             dc
.SetTextForeground(m_Colour
); 
1407             dc
.SetTextForeground( 
1408                     info
.GetStyle().GetSelectedTextColour(m_Colour
)); 
1410     if (m_Flags 
& wxHTML_CLR_BACKGROUND
) 
1412         state
.SetBgColour(m_Colour
); 
1413         if (state
.GetSelectionState() != wxHTML_SEL_IN
) 
1415             dc
.SetTextBackground(m_Colour
); 
1416             dc
.SetBackground(wxBrush(m_Colour
, wxSOLID
)); 
1420             wxColour c 
= info
.GetStyle().GetSelectedTextBgColour(m_Colour
); 
1421             dc
.SetTextBackground(c
); 
1422             dc
.SetBackground(wxBrush(c
, wxSOLID
)); 
1430 // --------------------------------------------------------------------------- 
1432 // --------------------------------------------------------------------------- 
1434 IMPLEMENT_ABSTRACT_CLASS(wxHtmlFontCell
, wxHtmlCell
) 
1436 void wxHtmlFontCell::Draw(wxDC
& dc
, 
1437                           int WXUNUSED(x
), int WXUNUSED(y
), 
1438                           int WXUNUSED(view_y1
), int WXUNUSED(view_y2
), 
1439                           wxHtmlRenderingInfo
& WXUNUSED(info
)) 
1444 void wxHtmlFontCell::DrawInvisible(wxDC
& dc
, int WXUNUSED(x
), int WXUNUSED(y
), 
1445                                    wxHtmlRenderingInfo
& WXUNUSED(info
)) 
1457 // --------------------------------------------------------------------------- 
1459 // --------------------------------------------------------------------------- 
1461 IMPLEMENT_ABSTRACT_CLASS(wxHtmlWidgetCell
, wxHtmlCell
) 
1463 wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow 
*wnd
, int w
) 
1467     m_Wnd
->GetSize(&sx
, &sy
); 
1468     m_Width 
= sx
, m_Height 
= sy
; 
1473 void wxHtmlWidgetCell::Draw(wxDC
& WXUNUSED(dc
), 
1474                             int WXUNUSED(x
), int WXUNUSED(y
), 
1475                             int WXUNUSED(view_y1
), int WXUNUSED(view_y2
), 
1476                             wxHtmlRenderingInfo
& WXUNUSED(info
)) 
1478     int absx 
= 0, absy 
= 0, stx
, sty
; 
1479     wxHtmlCell 
*c 
= this; 
1483         absx 
+= c
->GetPosX(); 
1484         absy 
+= c
->GetPosY(); 
1488     ((wxScrolledWindow
*)(m_Wnd
->GetParent()))->GetViewStart(&stx
, &sty
); 
1489     m_Wnd
->SetSize(absx 
- wxHTML_SCROLL_STEP 
* stx
, absy  
- wxHTML_SCROLL_STEP 
* sty
, m_Width
, m_Height
); 
1494 void wxHtmlWidgetCell::DrawInvisible(wxDC
& WXUNUSED(dc
), 
1495                                      int WXUNUSED(x
), int WXUNUSED(y
), 
1496                                      wxHtmlRenderingInfo
& WXUNUSED(info
)) 
1498     int absx 
= 0, absy 
= 0, stx
, sty
; 
1499     wxHtmlCell 
*c 
= this; 
1503         absx 
+= c
->GetPosX(); 
1504         absy 
+= c
->GetPosY(); 
1508     ((wxScrolledWindow
*)(m_Wnd
->GetParent()))->GetViewStart(&stx
, &sty
); 
1509     m_Wnd
->SetSize(absx 
- wxHTML_SCROLL_STEP 
* stx
, absy  
- wxHTML_SCROLL_STEP 
* sty
, m_Width
, m_Height
); 
1514 void wxHtmlWidgetCell::Layout(int w
) 
1516     if (m_WidthFloat 
!= 0) 
1518         m_Width 
= (w 
* m_WidthFloat
) / 100; 
1519         m_Wnd
->SetSize(m_Width
, m_Height
); 
1522     wxHtmlCell::Layout(w
); 
1527 // ---------------------------------------------------------------------------- 
1528 // wxHtmlTerminalCellsInterator 
1529 // ---------------------------------------------------------------------------- 
1531 const wxHtmlCell
* wxHtmlTerminalCellsInterator::operator++() 
1538         if ( m_pos 
== m_to 
) 
1544         if ( m_pos
->GetNext() ) 
1545             m_pos 
= m_pos
->GetNext(); 
1548             // we must go up the hierarchy until we reach container where this 
1549             // is not the last child, and then go down to first terminal cell: 
1550             while ( m_pos
->GetNext() == NULL 
) 
1552                 m_pos 
= m_pos
->GetParent(); 
1556             m_pos 
= m_pos
->GetNext(); 
1558         while ( m_pos
->GetFirstChild() != NULL 
) 
1559             m_pos 
= m_pos
->GetFirstChild(); 
1560     } while ( !m_pos
->IsTerminalCell() );