From 0b2dadd342dde6cb35f351136c2b2c9cea007b1d Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 11 Jan 2000 23:30:43 +0000 Subject: [PATCH] added mouse event member into wxHtmlLinkInfo. wxHtmlWindow::OnLinkClicked now takes const wxHtmlLinkInfo& argument git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/htcell.tex | 6 +++--- docs/latex/wx/htwindow.tex | 2 +- src/html/htmlcell.cpp | 16 +++++++++------- src/html/htmlwin.cpp | 6 +++--- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/latex/wx/htcell.tex b/docs/latex/wx/htcell.tex index bd61fbd2ab..9cbda9c314 100644 --- a/docs/latex/wx/htcell.tex +++ b/docs/latex/wx/htcell.tex @@ -197,7 +197,7 @@ before calling Layout. \membersection{wxHtmlCell::OnMouseClick}\label{wxhtmlcellonmouseclick} -\func{virtual void}{OnMouseClick}{\param{wxWindow* }{parent}, \param{int }{x}, \param{int }{y}, \param{bool }{left}, \param{bool }{middle}, \param{bool }{right}} +\func{virtual void}{OnMouseClick}{\param{wxWindow* }{parent}, \param{int }{x}, \param{int }{y}, \param{const wxMouseEvent& }{event}} This function is simple event handler. Each time user clicks mouse button over a cell within \helpref{wxHtmlWindow}{wxhtmlwindow} this method of that cell is called. Default behavior is @@ -205,8 +205,8 @@ that it calls \helpref{wxHtmlWindow::LoadPage}{wxhtmlwindowloadpage}. \wxheading{Note} -If you need more "advanced" behaviour (for example you'd like to catch mouse movement events or -key events or whatsoever) you should use wxHtmlBinderCell instead. +If you need more "advanced" event handling +you should use wxHtmlBinderCell instead. \wxheading{Parameters} diff --git a/docs/latex/wx/htwindow.tex b/docs/latex/wx/htwindow.tex index ce72559e2c..65c82c55ec 100644 --- a/docs/latex/wx/htwindow.tex +++ b/docs/latex/wx/htwindow.tex @@ -121,7 +121,7 @@ FALSE if an error occured, TRUE otherwise \membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked} -\func{virtual void}{OnLinkClicked}{\param{wxHtmlLinkInfo* }{link}} +\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo& }{link}} Called when user clicks on hypertext link. Default behaviour is to call \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else. diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index f9f50db98f..af01bcbfe6 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -49,15 +49,17 @@ wxHtmlCell::~wxHtmlCell() } -void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, - bool WXUNUSED(left), - bool WXUNUSED(middle), - bool WXUNUSED(right)) +void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, + const wxMouseEvent& event) { wxHtmlLinkInfo *lnk = GetLink(x, y); if (lnk != NULL) - ((wxHtmlWindow*)parent) -> OnLinkClicked(lnk); + { + wxHtmlLinkInfo lnk2(*lnk); + lnk2.SetEvent(&event); + ((wxHtmlWindow*)parent) -> OnLinkClicked(lnk2); // note : this overcasting is legal because parent is *always* wxHtmlWindow + } } @@ -444,7 +446,7 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co -void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, bool left, bool middle, bool right) +void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event) { if (m_Cells) { wxHtmlCell *c = m_Cells; @@ -453,7 +455,7 @@ void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, bool left (c -> GetPosY() <= y) && (c -> GetPosX() + c -> GetWidth() > x) && (c -> GetPosY() + c -> GetHeight() > y)) { - c -> OnMouseClick(parent, x - c -> GetPosX(), y - c -> GetPosY(), left, middle, right); + c -> OnMouseClick(parent, x - c -> GetPosX(), y - c -> GetPosY(), event); break; } c = c -> GetNext(); diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 76e0c45e64..447a322890 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -418,9 +418,9 @@ void wxHtmlWindow::AddFilter(wxHtmlFilter *filter) -void wxHtmlWindow::OnLinkClicked(wxHtmlLinkInfo *link) +void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { - LoadPage(link -> GetHref()); + LoadPage(link.GetHref()); } @@ -506,7 +506,7 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event) pos = event.GetPosition(); if (m_Cell) - m_Cell -> OnMouseClick(this, sx + pos.x, sy + pos.y, event.ButtonDown(1), event.ButtonDown(2), event.ButtonDown(3)); + m_Cell -> OnMouseClick(this, sx + pos.x, sy + pos.y, event); } } -- 2.45.2