diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index d4775fc3..eacc6857 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -514,8 +514,11 @@ By \a clicking on a header the list get \a reordered, first up, and then down al void append(std::initializer_list); /// cat_proxy operator[](const Key & ck) { diff --git a/include/nana/key_type.hpp b/include/nana/key_type.hpp index 9550f8df..dcfa4f79 100644 --- a/include/nana/key_type.hpp +++ b/include/nana/key_type.hpp @@ -22,10 +22,10 @@ namespace nana virtual ~key_interface(){} virtual bool same_type(const key_interface*) const = 0; - virtual bool compare(const key_interface*) const = 0; + virtual bool compare(const key_interface*) const = 0; ///< is this key less than right key? [call it less(rk), less_than(rk) or compare_less(rk)?: if (lk.less_than(rk )) ] }; //end class key_interface - //Use less compare for equal compare + //Use less compare for equal compare [call it equal_by_less()?] inline bool pred_equal_by_less(const key_interface * left, const key_interface* right) { return (left->compare(right) == false) && (right->compare(left) == false); diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 9cc63577..95c216a9 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -834,20 +834,21 @@ namespace nana return sorted_reverse_; } - ///Append a new category with a specified name. + ///Append a new category with a specified name and return a pointer to it. category_t* create_cat(nana::string&& text) { list_.emplace_back(std::move(text)); return &list_.back(); } - + /// just append a list of new cat. void create_cat(const std::initializer_list& args) { for (auto & arg : args) list_.emplace_back(arg); } - category_t* create_cat(std::shared_ptr ptr) + /// will use the key to insert new cat before the first cat with compare less than the key, or at the end of the list of cat and return a ref to that new cat. ? + category_t* create_cat(std::shared_ptr ptr) { for (auto i = list_.begin(); i != list_.end(); ++i) { @@ -863,7 +864,7 @@ namespace nana list_.back().key_ptr = ptr; return &list_.back(); } - + /// add a new cat created at "pos" and return a ref to it category_t* create_cat(std::size_t pos, nana::string&& text) { #if defined(NANA_LINUX) || defined(NANA_MINGW)