X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68eb5f6337742191bb90a12203af7f98c6bc6e97..b838cfc9151aea38402ad2b1ba5d2f97cf94e973:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 4c72c6ac75..cb51d15b54 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2731,23 +2731,23 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_renameTimer->Stop(); m_lastOnSame = FALSE; - if (item->HasPlus()) + // send activate event first + wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); + nevent.m_item = (long) item; + nevent.m_code = 0; + CalcScrolledPosition(x, y, + &nevent.m_pointDrag.x, + &nevent.m_pointDrag.y); + nevent.SetEventObject( this ); + if ( !GetEventHandler()->ProcessEvent( nevent ) ) { - // for a "directory" node, toggle expansion - Toggle(item); - } - else - { - // for a "file" node, activate it - wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, - GetId() ); - nevent.m_item = (long) item; - nevent.m_code = 0; - CalcScrolledPosition(x, y, - &nevent.m_pointDrag.x, - &nevent.m_pointDrag.y); - nevent.SetEventObject( this ); - GetEventHandler()->ProcessEvent( nevent ); + // if the user code didn't process the activate event, + // handle it ourselves by toggling the item when it is + // double clicked + if ( item->HasPlus() ) + { + Toggle(item); + } } } }