mail[Wesnoth-commits] r40291 - in /trunk/src/gui/widgets: scrollbar.hpp scrollbar_container.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 - 16:55:
Author: mordante
Date: Sun Dec 20 16:55:10 2009
New Revision: 40291

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40291&view=rev
Log:
Add tscrollbar_::all_items_visible().

This makes it easier to test whether the scrollbar is needed or not,
used it in the scrollbar container.

Modified:
    trunk/src/gui/widgets/scrollbar.hpp
    trunk/src/gui/widgets/scrollbar_container.cpp

Modified: trunk/src/gui/widgets/scrollbar.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar.hpp?rev=40291&r1=40290&r2=40291&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar.hpp (original)
+++ trunk/src/gui/widgets/scrollbar.hpp Sun Dec 20 16:55:10 2009
@@ -73,6 +73,9 @@
        bool at_end() const
                { return item_position_ + visible_items_ >= item_count_; }
 
+       /** Are all items visible? */
+       bool all_items_visible() const { return visible_items_ >= 
item_count_; }
+
        /***** ***** ***** ***** layout functions ***** ***** ***** *****/
 
        /** Inherited from tcontrol. */

Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=40291&r1=40290&r2=40291&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Sun Dec 20 16:55:10 2009
@@ -714,8 +714,8 @@
                }
 
                /***** Set the status if the scrollbars *****/
-               vertical_scrollbar_->set_active( 
!(vertical_scrollbar_->at_begin()
-                               && vertical_scrollbar_->at_end()));
+               vertical_scrollbar_->set_active(
+                               !vertical_scrollbar_->all_items_visible());
        }
 
        if(true) { /** @todo scrollbar visibility. */
@@ -740,8 +740,8 @@
                }
 
                /***** Set the status if the scrollbars *****/
-               horizontal_scrollbar_->set_active( 
!(horizontal_scrollbar_->at_begin()
-                               && horizontal_scrollbar_->at_end()));
+               horizontal_scrollbar_->set_active(
+                               !horizontal_scrollbar_->all_items_visible());
        }
 }
 




Related Messages


Powered by MHonArc, Updated Sun Dec 20 17:00:18 2009