+//-----------------------------------------------------------------------------
+// wxHtmlWindowMouseHelper
+//-----------------------------------------------------------------------------
+
+wxHtmlWindowMouseHelper::wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface)
+ : m_tmpMouseMoved(false),
+ m_tmpLastLink(NULL),
+ m_tmpLastCell(NULL),
+ m_interface(iface)
+{
+}
+
+void wxHtmlWindowMouseHelper::HandleMouseMoved()
+{
+ m_tmpMouseMoved = true;
+}
+
+bool wxHtmlWindowMouseHelper::HandleMouseClick(wxHtmlCell *rootCell,
+ const wxPoint& pos,
+ const wxMouseEvent& event)
+{
+ if (!rootCell)
+ return false;
+
+ wxHtmlCell *cell = rootCell->FindCellByPos(pos.x, pos.y);
+ // this check is needed because FindCellByPos returns terminal cell and
+ // containers may have empty borders -- in this case NULL will be
+ // returned
+ if (!cell)
+ return false;
+
+ // adjust the coordinates to be relative to this cell:
+ wxPoint relpos = pos - cell->GetAbsPos(rootCell);
+
+ return OnCellClicked(cell, relpos.x, relpos.y, event);
+}
+
+void wxHtmlWindowMouseHelper::HandleIdle(wxHtmlCell *rootCell,
+ const wxPoint& pos)
+{
+ wxHtmlCell *cell = rootCell ? rootCell->FindCellByPos(pos.x, pos.y) : NULL;
+
+ if (cell != m_tmpLastCell)
+ {
+ wxHtmlLinkInfo *lnk = NULL;
+ if (cell)
+ {
+ // adjust the coordinates to be relative to this cell:
+ wxPoint relpos = pos - cell->GetAbsPos(rootCell);
+ lnk = cell->GetLink(relpos.x, relpos.y);
+ }
+
+ wxCursor cur;
+ if (cell)
+ cur = cell->GetMouseCursor(m_interface);
+ else
+ cur = m_interface->GetHTMLCursor(
+ wxHtmlWindowInterface::HTMLCursor_Default);
+
+ m_interface->GetHTMLWindow()->SetCursor(cur);
+
+ if (lnk != m_tmpLastLink)
+ {
+ if (lnk)
+ m_interface->SetHTMLStatusText(lnk->GetHref());
+ else
+ m_interface->SetHTMLStatusText(wxEmptyString);
+
+ m_tmpLastLink = lnk;
+ }
+
+ m_tmpLastCell = cell;
+ }
+ else // mouse moved but stayed in the same cell
+ {
+ if ( cell )
+ {
+ OnCellMouseHover(cell, pos.x, pos.y);
+ }
+ }
+
+ m_tmpMouseMoved = false;
+}
+
+bool wxHtmlWindowMouseHelper::OnCellClicked(wxHtmlCell *cell,
+ wxCoord x, wxCoord y,
+ const wxMouseEvent& event)
+{
+ wxCHECK_MSG( cell, false, _T("can't be called with NULL cell") );
+
+ return cell->ProcessMouseClick(m_interface, wxPoint(x, y), event);
+}
+
+void wxHtmlWindowMouseHelper::OnCellMouseHover(wxHtmlCell * WXUNUSED(cell),
+ wxCoord WXUNUSED(x),
+ wxCoord WXUNUSED(y))
+{
+ // do nothing here
+}
+
+//-----------------------------------------------------------------------------
+// wxHtmlWindow
+//-----------------------------------------------------------------------------