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
This commit is contained in:
Václav Slavík
2000-01-11 23:30:43 +00:00
parent 1be096c9f9
commit 0b2dadd342
4 changed files with 16 additions and 14 deletions

View File

@@ -197,7 +197,7 @@ before calling Layout.
\membersection{wxHtmlCell::OnMouseClick}\label{wxhtmlcellonmouseclick} \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 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 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} \wxheading{Note}
If you need more "advanced" behaviour (for example you'd like to catch mouse movement events or If you need more "advanced" event handling
key events or whatsoever) you should use wxHtmlBinderCell instead. you should use wxHtmlBinderCell instead.
\wxheading{Parameters} \wxheading{Parameters}

View File

@@ -121,7 +121,7 @@ FALSE if an error occured, TRUE otherwise
\membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked} \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 Called when user clicks on hypertext link. Default behaviour is to call
\helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else. \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.

View File

@@ -50,14 +50,16 @@ wxHtmlCell::~wxHtmlCell()
void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
bool WXUNUSED(left), const wxMouseEvent& event)
bool WXUNUSED(middle),
bool WXUNUSED(right))
{ {
wxHtmlLinkInfo *lnk = GetLink(x, y); wxHtmlLinkInfo *lnk = GetLink(x, y);
if (lnk != NULL) 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 // 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) { if (m_Cells) {
wxHtmlCell *c = 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 -> GetPosY() <= y) &&
(c -> GetPosX() + c -> GetWidth() > x) && (c -> GetPosX() + c -> GetWidth() > x) &&
(c -> GetPosY() + c -> GetHeight() > y)) { (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; break;
} }
c = c -> GetNext(); c = c -> GetNext();

View File

@@ -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(); pos = event.GetPosition();
if (m_Cell) 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);
} }
} }