+void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
+{
+ const wxMouseEvent *e = link.GetEvent();
+ if (e == NULL || e->LeftUp())
+ LoadPage(link.GetHref());
+}
+
+void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell,
+ wxCoord x, wxCoord y,
+ const wxMouseEvent& event)
+{
+ wxCHECK_RET( cell, _T("can't be called with NULL cell") );
+
+ cell->OnMouseClick(this, x, y, event);
+}
+
+void wxHtmlWindow::OnCellMouseHover(wxHtmlCell * WXUNUSED(cell),
+ wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+{
+ // do nothing here
+}
+
+void wxHtmlWindow::OnEraseBackground(wxEraseEvent& event)
+{
+ // we do have to erase background now that we reuse it (instead of
+ // overwriting it) in OnPaint() below, but maybe we should set some flag if
+ // we get here as this would mean that user code doesn't paint background
+ // itself and then we wouldn't have to copy old bits to dcm below...
+ event.Skip();
+}
+
+void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+ wxPaintDC dc(this);
+
+ if (m_tmpCanDrawLocks > 0 || m_Cell == NULL) return;
+
+ int x, y;
+ GetViewStart(&x, &y);
+ wxRect rect = GetUpdateRegion().GetBox();
+ wxSize sz = GetSize();
+
+ wxMemoryDC dcm;
+ if ( !m_backBuffer )
+ m_backBuffer = new wxBitmap(sz.x, sz.y);
+ dcm.SelectObject(*m_backBuffer);
+ PrepareDC(dcm);
+
+ // preserve the existing background, otherwise we'd erase anything the user
+ // code had drawn in its EVT_ERASE_BACKGROUND handler when we do the Blit
+ // back below
+ dcm.Blit(0, rect.GetTop(),
+ sz.x, rect.GetBottom() - rect.GetTop() + 1,
+ &dc,
+ 0, rect.GetTop());
+
+ dcm.SetMapMode(wxMM_TEXT);
+ dcm.SetBackgroundMode(wxTRANSPARENT);
+
+ wxHtmlRenderingInfo rinfo;
+ wxDefaultHtmlRenderingStyle rstyle;
+ rinfo.SetSelection(m_selection);
+ rinfo.SetStyle(&rstyle);
+ m_Cell->Draw(dcm, 0, 0,
+ y * wxHTML_SCROLL_STEP + rect.GetTop(),
+ y * wxHTML_SCROLL_STEP + rect.GetBottom(),
+ rinfo);
+
+//#define DEBUG_HTML_SELECTION
+#ifdef DEBUG_HTML_SELECTION
+ {
+ int xc, yc, x, y;
+ wxGetMousePosition(&xc, &yc);
+ ScreenToClient(&xc, &yc);
+ CalcUnscrolledPosition(xc, yc, &x, &y);
+ wxHtmlCell *at = m_Cell->FindCellByPos(x, y);
+ wxHtmlCell *before =
+ m_Cell->FindCellByPos(x, y, wxHTML_FIND_NEAREST_BEFORE);
+ wxHtmlCell *after =
+ m_Cell->FindCellByPos(x, y, wxHTML_FIND_NEAREST_AFTER);
+
+ dcm.SetBrush(*wxTRANSPARENT_BRUSH);
+ dcm.SetPen(*wxBLACK_PEN);
+ if (at)
+ dcm.DrawRectangle(at->GetAbsPos(),
+ wxSize(at->GetWidth(),at->GetHeight()));
+ dcm.SetPen(*wxGREEN_PEN);
+ if (before)
+ dcm.DrawRectangle(before->GetAbsPos().x+1, before->GetAbsPos().y+1,
+ before->GetWidth()-2,before->GetHeight()-2);
+ dcm.SetPen(*wxRED_PEN);
+ if (after)
+ dcm.DrawRectangle(after->GetAbsPos().x+2, after->GetAbsPos().y+2,
+ after->GetWidth()-4,after->GetHeight()-4);