Author: mordante
Date: Fri Oct 31 19:45:25 2008
New Revision: 30472

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30472&view=rev
Log:
Make sure all widgets have a parent.

Modified:
    trunk/src/gui/widgets/grid.cpp
    trunk/src/gui/widgets/grid.hpp
    trunk/src/gui/widgets/vertical_scrollbar_container.cpp
    trunk/src/gui/widgets/window.cpp

Modified: trunk/src/gui/widgets/grid.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=30472&r1=30471&r2=30472&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Fri Oct 31 19:45:25 2008
@@ -99,7 +99,8 @@
 }
 
 twidget* tgrid::swap_child(
-               const std::string& id, twidget* widget, const bool recurse)
+               const std::string& id, twidget* widget, const bool recurse,
+               twidget* new_parent)
 {
        assert(widget);
 
@@ -124,7 +125,7 @@
                // When find the widget there should be a widget.
                twidget* old = child.widget();
                assert(old);
-               old->set_parent(NULL);
+               old->set_parent(new_parent);
 
                widget->set_parent(this);
                child.set_widget(widget);

Modified: trunk/src/gui/widgets/grid.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=30472&r1=30471&r2=30472&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Fri Oct 31 19:45:25 2008
@@ -133,13 +133,15 @@
         * @param id                  The id of the widget to free.
         * @param widget              The widget to put in the grid.
         * @parem recurse             Do we want to decent into the child grids.
+        * @parem new_parent          The new parent for the swapped out widget.
         *
         * returns                    The widget which got removed (the parent 
of
         *                            the widget is cleared). If no widget found
         *                            and thus not replace NULL will returned.
         */
        twidget* swap_child(
-               const std::string& id, twidget* widget, const bool recurse);
+               const std::string& id, twidget* widget, const bool recurse,
+               twidget* new_parent = NULL);
 
        /**
         * Removes and frees a widget in a cell.

Modified: trunk/src/gui/widgets/vertical_scrollbar_container.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/vertical_scrollbar_container.cpp?rev=30472&r1=30471&r2=30472&view=diff
==============================================================================
--- trunk/src/gui/widgets/vertical_scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/vertical_scrollbar_container.cpp Fri Oct 31 19:45:25 
2008
@@ -409,7 +409,7 @@
 
                tgrid* tmp = new tgrid();
         scrollbar_grid_ = dynamic_cast<tgrid*>
-                       (grid().swap_child("_scrollbar_grid", tmp, true));
+                       (grid().swap_child("_scrollbar_grid", tmp, true, this));
        }
 }
 

Modified: trunk/src/gui/widgets/window.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=30472&r1=30471&r2=30472&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Fri Oct 31 19:45:25 2008
@@ -109,9 +109,11 @@
        load_config();
 
        tooltip_.set_definition("default");
+       tooltip_.set_parent(this);
        tooltip_.set_visible(false);
 
        help_popup_.set_definition("default");
+       help_popup_.set_parent(this);
        help_popup_.set_visible(false);
 }
 


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

Reply via email to