send right click events for the URLs too

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-08-27 13:51:20 +00:00
parent b3dc8a3e61
commit 0cb9cfb22f
2 changed files with 37 additions and 33 deletions

View File

@@ -47,7 +47,7 @@ wxHtmlCell::wxHtmlCell() : wxObject()
wxHtmlCell::~wxHtmlCell() wxHtmlCell::~wxHtmlCell()
{ {
if (m_Link) delete m_Link; delete m_Link;
} }
@@ -60,8 +60,9 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
wxHtmlLinkInfo lnk2(*lnk); wxHtmlLinkInfo lnk2(*lnk);
lnk2.SetEvent(&event); lnk2.SetEvent(&event);
lnk2.SetHtmlCell(this); lnk2.SetHtmlCell(this);
((wxHtmlWindow*)parent)->OnLinkClicked(lnk2);
// note : this overcasting is legal because parent is *always* wxHtmlWindow // note : this cast is legal because parent is *always* wxHtmlWindow
wxStaticCast(parent, wxHtmlWindow)->OnLinkClicked(lnk2);
} }
} }
@@ -75,7 +76,7 @@ bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
*pagebreak = m_PosY; *pagebreak = m_PosY;
return TRUE; return TRUE;
} }
else
return FALSE; return FALSE;
} }

View File

@@ -659,11 +659,11 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
if (event.ButtonDown()) if (event.ButtonDown())
{ {
int sx, sy; int sx, sy;
wxPoint pos; GetViewStart(&sx, &sy);
wxString lnk; sx *= wxHTML_SCROLL_STEP;
sy *= wxHTML_SCROLL_STEP;
GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP; wxPoint pos = event.GetPosition();
pos = event.GetPosition();
if (m_Cell) if (m_Cell)
m_Cell->OnMouseClick(this, sx + pos.x, sy + pos.y, event); m_Cell->OnMouseClick(this, sx + pos.x, sy + pos.y, event);
@@ -683,13 +683,15 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
if (m_tmpMouseMoved && (m_Cell != NULL)) if (m_tmpMouseMoved && (m_Cell != NULL))
{ {
int sx, sy; int sx, sy;
int x, y; GetViewStart(&sx, &sy);
wxHtmlLinkInfo *lnk; sx *= wxHTML_SCROLL_STEP;
sy *= wxHTML_SCROLL_STEP;
GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP; int x, y;
wxGetMousePosition(&x, &y); wxGetMousePosition(&x, &y);
ScreenToClient(&x, &y); ScreenToClient(&x, &y);
lnk = m_Cell->GetLink(sx + x, sy + y);
wxHtmlLinkInfo *lnk = m_Cell->GetLink(sx + x, sy + y);
if (lnk != m_tmpLastLink) if (lnk != m_tmpLastLink)
{ {
@@ -718,6 +720,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow) BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
EVT_SIZE(wxHtmlWindow::OnSize) EVT_SIZE(wxHtmlWindow::OnSize)
EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent) EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent)
EVT_RIGHT_DOWN(wxHtmlWindow::OnMouseEvent)
EVT_MOTION(wxHtmlWindow::OnMouseEvent) EVT_MOTION(wxHtmlWindow::OnMouseEvent)
EVT_IDLE(wxHtmlWindow::OnIdle) EVT_IDLE(wxHtmlWindow::OnIdle)
END_EVENT_TABLE() END_EVENT_TABLE()