diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index aa78abee..5888ef81 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -19,6 +19,7 @@ #include #include #include +#include namespace nana { @@ -344,20 +345,21 @@ namespace nana return idx; } - nana::string to_string() const + nana::string to_string(const export_options& exp_opt) const { - nana::string sep{STR(";")}, endl{STR("\n")}, head_str; + nana::string head_str; bool first{true}; - for(auto & i: cont()) - { - if(i.visible) + for( size_type idx{}; idxhandle()); } -#if ( 0 ) - void update_selection_range(index_pair to, const arg_mouse& arg) - { - using item_state = essence_t::item_state; - using parts = essence_t::parts; - bool update = false; - index_pair item_pos; - bool sel = true; - if (!lister.single_selection()) - { - if (arg.shift) - lister.select_display_range(lister.last_selected, item_pos, sel); - else if (arg.ctrl) - sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected(); - else - lister.select_for_all(false); - } - else - sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected(); - - item_ptr->flags.selected = sel; - index_pair last_selected(item_pos.cat, lister.absolute(item_pos)); - - arg_listbox arg{item_proxy{essence_, last_selected}, sel}; - lister.wd_ptr()->events().selected.emit(arg); - - if (item_ptr->flags.selected) - { - lister.cancel_others_if_single_enabled(true, last_selected); - essence_->lister.last_selected = last_selected; - - } - else if (essence_->lister.last_selected == last_selected) - essence_->lister.last_selected.set_both(npos); - } - else if(!lister.single_selection()) - lister.categ_selected(item_pos.cat, true); - update = true; - - } -#endif - }; void es_lister::scroll_refresh() @@ -2450,24 +2408,23 @@ namespace nana else break; } } - nana::string es_lister::to_string() const + nana::string es_lister::to_string(const export_options& exp_opt) const { - nana::string sep{STR(";")}, endl{STR("\n")}, list_str; - auto col_order = ess_->header.all_headers(true); + nana::string list_str; bool first{true}; for(auto & cat: cat_container()) { if(first) first=false; else - list_str += (cat.text + endl); + list_str += (cat.text + exp_opt.endl); bool first_item{true}; for (auto i : cat.sorted) { auto& it= cat.items[i] ; - if(it.flags.selected) - list_str += (it.to_string(col_order) + endl); + if(it.flags.selected || !exp_opt.only_selected_items) + list_str += (it.to_string(exp_opt) + exp_opt.endl); } } return list_str ;