From c5b38f36434832ca86eb6661d8bb21eadf3420d4 Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Thu, 18 Apr 2019 17:12:31 -0400 Subject: [PATCH 1/3] bug: second parameter of category_icon() is rvalue reference --- source/gui/widgets/listbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 3e127628..eaed5195 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -6042,7 +6042,7 @@ namespace nana return *this; } - listbox& listbox::category_icon(const paint::image& img_expanded, const paint::image&& img_collapsed) + listbox& listbox::category_icon(const paint::image& img_expanded, const paint::image& img_collapsed) { internal_scope_guard lock; _m_ess().ctg_icon_renderer = [img_expanded, img_collapsed](paint::graphics& graph, const rectangle& rt_icon, bool expanded) From e36a3270e91fb03808256cf41ef9bb4abd2fce18 Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Thu, 18 Apr 2019 17:13:19 -0400 Subject: [PATCH 2/3] bug: second parameter of category_icon() is rvalue reference --- include/nana/gui/widgets/listbox.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index b6279630..5adeb748 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -1568,7 +1568,7 @@ the nana::detail::basic_window member pointer scheme * @param img_collapsed An icon displayed in front of category title when the category is collapsed. * @return the reference of *this. */ - listbox& category_icon(const paint::image& img_expanded, const paint::image&& img_collapsed); + listbox& category_icon(const paint::image& img_expanded, const paint::image& img_collapsed); /// Returns first visible element /** From 4e3641ed88eb5dc9de805ece2f0b4033268aa6ca Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Sun, 5 May 2019 11:13:08 -0400 Subject: [PATCH 3/3] fix for issue #428 --- source/gui/widgets/listbox.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index eaed5195..3660dce0 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -1198,23 +1198,15 @@ namespace nana return{}; } - /// return a ref to the real item object at display!!! position pos using current sorting only if it is active, and at absolute position if no sorting is currently active. + /// return a ref to the real item object at display position category_t::container::value_type& at(const index_pair& pos) { - auto acc_pos = pos.item; - if (npos != sort_attrs_.column) - acc_pos = index_cast(pos, true).item; //convert display position to absolute position - - return get(pos.cat)->items.at(acc_pos); + return get(pos.cat)->items.at(index_cast(pos, true).item); } const category_t::container::value_type& at(const index_pair& pos) const { - auto acc_pos = pos.item; - if (npos != sort_attrs_.column) - acc_pos = index_cast(pos, true).item; //convert display position to absolute position - - return get(pos.cat)->items.at(acc_pos); + return get(pos.cat)->items.at(index_cast(pos, true).item); } std::vector at_model(const index_pair& pos) const