Added lua function set_dialog_active.

Patch #2767.
This commit is contained in:
Mark de Wever 2011-07-30 12:05:12 +00:00
parent 38e7b63844
commit 2dc32038f2
2 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -3002,6 +3002,22 @@ static int intf_set_dialog_canvas(lua_State *L)
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;
}
/**
* Gets all the locations matching a given filter.
* - Arg 1: WML table.
@ -3368,6 +3384,7 @@ LuaKernel::LuaKernel(const config &cfg)
{ "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 },