Author: mordante
Date: Sun May 18 09:46:57 2008
New Revision: 26684

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26684&view=rev
Log:
Add tgrid::set_active().

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

Modified: trunk/src/gui/widgets/grid.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=26684&r1=26683&r2=26684&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Sun May 18 09:46:57 2008
@@ -170,6 +170,29 @@
                        if(!find_all) {
                                break;
                        }
+               }
+       }
+}
+
+void tgrid::set_active(const bool active)
+{
+       for(std::vector<tchild>::iterator itor = children_.begin();
+                       itor != children_.end(); ++itor) {
+
+               twidget* widget = itor->widget();
+               if(!widget) {
+                       continue;
+               }
+
+               tgrid* grid = dynamic_cast<tgrid*>(widget);
+               if(grid) {
+                       grid->set_active(active);
+                       continue;
+               }
+
+               tcontrol* control =  dynamic_cast<tcontrol*>(widget);
+               if(control) {
+                       control->set_active(active);
                }
        }
 }

Modified: trunk/src/gui/widgets/grid.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=26684&r1=26683&r2=26684&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Sun May 18 09:46:57 2008
@@ -86,6 +86,16 @@
 
        void remove_child(const unsigned row, const unsigned col);
        void remove_child(const std::string& id, const bool find_all = false);
+
+       /**
+        * Activates all children.
+        *
+        * If a child inherits from tcontrol or is a tgrid it will call
+        * set_active() for the child otherwise it ignores the widget.
+        *
+        * @param active              Parameter for set_active.
+        */
+       void set_active(const bool active);
 
        /** Inherited from twidget. */
        bool has_vertical_scrollbar() const;


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

Reply via email to