+ if (m_Cells)
+ {
+ for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
+ {
+ const wxHtmlCell *r = cell->Find(condition, param);
+ if (r) return r;
+ }
+ }
+ return NULL;
+}
+
+
+wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y,
+ unsigned flags) const
+{
+ if ( flags & wxHTML_FIND_EXACT )
+ {
+ for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
+ {
+ int cx = cell->GetPosX(),
+ cy = cell->GetPosY();
+
+ if ( (cx <= x) && (cx + cell->GetWidth() > x) &&
+ (cy <= y) && (cy + cell->GetHeight() > y) )
+ {
+ return cell->FindCellByPos(x - cx, y - cy, flags);
+ }
+ }
+ }
+ else if ( flags & wxHTML_FIND_NEAREST_AFTER )
+ {
+ wxHtmlCell *c;
+ for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
+ {
+ if ( cell->IsFormattingCell() )
+ continue;
+ int cellY = cell->GetPosY();
+ if (!( y < cellY || (y < cellY + cell->GetHeight() &&
+ x < cell->GetPosX() + cell->GetWidth()) ))
+ continue;
+
+ c = cell->FindCellByPos(x - cell->GetPosX(), y - cellY, flags);
+ if (c) return c;
+ }
+ }
+ else if ( flags & wxHTML_FIND_NEAREST_BEFORE )
+ {
+ wxHtmlCell *c2, *c = NULL;
+ for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
+ {
+ if ( cell->IsFormattingCell() )
+ continue;
+ int cellY = cell->GetPosY();
+ if (!( cellY + cell->GetHeight() <= y ||
+ (y >= cellY && x >= cell->GetPosX()) ))
+ break;
+ c2 = cell->FindCellByPos(x - cell->GetPosX(), y - cellY, flags);
+ if (c2)
+ c = c2;
+ }
+ if (c) return c;
+ }
+
+ return NULL;
+}
+
+
+bool wxHtmlContainerCell::ProcessMouseClick(wxHtmlWindowInterface *window,
+ const wxPoint& pos,
+ const wxMouseEvent& event)
+{
+#if WXWIN_COMPATIBILITY_2_6
+ wxHtmlCellOnMouseClickCompatHelper compat(window, pos, event);
+ return compat.CallOnMouseClick(this);
+}
+
+void wxHtmlContainerCell::OnMouseClick(wxWindow*,
+ int, int, const wxMouseEvent& event)
+{
+ wxCHECK_RET( gs_helperOnMouseClick, _T("unexpected call to OnMouseClick") );
+ wxHtmlWindowInterface *window = gs_helperOnMouseClick->window;
+ const wxPoint& pos = gs_helperOnMouseClick->pos;
+#endif // WXWIN_COMPATIBILITY_2_6
+
+ bool retval = false;
+ wxHtmlCell *cell = FindCellByPos(pos.x, pos.y);
+ if ( cell )
+ retval = cell->ProcessMouseClick(window, pos, event);
+
+#if WXWIN_COMPATIBILITY_2_6
+ gs_helperOnMouseClick->retval = retval;
+#else
+ return retval;
+#endif // WXWIN_COMPATIBILITY_2_6
+}
+