Author: mordante
Date: Fri May 22 15:36:33 2009
New Revision: 35816
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35816&view=rev
Log:
Don't show scrollbars if they don't help.
In certain cases the reduce_height showed the scrollbars, which
increased the height of the widget instead of reducing it. This happened
with a scrollbar_label with one line, where the scrollbar was higher as
one line. This has been fixed.
Modified:
trunk/src/gui/widgets/scrollbar_container.cpp
Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=35816&r1=35815&r2=35816&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Fri May 22 15:36:33 2009
@@ -158,6 +158,13 @@
vertical_scrollbar_grid_->set_visible(twidget::VISIBLE);
const tpoint scrollbar_size = vertical_scrollbar_grid_->get_best_size();
+
+ // If showing the scrollbar increased the height, hide and abort.
+ if(resized && scrollbar_size.y > size.y) {
+ vertical_scrollbar_grid_->set_visible(twidget::INVISIBLE);
+ return;
+ }
+
if(maximum_height > static_cast<unsigned>(scrollbar_size.y)) {
size.y = maximum_height;
} else {
@@ -202,6 +209,15 @@
size = get_best_size();
const tpoint scrollbar_size =
horizontal_scrollbar_grid_->get_best_size();
+
+ // If showing the scrollbar increased the width, hide and abort.
+ if(horizontal_scrollbar_mode_ == auto_visible_first_run
+ && scrollbar_size.x > size.x) {
+
+ horizontal_scrollbar_grid_->set_visible(twidget::INVISIBLE);
+ return;
+ }
+
if(maximum_width > static_cast<unsigned>(scrollbar_size.x)) {
size.x = maximum_width;
} else {
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits