X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/999836aacade840a5d9a0cbb5fad7b1d4de62c93..342dc9287c824d32f191f7d0b56f3128fd62e018:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 3e40803ef1..99d64a87f3 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2857,6 +2857,25 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) { if ( !m_anchor ) return; +#if wxUSE_TOOLTIPS + // Determines what item we are hovering over and need a tooltip for + wxTreeItemId hoverItem = HitTest(ScreenToClient(wxGetMousePosition())); + + // 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())) + { + // Ask the tree control what tooltip (if any) should be shown + wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, GetId()); + hevent.m_item = hoverItem; + hevent.SetEventObject(this); + + if ( GetEventHandler()->ProcessEvent(hevent) && hevent.IsAllowed() ) + { + SetToolTip(hevent.m_label); + } + } +#endif + // we process left mouse up event (enables in-place edit), right down // (pass to the user code), left dbl click (activate item) and // dragging/moving events for items drag-and-drop