From 794367f8f6d2626a7b174f838aacf2e9b32fb7eb Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 12 Apr 2018 10:47:06 +0800 Subject: [PATCH] small improvements --- source/gui/widgets/listbox.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 9d57de66..3253a882 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -2048,7 +2048,6 @@ namespace nana index_pair first_display() const noexcept { - auto offset_display = content_view->origin().y / item_height(); return lister.advance(lister.first(), static_cast(content_view->origin().y / item_height())); } @@ -2073,19 +2072,6 @@ namespace nana return from + orignal.position() - origin; } - struct pred_mouse_selection - { - index_pair pos_; - pred_mouse_selection(index_pair pos) noexcept - : pos_(pos) - {} - - bool operator()(const std::pair& m) const noexcept - { - return (pos_ == m.first); - } - }; - std::pair columns_range() const { rectangle r; @@ -2179,9 +2165,12 @@ namespace nana #endif { - if (selections.cend() == std::find_if(selections.cbegin(), selections.cend(), pred_mouse_selection{ *i })) + auto & selpos = *i; + if (selections.cend() == std::find_if(selections.cbegin(), selections.cend(), /*pred_mouse_selection{ *i }*/[&selpos](const std::pair& m){ + return (selpos == m.first); + })) { - item_proxy{ this, *i }.select(false); + item_proxy{ this, selpos }.select(false); i = mouse_selection.selections.erase(i); } else