Author: mordante
Date: Sun Mar 13 08:49:32 2011
New Revision: 48876
URL: http://svn.gna.org/viewcvs/wesnoth?rev=48876&view=rev
Log:
Add a register_bool2 function.
The original version has an optional flag the new version a mandatory
flag. The latter feels better. At some point all register functions need
to be changed.
Modified:
trunk/src/gui/dialogs/dialog.cpp
trunk/src/gui/dialogs/dialog.hpp
Modified: trunk/src/gui/dialogs/dialog.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/dialog.cpp?rev=48876&r1=48875&r2=48876&view=diff
==============================================================================
--- trunk/src/gui/dialogs/dialog.cpp (original)
+++ trunk/src/gui/dialogs/dialog.cpp Sun Mar 13 08:49:32 2011
@@ -105,6 +105,14 @@
return field;
}
+tfield_bool* tdialog::register_bool2(const std::string& id
+ , const bool mandatory
+ , bool& linked_variable
+ , void (*callback_change) (twidget* widget))
+{
+ return register_bool(id, !mandatory, linked_variable, callback_change);
+}
+
tfield_integer* tdialog::register_integer(
const std::string& id
, const bool optional
Modified: trunk/src/gui/dialogs/dialog.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/dialog.hpp?rev=48876&r1=48875&r2=48876&view=diff
==============================================================================
--- trunk/src/gui/dialogs/dialog.hpp (original)
+++ trunk/src/gui/dialogs/dialog.hpp Sun Mar 13 08:49:32 2011
@@ -195,6 +195,8 @@
* The field created is owned by tdialog, the returned pointer can be
used
* in the child classes as access to a field.
*
+ * @deprecated use @ref register_bool2 instead.
+ *
* @param id Id of the widget, same value as in WML.
* @param optional Is the widget mandatory or optional.
* @param linked_variable The variable the widget is linked to. See
@@ -206,6 +208,26 @@
*/
tfield_bool* register_bool(const std::string& id
, const bool optional
+ , bool& linked_variable
+ , void (*callback_change) (twidget* widget) = NULL);
+
+ /**
+ * Creates a new boolean field.
+ *
+ * The field created is owned by tdialog, the returned pointer can be
used
+ * in the child classes as access to a field.
+ *
+ * @param id Id of the widget, same value as in WML.
+ * @param mandatory Is the widget mandatory or optional.
+ * @param linked_variable The variable the widget is linked to. See
+ * @ref tfield::tfield for more information.
+ * @param callback_change When the value of the widget changes this
+ * callback is called.
+ *
+ * @returns Pointer to the created widget.
+ */
+ tfield_bool* register_bool2(const std::string& id
+ , const bool mandatory
, bool& linked_variable
, void (*callback_change) (twidget* widget) = NULL);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits