From: Julian Smart Date: Sat, 13 Dec 2003 10:20:48 +0000 (+0000) Subject: Applied [ 858342 ] Event-based processing of item tooltips in generic TreeCtrl X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4a5d781ca6ba313fd3f9d7e822487bfd06faf982 Applied [ 858342 ] Event-based processing of item tooltips in generic TreeCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 3e40803ef1..e6b2bfd19e 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2857,6 +2857,23 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) { if ( !m_anchor ) return; + // 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 = (long) HoverItem; + hevent.SetEventObject(this); + + if ( GetEventHandler()->ProcessEvent(hevent) && hevent.IsAllowed() ) + { + SetToolTip(hevent.m_label); + } + } + // 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