Author: mordante
Date: Sun Jan 17 12:07:55 2010
New Revision: 40720

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40720&view=rev
Log:
Add a force parameter to content_resize_request.

This is needed for sizing in the lobby. Also polished the doxygen
comment.

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

Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=40720&r1=40719&r2=40720&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Sun Jan 17 12:07:55 2010
@@ -447,7 +447,7 @@
                        || content_grid_->disable_click_dismiss();
 }
 
-bool tscrollbar_container::content_resize_request()
+bool tscrollbar_container::content_resize_request(const bool force_sizing)
 {
        /**
         * @todo Try to handle auto_visible_first_run here as well.
@@ -479,6 +479,10 @@
                        DBG_GUI_L << LOG_HEADER << " will fit, only needs a 
resize.\n";
                        goto resize;
                }
+               if(force_sizing) {
+                       DBG_GUI_L << LOG_HEADER << " fits, but resize 
forced.\n";
+                       goto resize;
+               }
                DBG_GUI_L << LOG_HEADER << " fits, nothing to do.\n";
                return true;
        }

Modified: trunk/src/gui/widgets/scrollbar_container.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.hpp?rev=40720&r1=40719&r2=40720&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.hpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.hpp Sun Jan 17 12:07:55 2010
@@ -222,13 +222,22 @@
         * Notification if the content of a child needs a resize.
         *
         * When a resize is required the container first can try to handle it
-        * itself before asking the window to do the resize.
+        * itself. If it can't honour the request the function will call @ref
+        * twindow::invalidate_layout().
+        *
+        * @note Calling this function on a widget with size == (0, 0) results
+        * false but doesn't call invalidate_layout, the engine expects to be in
+        * build up phase with the layout already invalidated.
+        *
+        * @param force_sizing        If the contents fit do we want to force a
+        *                            resize? This is needed in the MP lobby 
since
+        *                            items might not be properly placed yet.
+        *                            (The listboxes with the player info need 
it.)
         *
         * @returns                   True if the resize is handled, false
-        *                            otherwise. If the container has no size 
the
-        *                            result is undefined.
-        */
-       bool content_resize_request();
+        *                            otherwise.
+        */
+       bool content_resize_request(const bool force_sizing = false);
 
        /***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to