introduce cat_proxy::select(bool sel)

This commit is contained in:
qPCR4vir 2015-05-05 14:56:15 +02:00
parent 7863dcdba6
commit 6fd15140a9
2 changed files with 39 additions and 21 deletions

View File

@ -374,6 +374,9 @@ namespace nana
cat_proxy& text(nana::string); cat_proxy& text(nana::string);
nana::string text() const; nana::string text() const;
cat_proxy & select(bool);
bool selected() const;
/// Behavior of a container /// Behavior of a container
void push_back(nana::string); void push_back(nana::string);

View File

@ -1592,26 +1592,7 @@ namespace nana
} }
/// set all items in cat to selection sel, emiting events, actualizing last_selected_abs, but not check for single_selection_ /// set all items in cat to selection sel, emiting events, actualizing last_selected_abs, but not check for single_selection_
bool categ_selected(size_type cat, bool sel) bool categ_selected(size_type cat, bool sel);
{
bool changed = false;
cat_proxy cpx{ess_,cat};
for (item_proxy &it : cpx )
{
if (it.selected() != sel)
changed = true;
it.select(sel);
if (sel) // not check for single_selection_
last_selected_abs = it->pos();
else if (last_selected_abs == it->pos())
last_selected_abs.set_both(npos);
}
last_selected_abs = index_pair{cat,npos};
return changed;
}
void reverse_categ_selected(size_type categ) void reverse_categ_selected(size_type categ)
{ {
@ -2458,7 +2439,7 @@ namespace nana
} }
} }
nana::string es_lister::to_string(const export_options& exp_opt) const nana::string es_lister::to_string(const export_options& exp_opt) const
{ {
nana::string list_str; nana::string list_str;
bool first{true}; bool first{true};
@ -2479,6 +2460,22 @@ namespace nana
return list_str ; return list_str ;
} }
bool es_lister::categ_selected(size_type cat, bool sel)
{
bool changed = false; // we need this??
cat_proxy cpx{ess_,cat};
for (item_proxy &it : cpx )
{
if (it.selected() != sel)
changed = true;
it.select(sel);
}
last_selected_abs = last_selected_dpl = index_pair {cat, npos};
return changed; // we need this??
}
class drawer_header_impl class drawer_header_impl
{ {
@ -3737,6 +3734,24 @@ namespace nana
} }
} }
cat_proxy & cat_proxy::select(bool sel)
{
for (item_proxy &it : *this )
it.select(sel);
ess_->lister.last_selected_abs =
ess_->lister.last_selected_dpl = index_pair {this->pos_, npos};
return *this;
}
bool cat_proxy::selected() const
{
for (item_proxy &it : *this )
if (!it.selected())
return false;
return true;
}
auto cat_proxy::columns() const -> size_type auto cat_proxy::columns() const -> size_type
{ {
return ess_->header.cont().size(); return ess_->header.cont().size();