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"));
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;
}
wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
wxTreeViewItem tvItem(item, TVIF_CHILDREN);
- DoGetItem(&tvItem);
+ DoGetPossiblyRootItem(&tvItem);
return tvItem.cChildren != 0;
}
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: