Add wesnoth.set_dialog_focus function
Gives keyboard focus to the given widget.
This commit is contained in:
parent
fa5e0f7be2
commit
ba6257129a
4 changed files with 14 additions and 0 deletions
|
@ -23,6 +23,7 @@ Version 1.13.1+dev:
|
|||
* Updated translations: French, Galician, Latvian
|
||||
* Lua API:
|
||||
* Added support for unit.level field (read only)
|
||||
* Added wesnoth.set_dialog_focus function
|
||||
* Music and sound effects:
|
||||
* New dwarf hit and die sounds.
|
||||
* User interface:
|
||||
|
|
|
@ -527,6 +527,17 @@ int intf_set_dialog_canvas(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a widget to have the focus
|
||||
* - Args 1..n: path of strings and integers.
|
||||
*/
|
||||
int intf_set_dialog_focus(lua_State *L)
|
||||
{
|
||||
gui2::twidget *w = find_widget(L, 1, true);
|
||||
scoped_dialog::current->window->keyboard_capture(w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a widget's state to active or inactive
|
||||
* - Arg 1: boolean.
|
||||
|
|
|
@ -27,6 +27,7 @@ int intf_get_dialog_value(lua_State *L);
|
|||
int intf_set_dialog_callback(lua_State *L);
|
||||
int intf_set_dialog_markup(lua_State *L);
|
||||
int intf_set_dialog_canvas(lua_State *L);
|
||||
int intf_set_dialog_focus(lua_State *L);
|
||||
int intf_set_dialog_active(lua_State *L);
|
||||
int intf_add_dialog_tree_node(lua_State *L);
|
||||
int show_dialog(lua_State *L, CVideo & video);
|
||||
|
|
|
@ -249,6 +249,7 @@ lua_kernel_base::lua_kernel_base(CVideo * video)
|
|||
{ "add_dialog_tree_node", &lua_gui2::intf_add_dialog_tree_node },
|
||||
{ "set_dialog_callback", &lua_gui2::intf_set_dialog_callback },
|
||||
{ "set_dialog_canvas", &lua_gui2::intf_set_dialog_canvas },
|
||||
{ "set_dialog_focus", &lua_gui2::intf_set_dialog_focus },
|
||||
{ "set_dialog_markup", &lua_gui2::intf_set_dialog_markup },
|
||||
{ "set_dialog_value", &lua_gui2::intf_set_dialog_value },
|
||||
{ "remove_dialog_item", &lua_gui2::intf_remove_dialog_item },
|
||||
|
|
Loading…
Add table
Reference in a new issue