projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed handling of "a:\" command line arguments, added comment explaining how the...
[wxWidgets.git]
/
src
/
html
/
htmlcell.cpp
diff --git
a/src/html/htmlcell.cpp
b/src/html/htmlcell.cpp
index cb0ce6904c526423a2087d13b252755b13911c1f..909584da202fe00c0d3a07773574286c17eba105 100644
(file)
--- a/
src/html/htmlcell.cpp
+++ b/
src/html/htmlcell.cpp
@@
-115,6
+115,14
@@
const wxHtmlCell* wxHtmlCell::Find(int WXUNUSED(condition), const void* WXUNUSED
}
}
+wxHtmlCell *wxHtmlCell::FindCellByPos(wxCoord x, wxCoord y) const
+{
+ if ( x >= 0 && x < m_Width && y >= 0 && y < m_Height )
+ return wxConstCast(this, wxHtmlCell);
+
+ return NULL;
+}
+
//-----------------------------------------------------------------------------
// wxHtmlWordCell
//-----------------------------------------------------------------------------
// wxHtmlWordCell
@@
-460,18
+468,12
@@
void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
{
wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
{
- wxHtmlCell *c = m_Cells;
- int cx, cy, cw, ch;
+ wxHtmlCell *cell = FindCellByPos(x, y);
- while (c)
- {
- cx = c->GetPosX(), cy = c->GetPosY();
- cw = c->GetWidth(), ch = c->GetHeight();
- if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
- return c->GetLink(x - cx, y - cy);
- c = c->GetNext();
- }
- return NULL;
+ // VZ: I don't know if we should pass absolute or relative coords to
+ // wxHtmlCell::GetLink()? As the base class version just ignores them
+ // anyhow, it hardly matters right now but should still be clarified
+ return cell ? cell->GetLink(x, y) : NULL;
}
}
@@
-550,25
+552,29
@@
const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co
}
}
-
-void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
+wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y) const
{
{
-
if (m_Cells
)
+
for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext()
)
{
{
- wxHtmlCell *c = m_Cells;
- while (c)
+ int cx = cell->GetPosX(),
+ cy = cell->GetPosY();
+
+ if ( (cx <= x) && (cx + cell->GetWidth() > x) &&
+ (cy <= y) && (cy + cell->GetHeight() > y) )
{
{
- if ( (c->GetPosX() <= x) &&
- (c->GetPosY() <= y) &&
- (c->GetPosX() + c->GetWidth() > x) &&
- (c->GetPosY() + c->GetHeight() > y))
- {
- c->OnMouseClick(parent, x - c->GetPosX(), y - c->GetPosY(), event);
- break;
- }
- c = c->GetNext();
+ return cell->FindCellByPos(x - cx, y - cy);
}
}
}
}
+
+ return NULL;
+}
+
+
+void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
+{
+ wxHtmlCell *cell = FindCellByPos(x, y);
+ if ( cell )
+ cell->OnMouseClick(parent, x, y, event);
}
}