diff --git a/include/nana/gui/widgets/treebox.hpp b/include/nana/gui/widgets/treebox.hpp index a6342404..22dc4029 100644 --- a/include/nana/gui/widgets/treebox.hpp +++ b/include/nana/gui/widgets/treebox.hpp @@ -515,6 +515,8 @@ namespace nana */ void use_entire_line(bool enable); + /// Return the first node of treebox + item_proxy first() const; private: std::shared_ptr _m_scroll_operation() override; diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index 318d54dc..6bb7bed8 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -2465,6 +2465,12 @@ namespace nana dw->impl()->use_entire_line = enable; } + auto treebox::first() const -> item_proxy + { + auto impl = get_drawer_trigger().impl(); + return item_proxy{ const_cast(&get_drawer_trigger()), impl->attr.tree_cont.get_root()->child }; + } + std::shared_ptr treebox::_m_scroll_operation() { internal_scope_guard lock;