Since the changes of r72325, the root item could be collapsed and marked as
not having any children but this was wrong because no items could be added to
it after this.
Just ignore any attempts to collapse it.
Closes #14801.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72905
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
static wxDataViewTreeNode* CreateRootNode()
{
wxDataViewTreeNode *n = new wxDataViewTreeNode(NULL, wxDataViewItem());
- n->SetHasChildren(true);
+ n->m_branchData = new BranchNodeData;
n->m_branchData->open = true;
return n;
}
void ToggleOpen()
{
+ // We do not allow the (invisible) root node to be collapsed because
+ // there is no way to expand it again.
+ if ( !m_parent )
+ return;
+
wxCHECK_RET( m_branchData != NULL, "can't open leaf node" );
int sum = 0;
void SetHasChildren(bool has)
{
+ // The invisible root item always has children, so ignore any attempts
+ // to change this.
+ if ( !m_parent )
+ return;
+
if ( !has )
{
wxDELETE(m_branchData);