From 52d040a95d2a5136f1a79d7aa25f3fc5a2637bda Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 5 May 2015 13:50:30 +0200 Subject: [PATCH] FIX: trace the whole cat when selected, not just the last item --- source/gui/widgets/listbox.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 53ee6eff..a44d7d47 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -1595,26 +1595,21 @@ namespace nana bool categ_selected(size_type cat, bool sel) { bool changed = false; - auto & items = _m_at(cat)->items; - index_pair pos(cat, 0); - for(auto & m : items) + cat_proxy cpx{ess_,cat}; + for (item_proxy &it : cpx ) { - if(m.flags.selected != sel) - { - m.flags.selected = sel; - - arg_listbox arg{ item_proxy(ess_, pos), sel }; - wd_ptr()->events().selected.emit(arg); + if (it.selected() != sel) changed = true; + it.select(sel); if (sel) // not check for single_selection_ - last_selected_abs = pos; - else if (last_selected_abs == pos) + last_selected_abs = it->pos(); + + else if (last_selected_abs == it->pos()) last_selected_abs.set_both(npos); } - ++pos.item; - } + last_selected_abs = index_pair{cat,npos}; return changed; }