mail[Wesnoth-commits] r40307 - /trunk/src/gui/widgets/listbox.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on December 20, 2009 - 20:35:
Author: mordante
Date: Sun Dec 20 20:35:09 2009
New Revision: 40307

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40307&view=rev
Log:
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.

Modified:
    trunk/src/gui/widgets/listbox.cpp

Modified: trunk/src/gui/widgets/listbox.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/listbox.cpp?rev=40307&r1=40306&r2=40307&view=diff
==============================================================================
--- trunk/src/gui/widgets/listbox.cpp (original)
+++ trunk/src/gui/widgets/listbox.cpp Sun Dec 20 20:35:09 2009
@@ -94,9 +94,23 @@
 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




Related Messages


Powered by MHonArc, Updated Sun Dec 20 20:40:21 2009