X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f8b043e78f80200a485f3d5c29f04f42102d268a..aa154cb1578ba9d44c7e24c5e76d8238bf8809d0:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index bf31859dd7..4e79785c02 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -674,6 +674,7 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl,wxScrolledWindow) EVT_CHAR (wxGenericTreeCtrl::OnChar) EVT_SET_FOCUS (wxGenericTreeCtrl::OnSetFocus) EVT_KILL_FOCUS (wxGenericTreeCtrl::OnKillFocus) + EVT_TREE_ITEM_GETTOOLTIP(-1, wxGenericTreeCtrl::OnGetToolTip) END_EVENT_TABLE() #if !defined(__WXMSW__) || defined(__WIN16__) || defined(__WXUNIVERSAL__) @@ -2882,7 +2883,10 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) // Is the mouse over a tree item button? int flags = 0; - wxGenericTreeItem *underMouse = m_anchor->HitTest(pt, this, flags, 0); + wxGenericTreeItem *thisItem = m_anchor->HitTest(pt, this, flags, 0); + wxGenericTreeItem *underMouse = thisItem; + bool underMouseChanged = (underMouse != m_underMouse) ; + if ((underMouse) && (flags & wxTREE_HITTEST_ONITEMBUTTON) && (!event.LeftIsDown()) && @@ -2912,10 +2916,10 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) #if wxUSE_TOOLTIPS // Determines what item we are hovering over and need a tooltip for - wxTreeItemId hoverItem = HitTest(ScreenToClient(wxGetMousePosition())); + wxTreeItemId hoverItem = thisItem; // We do not want a tooltip if we are dragging, or if the rename timer is running - if (hoverItem.IsOk() && !m_isDragging && (!m_renameTimer || !m_renameTimer->IsRunning())) + if (underMouseChanged && hoverItem.IsOk() && !m_isDragging && (!m_renameTimer || !m_renameTimer->IsRunning())) { // Ask the tree control what tooltip (if any) should be shown wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, GetId()); @@ -3365,4 +3369,11 @@ bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour) return TRUE; } +// Process the tooltip event, to speed up event processing. +// Doesn't actually get a tooltip. +void wxGenericTreeCtrl::OnGetToolTip( wxTreeEvent &event ) +{ + event.Veto(); +} + #endif // wxUSE_TREECTRL