]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlwin.cpp
Applied patch [ 710608 ] wxImage::GetImageExtWildcard for image load/save dialogs.
[wxWidgets.git] / src / html / htmlwin.cpp
index 43da986f296449e7d2c43dbf2f9799b66ddd5f90..08e39660447d00a43b86e5c7fe90ce1776965857 100644 (file)
@@ -634,7 +634,9 @@ bool wxHtmlWindow::IsSelectionEnabled() const
 
 void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
 {
-    LoadPage(link.GetHref());
+    const wxMouseEvent *e = link.GetEvent();
+    if (e == NULL || e->LeftUp())
+        LoadPage(link.GetHref());
 }
 
 void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell,
@@ -663,12 +665,7 @@ void wxHtmlWindow::OnDraw(wxDC& dc)
     dc.SetBackgroundMode(wxTRANSPARENT);
     GetViewStart(&x, &y);
 
-    wxHtmlSelection sel;
-    sel.Set(wxPoint(20,80),
-            m_Cell->FindCellByPos(20,80,wxHTML_FIND_TERMINAL|wxHTML_FIND_NONTERMINAL),
-            wxPoint(200,300),
-            m_Cell->FindCellByPos(200,300,wxHTML_FIND_TERMINAL|wxHTML_FIND_NONTERMINAL));
-    wxHtmlRenderingState rstate(IsSelectionEnabled() ? &sel : NULL);
+    wxHtmlRenderingState rstate(NULL);
     m_Cell->Draw(dc, 0, 0,
                  y * wxHTML_SCROLL_STEP + rect.GetTop(),
                  y * wxHTML_SCROLL_STEP + rect.GetBottom(),
@@ -686,32 +683,32 @@ void wxHtmlWindow::OnSize(wxSizeEvent& event)
 }
 
 
-void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
+void wxHtmlWindow::OnMouseMove(wxMouseEvent& event)
 {
-    m_tmpMouseMoved = TRUE;
+    m_tmpMouseMoved = true;
+}
 
-    if (event.ButtonDown())
+void wxHtmlWindow::OnMouseButton(wxMouseEvent& event)
+{
+    SetFocus();
+    if ( m_Cell )
     {
-        SetFocus();
-        if ( m_Cell )
-        {
-            int sx, sy;
-            GetViewStart(&sx, &sy);
-            sx *= wxHTML_SCROLL_STEP;
-            sy *= wxHTML_SCROLL_STEP;
+        int sx, sy;
+        GetViewStart(&sx, &sy);
+        sx *= wxHTML_SCROLL_STEP;
+        sy *= wxHTML_SCROLL_STEP;
 
-            wxPoint pos = event.GetPosition();
-            pos.x += sx;
-            pos.y += sy;
+        wxPoint pos = event.GetPosition();
+        pos.x += sx;
+        pos.y += sy;
 
-            wxHtmlCell *cell = m_Cell->FindCellByPos(pos.x, pos.y);
+        wxHtmlCell *cell = m_Cell->FindCellByPos(pos.x, pos.y);
 
-            // VZ: is it possible that we don't find anything at all?
-            // VS: yes. FindCellByPos returns terminal cell and
-            //     containers may have empty borders
-            if ( cell )
-                OnCellClicked(cell, pos.x, pos.y, event);
-        }
+        // VZ: is it possible that we don't find anything at all?
+        // VS: yes. FindCellByPos returns terminal cell and
+        //     containers may have empty borders
+        if ( cell )
+            OnCellClicked(cell, pos.x, pos.y, event);
     }
 }
 
@@ -779,9 +776,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
 
 BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
     EVT_SIZE(wxHtmlWindow::OnSize)
-    EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent)
-    EVT_RIGHT_DOWN(wxHtmlWindow::OnMouseEvent)
-    EVT_MOTION(wxHtmlWindow::OnMouseEvent)
+    EVT_LEFT_UP(wxHtmlWindow::OnMouseButton)
+    EVT_RIGHT_UP(wxHtmlWindow::OnMouseButton)
+    EVT_MOTION(wxHtmlWindow::OnMouseMove)
     EVT_IDLE(wxHtmlWindow::OnIdle)
 END_EVENT_TABLE()