Add fallback scrollbars if a window doesn't fit.

This shows the scrollbars when a window doesn't fit, the code is only
lightly tested but initial tests seem to work. More testing is needed
especially on the MP lobby.

It still shows some scrollbars too often, which will be fixed later.

Fixes bug #13180.
This commit is contained in:
Mark de Wever 2009-10-26 21:22:24 +00:00
parent e663226f19
commit 6015818a54
4 changed files with 36 additions and 9 deletions

View file

@ -14,6 +14,7 @@ Version 1.7.7+svn:
* Fix not being able to close corrupted file dialog (bug #13764, #14058)
* Improve display order of unit healing (patch #1343)
* Fix the new-widgets addon list dialog
* Add fallback scrollbars if a window doesn't fit (bug #13180)
Version 1.7.7:
* AI:

View file

@ -103,10 +103,28 @@
[row]
[column]
horizontal_grow = "true"
vertical_grow = "true"
[scrollbar_panel]
vertical_scrollbar_mode = "initial_auto"
horizontal_scrollbar_mode = "initial_auto"
[definition]
[grid]
id = "_content_grid"
[/grid]
[row]
[column]
[grid]
id = "_window_content_grid"
[/grid]
[/column]
[/row]
[/definition]
[/scrollbar_panel]
[/column]

View file

@ -180,9 +180,11 @@ public:
void set_col_grow_factor(const unsigned col, const unsigned factor)
{ grid_.set_col_grow_factor(col, factor); }
protected:
public:
/***** ***** ***** setters / getters for members ***** ****** *****/
// Public due to the fact that window needs to be able to swap the
// children, might be protected again later.
const tgrid& grid() const { return grid_; }
tgrid& grid() { return grid_; }

View file

@ -1085,12 +1085,18 @@ void swap_grid(tgrid* grid,
}
if(!parent_grid) {
parent_grid = find_widget<tgrid>(content_grid, id, true, false);
assert(parent_grid);
}
if(tgrid* g = dynamic_cast<tgrid*>(parent_grid->parent())) {
widget = g->swap_child(id, widget, false);
} else if(tcontainer_* c
= dynamic_cast<tcontainer_*>(parent_grid->parent())) {
widget = c->grid().swap_child(id, widget, true);
} else {
assert(false);
}
parent_grid = dynamic_cast<tgrid*>(parent_grid->parent());
assert(parent_grid);
// Replace the child.
widget = parent_grid->swap_child(id, widget, false);
assert(widget);
delete widget;
@ -1100,7 +1106,7 @@ void swap_grid(tgrid* grid,
void twindow::finalize(const boost::intrusive_ptr<tbuilder_grid>& content_grid)
{
swap_grid(NULL, &grid(), content_grid->build(), "_content_grid");
swap_grid(NULL, &grid(), content_grid->build(), "_window_content_grid");
}
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS