Author: mordante
Date: Sat Jul 30 14:05:12 2011
New Revision: 50500
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50500&view=rev
Log:
Added lua function set_dialog_active.
Patch #2767.
Modified:
trunk/changelog
trunk/src/scripting/lua.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=50500&r1=50499&r2=50500&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sat Jul 30 14:05:12 2011
@@ -1,6 +1,8 @@
Version 1.9.8+svn:
* Language and i18n:
* Updated translations: Estonian, Galician, Latin, Russian
+ * Lua API:
+ * Added: function wesnoth.set_dialog_active (patch #2767).
* Multiplayer:
* A New Land:
* Fixed 'agriculture' not getting translated sometimes and research
Modified: trunk/src/scripting/lua.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua.cpp?rev=50500&r1=50499&r2=50500&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Sat Jul 30 14:05:12 2011
@@ -2999,6 +2999,22 @@
config cfg = luaW_checkconfig(L, 2);
cv[i - 1].set_cfg(cfg);
+ return 0;
+}
+
+/**
+ * Sets a widget's state to active or inactive
+ * - Arg 1: boolean.
+ * - Args 2..n: path of strings and integers.
+ */
+static int intf_set_dialog_active(lua_State *L)
+{
+ const bool b = lua_toboolean(L, 1);
+ gui2::twidget *w = find_widget(L, 2, true);
+ gui2::tcontrol *c = dynamic_cast<gui2::tcontrol *>(w);
+ if (!c) return luaL_argerror(L, lua_gettop(L), "unsupported widget");
+
+ c->set_active(b);
return 0;
}
@@ -3368,6 +3384,7 @@
{ "require", &intf_require },
{ "scroll_to_tile", &intf_scroll_to_tile },
{ "select_hex", &intf_select_hex },
+ { "set_dialog_active", &intf_set_dialog_active },
{ "set_dialog_callback", &intf_set_dialog_callback },
{ "set_dialog_canvas", &intf_set_dialog_canvas },
{ "set_dialog_value", &intf_set_dialog_value },
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits