set_row_visible() can now properly handle sizing.

Before it always "worked" since set_visible in twidget calls
invalidate_layout(). Now only call invalidate_layout() if we failed to
handle the resize ourselves.
This commit is contained in:
Mark de Wever 2009-12-20 19:35:09 +00:00
parent c0d4476ef1
commit 1200875a6e

View file

@ -94,9 +94,23 @@ void tlistbox::set_row_active(const unsigned row, const bool active)
void tlistbox::set_row_visible(const unsigned row, const bool visible)
{
assert(generator_);
generator_->set_item_shown(row, visible);
content_resize_request();
set_dirty();
twindow *window = get_window();
assert(window);
bool resize_needed;
{
twindow::tinvalidate_layout_blocker invalidate_layout_blocker(*window);
generator_->set_item_shown(row, visible);
resize_needed = !content_resize_request();
}
if(resize_needed) {
window->invalidate_layout();
} else {
set_dirty();
}
}
const tgrid* tlistbox::get_row_grid(const unsigned row) const