+
+void wxHtmlWordCell::Draw(wxDC& dc, int x, int y,
+ int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+ wxHtmlRenderingState& state)
+{
+#if 0 // useful for debugging
+ dc.DrawRectangle(x+m_PosX,y+m_PosY,m_Width,m_Height);
+#endif
+
+ if ( state.GetSelectionState() == wxHTML_SEL_CHANGING )
+ {
+ // Selection changing, we must draw the word piecewise:
+
+ unsigned ofs1, ofs2;
+ wxString textBefore, textInside, textAfter;
+ wxHtmlSelection *s = state.GetSelection();
+
+ Split(dc,
+ this == s->GetFromCell() ? s->GetFromPos() : wxDefaultPosition,
+ this == s->GetToCell() ? s->GetToPos() : wxDefaultPosition,
+ textBefore, textInside, textAfter, ofs1, ofs2);
+ dc.DrawText(textBefore, x + m_PosX, y + m_PosY);
+ int w1,w2,w3,h123;
+ dc.GetTextExtent(textBefore, &w1,&h123);
+ dc.GetTextExtent(textInside, &w2,&h123);
+ dc.GetTextExtent(textAfter, &w3,&h123);
+ if ( !textInside.empty() )
+ {
+ SwitchSelState(dc, state, true);
+ dc.DrawText(textInside, x + m_PosX + ofs1, y + m_PosY);
+ }
+ if ( !textAfter.empty() )
+ {
+ SwitchSelState(dc, state, false);
+ dc.DrawText(textAfter, x + m_PosX + ofs2, y + m_PosY);
+ }
+ }
+ else
+ {
+ // Not changing selection state, draw the word in single mode:
+
+ if ( state.GetSelectionState() != wxHTML_SEL_OUT &&
+ dc.GetBackgroundMode() != wxSOLID )
+ {
+ SwitchSelState(dc, state, true);
+ }
+ else if ( state.GetSelectionState() == wxHTML_SEL_OUT &&
+ dc.GetBackgroundMode() == wxSOLID )
+ {
+ SwitchSelState(dc, state, false);
+ }
+ dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
+ }