fix bug that treebox.clear only rm the 1st node

This commit is contained in:
Jinhao
2017-02-13 07:18:39 +08:00
parent a22954d8d8
commit eb7ae0d635
5 changed files with 17 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
/**
* A Categorize Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,6 +1,6 @@
/*
* A Tree Container class implementation
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -76,12 +76,17 @@ namespace detail
~tree_cont()
{
clear();
clear(&root_);
}
void clear()
void clear(node_type* node)
{
remove(root_.child);
while (node->child)
{
//If there is a sibling of child, the root_.child
//will be assigned with the sibling.
remove(node->child);
}
}
bool verify(const node_type* node) const

View File

@@ -201,6 +201,9 @@ namespace nana
/// Set the check state, and it returns itself.
item_proxy& check(bool);
/// Clears the child nodes
item_proxy& clear();
/// Return true when the node is expanded \todo change to expanded ??
bool expanded() const;