fix for GetParent() in wxTR_HIDE_ROOT case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1298,11 +1298,21 @@ wxTreeItemId wxTreeCtrl::GetSelection() const
|
|||||||
|
|
||||||
wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const
|
wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const
|
||||||
{
|
{
|
||||||
HTREEITEM hItem = TreeView_GetParent(GetHwnd(), HITEM(item));
|
HTREEITEM hItem;
|
||||||
if ( !hItem && HasFlag(wxTR_HIDE_ROOT) )
|
|
||||||
|
if ( IS_VIRTUAL_ROOT(item) )
|
||||||
{
|
{
|
||||||
// the top level items should have the virtual root as their parent
|
// no parent for the virtual root
|
||||||
hItem = TVI_ROOT;
|
hItem = 0;
|
||||||
|
}
|
||||||
|
else // normal item
|
||||||
|
{
|
||||||
|
hItem = TreeView_GetParent(GetHwnd(), HITEM(item));
|
||||||
|
if ( !hItem && HasFlag(wxTR_HIDE_ROOT) )
|
||||||
|
{
|
||||||
|
// the top level items should have the virtual root as their parent
|
||||||
|
hItem = TVI_ROOT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxTreeItemId((WXHTREEITEM)hItem);
|
return wxTreeItemId((WXHTREEITEM)hItem);
|
||||||
|
Reference in New Issue
Block a user