count the root item in wxTreeCtrl::GetCount()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27726 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -825,7 +825,20 @@ wxGenericTreeCtrl::~wxGenericTreeCtrl()
|
|||||||
|
|
||||||
size_t wxGenericTreeCtrl::GetCount() const
|
size_t wxGenericTreeCtrl::GetCount() const
|
||||||
{
|
{
|
||||||
return m_anchor == NULL ? 0u : m_anchor->GetChildrenCount();
|
if ( !m_anchor )
|
||||||
|
{
|
||||||
|
// the tree is empty
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t count = m_anchor->GetChildrenCount();
|
||||||
|
if ( !HasFlag(wxTR_HIDE_ROOT) )
|
||||||
|
{
|
||||||
|
// take the root itself into account
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericTreeCtrl::SetIndent(unsigned int indent)
|
void wxGenericTreeCtrl::SetIndent(unsigned int indent)
|
||||||
|
Reference in New Issue
Block a user