fix a listbox issue occurs when resizing without adjusting item offset
This commit is contained in:
parent
9ca02afe61
commit
2ac3b8128d
@ -2006,23 +2006,50 @@ namespace nana
|
|||||||
|
|
||||||
void adjust_scroll_value()
|
void adjust_scroll_value()
|
||||||
{
|
{
|
||||||
|
const auto graph_size = graph->size();
|
||||||
if(scroll.h.empty() == false)
|
if(scroll.h.empty() == false)
|
||||||
{
|
{
|
||||||
unsigned width = 4 + (scroll.v.empty() ? 0 : scroll.scale - 1);
|
const auto ext_px = (4 + (scroll.v.empty() ? 0 : scroll.scale - 1));
|
||||||
if(width >= graph->width()) return;
|
if (ext_px > graph_size.width)
|
||||||
scroll.h.amount(header.pixels());
|
return;
|
||||||
scroll.h.range(graph->width() - width);
|
|
||||||
|
const auto header_px = header.pixels();
|
||||||
|
const unsigned window_px = graph_size.width - (4 + (scroll.v.empty() ? 0 : scroll.scale - 1));
|
||||||
|
|
||||||
|
if (header_px < window_px + scroll.offset_x)
|
||||||
|
{
|
||||||
|
scroll.offset_x = header_px - window_px;
|
||||||
|
}
|
||||||
|
|
||||||
|
scroll.h.amount(header_px);
|
||||||
|
scroll.h.range(window_px);
|
||||||
scroll.h.value(scroll.offset_x);
|
scroll.h.value(scroll.offset_x);
|
||||||
scroll.h.step(graph->text_extent_size(L"W").width);
|
scroll.h.step(graph->text_extent_size(L"W").width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scroll.v.empty() == false)
|
if(scroll.v.empty() == false)
|
||||||
{
|
{
|
||||||
unsigned height = 2 + (scroll.h.empty() ? 0 : scroll.scale);
|
const auto ext_px = 2 + (scroll.h.empty() ? 0 : scroll.scale);
|
||||||
if(height >= graph->height()) return;
|
if (ext_px >= graph_size.height)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto items = lister.the_number_of_expanded();
|
||||||
|
const auto disp_items = number_of_lister_items(false);
|
||||||
|
|
||||||
|
size_type off = lister.distance({ 0, 0 }, scroll.offset_y_dpl);
|
||||||
|
|
||||||
|
if (items < disp_items + off)
|
||||||
|
{
|
||||||
|
index_pair pos;
|
||||||
|
if (lister.forward({ 0, 0 }, items - disp_items, pos))
|
||||||
|
{
|
||||||
|
off = items - disp_items;
|
||||||
|
set_scroll_y_dpl(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scroll.v.amount(lister.the_number_of_expanded());
|
scroll.v.amount(lister.the_number_of_expanded());
|
||||||
scroll.v.range(number_of_lister_items(false));
|
scroll.v.range(number_of_lister_items(false));
|
||||||
size_type off = lister.distance({0,0}, scroll.offset_y_dpl );
|
|
||||||
scroll.v.value(off);
|
scroll.v.value(off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user