Merge branch 'hotfixes-1.0.1' of https://github.com/qPCR4vir/nana into qPCR4vir-hotfixes-1.0.1
This commit is contained in:
commit
a3c69418ea
@ -129,22 +129,26 @@ namespace checkbox
|
||||
checkbox::checkbox(window wd, bool visible)
|
||||
{
|
||||
create(wd, rectangle(), visible);
|
||||
bgcolor(API::bgcolor(wd));
|
||||
}
|
||||
|
||||
checkbox::checkbox(window wd, const nana::string& text, bool visible)
|
||||
{
|
||||
create(wd, rectangle(), visible);
|
||||
bgcolor(API::bgcolor(wd));
|
||||
caption(text);
|
||||
}
|
||||
|
||||
checkbox::checkbox(window wd, const nana::char_t* text, bool visible)
|
||||
{
|
||||
create(wd, rectangle(), visible);
|
||||
bgcolor(API::bgcolor(wd));
|
||||
caption(text);
|
||||
}
|
||||
|
||||
checkbox::checkbox(window wd, const nana::rectangle& r, bool visible)
|
||||
{
|
||||
bgcolor(API::bgcolor(wd));
|
||||
create(wd, r, visible);
|
||||
}
|
||||
|
||||
|
@ -841,8 +841,11 @@ namespace nana
|
||||
if (pos >= catobj.sorted.size())
|
||||
throw std::out_of_range("listbox: Invalid item position.");
|
||||
|
||||
auto i = std::find(catobj.sorted.begin(), catobj.sorted.end(), pos);
|
||||
return (i != catobj.sorted.end() ? *i : npos);
|
||||
for (size_type i=0; i<catobj.sorted.size();++i)
|
||||
if (pos==catobj.sorted[i])
|
||||
return i;
|
||||
|
||||
return npos ;
|
||||
}
|
||||
|
||||
category_t::container::value_type& at(const index_pair& pos)
|
||||
@ -1178,6 +1181,21 @@ namespace nana
|
||||
if (to.is_item())
|
||||
item_proxy(ess_, to).select(sel);
|
||||
}
|
||||
void select_display_range(index_pair fr_abs, index_pair to_dpl, bool sel)
|
||||
{
|
||||
index_pair fr_dpl (fr_abs.cat, this->display_order(fr_abs.cat, fr_abs.item));
|
||||
if (fr_dpl > to_dpl)
|
||||
std::swap(fr_dpl, to_dpl);
|
||||
|
||||
for (; fr_dpl != to_dpl; forward(fr_dpl, 1, fr_dpl))
|
||||
{
|
||||
if (fr_dpl.is_item())
|
||||
item_proxy(ess_, index_pair(fr_dpl.cat, absolute( fr_dpl ) )).select(sel);
|
||||
}
|
||||
|
||||
if (to_dpl.is_item())
|
||||
item_proxy(ess_, index_pair(to_dpl.cat, absolute( to_dpl ) )).select(sel);
|
||||
}
|
||||
|
||||
bool select_for_all(bool sel)
|
||||
{
|
||||
@ -2606,7 +2624,8 @@ namespace nana
|
||||
graph->set_color(bgcolor);
|
||||
graph->rectangle(rectangle{ r.x, y, show_w, essence_->item_size }, true);
|
||||
|
||||
int item_xpos = x;
|
||||
int item_xpos = x;
|
||||
unsigned extreme_text = x;
|
||||
bool first = true;
|
||||
|
||||
for(auto index : seqs)
|
||||
@ -2683,17 +2702,23 @@ namespace nana
|
||||
graph->string(point{ xpos, y + 2 }, STR("..."));
|
||||
|
||||
//Erase the part that over the next subitem.
|
||||
if (index + 1 <= seqs.size())
|
||||
{
|
||||
if (index + 1 < seqs.size())
|
||||
{
|
||||
graph->set_color(bgcolor);
|
||||
graph->rectangle(rectangle{item_xpos + static_cast<int>(header.pixels), y + 2, ts.width + ext_w - header.pixels, essence_->item_size - 4}, true);
|
||||
}
|
||||
extreme_text = std::max (extreme_text, item_xpos + ext_w + ts.width);
|
||||
}
|
||||
}
|
||||
|
||||
graph->line({ item_xpos - 1, y }, { item_xpos - 1, y + static_cast<int>(essence_->item_size) - 1 }, { 0xEB, 0xF4, 0xF9 });
|
||||
|
||||
item_xpos += header.pixels;
|
||||
if (index + 1 >= seqs.size() && extreme_text > item_xpos)
|
||||
{
|
||||
graph->set_color(item.bgcolor);
|
||||
graph->rectangle(rectangle{item_xpos , y + 2, extreme_text - item_xpos, essence_->item_size - 4}, true);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
||||
@ -2916,19 +2941,19 @@ namespace nana
|
||||
if (!lister.single_selection())
|
||||
{
|
||||
if (arg.shift)
|
||||
lister.select_range(lister.last_selected, item_pos, sel);
|
||||
lister.select_display_range(lister.last_selected, item_pos, sel);
|
||||
else if (arg.ctrl)
|
||||
sel = !item_proxy(essence_, item_pos).selected();
|
||||
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_, item_pos).selected();
|
||||
sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected();
|
||||
|
||||
if(item_ptr)
|
||||
{
|
||||
item_ptr->flags.selected = sel;
|
||||
index_pair last_selected(item_pos.cat, lister.absolute(item_pos));
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user