X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4754ab1630290c29b97c37835d5e26155998e038..aea5b1c1bda2cee29d8428028d81272ae9fa048d:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 46a215d3ba..9cf8532ae6 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -797,6 +797,11 @@ bool wxTreeCtrl::DoGetItem(wxTreeViewItem *tvItem) const wxCHECK_MSG( tvItem->hItem != TVI_ROOT, false, _T("can't retrieve virtual root item") ); + return DoGetPossiblyRootItem(tvItem); +} + +bool wxTreeCtrl::DoGetPossiblyRootItem(wxTreeViewItem *tvItem) const +{ if ( !TreeView_GetItem(GetHwnd(), tvItem) ) { wxLogLastError(wxT("TreeView_GetItem")); @@ -992,14 +997,7 @@ wxTreeItemParam *wxTreeCtrl::GetItemParam(const wxTreeItemId& item) const wxTreeViewItem tvItem(item, TVIF_PARAM); - // hidden root may still have data. - if ( IS_VIRTUAL_ROOT(item) ) - { - return GET_VIRTUAL_ROOT()->GetParam(); - } - - // visible node. - if ( !DoGetItem(&tvItem) ) + if ( !DoGetPossiblyRootItem(&tvItem) ) { return NULL; } @@ -1214,7 +1212,7 @@ bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); wxTreeViewItem tvItem(item, TVIF_CHILDREN); - DoGetItem(&tvItem); + DoGetPossiblyRootItem(&tvItem); return tvItem.cChildren != 0; } @@ -2858,11 +2856,12 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) switch ( hdr->code ) { case NM_DBLCLK: - // we translate NM_DBLCLK into ACTIVATED event, so don't interpret - // the return code of this event handler as the return value for - // NM_DBLCLK - otherwise, double clicking the item to toggle its - // expanded status would never work - *result = false; + // we translate NM_DBLCLK into ACTIVATED event and if the user + // handled the activation of the item we shouldn't proceed with + // also using the same double click for toggling the item expanded + // state -- but OTOH do let the user to expand/collapse the item by + // double clicking on it if the activation is not handled specially + *result = processed; break; case NM_RCLICK: