mail[Wesnoth-commits] r36828 - /trunk/src/gui/widgets/widget.hpp


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

Header


Content

Posted by koraq on July 12, 2009 - 07:55:
Author: mordante
Date: Sun Jul 12 07:55:02 2009
New Revision: 36828

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36828&view=rev
Log:
Added NEW_find_widget() which returns a reference.

Modified:
    trunk/src/gui/widgets/widget.hpp

Modified: trunk/src/gui/widgets/widget.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/widget.hpp?rev=36828&r1=36827&r2=36828&view=diff
==============================================================================
--- trunk/src/gui/widgets/widget.hpp (original)
+++ trunk/src/gui/widgets/widget.hpp Sun Jul 12 07:55:02 2009
@@ -671,6 +671,30 @@
        return result;
 }
 
+/**
+ * Gets a widget with the wanted id.
+ *
+ * This template function doesn't return a reference to a generic widget but
+ * returns a reference to the wanted type
+ *
+ * @param widget              The widget test or find a child with the wanted
+ *                            id.
+ * @param id                  The id of the widget to find.
+ * @param must_be_active      The widget should be active, not all widgets
+ *                            have an active flag, those who don't ignore
+ *                            flag.
+ *
+ * @returns                   The widget with the id.
+ */
+template<class T>
+T& NEW_find_widget(typename tconst_duplicator<T, twidget>::type* widget
+               , const std::string& id
+               , const bool must_be_active)
+{
+       return *NEW_find_widget<T>(widget, id, must_be_active, true);
+}
+
 } // namespace gui2
 
 #endif
+




Related Messages


Powered by MHonArc, Updated Sun Jul 12 08:00:54 2009