The Battle for Wesnoth  1.15.6+dev
Namespaces | Macros | Functions | Variables
lua_widget_methods.cpp File Reference
#include "config.hpp"
#include "gui/core/canvas.hpp"
#include "gui/core/gui_definition.hpp"
#include "gui/core/window_builder.hpp"
#include "gui/widgets/clickable_item.hpp"
#include "gui/widgets/styled_widget.hpp"
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/multi_page.hpp"
#include "gui/widgets/multimenu_button.hpp"
#include "gui/widgets/progress_bar.hpp"
#include "gui/widgets/selectable_item.hpp"
#include "gui/widgets/slider.hpp"
#include "gui/widgets/stacked_widget.hpp"
#include "gui/widgets/text_box.hpp"
#include "gui/widgets/tree_view.hpp"
#include "gui/widgets/tree_view_node.hpp"
#include "gui/widgets/unit_preview_pane.hpp"
#include "gui/widgets/widget.hpp"
#include "gui/widgets/window.hpp"
#include "log.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_cpp_function.hpp"
#include "scripting/lua_kernel_base.hpp"
#include "scripting/lua_ptr.hpp"
#include "scripting/lua_widget.hpp"
#include "scripting/lua_widget_methods.hpp"
#include "scripting/push_check.hpp"
#include "serialization/string_utils.hpp"
#include "tstring.hpp"
#include "utils/functional.hpp"
#include <type_traits>
#include <map>
#include <utility>
#include <vector>
#include <boost/optional.hpp>
#include "lua/lauxlib.h"
#include "lua/lua.h"
Include dependency graph for lua_widget_methods.cpp:

Go to the source code of this file.

Namespaces

 lua_widget
 

Macros

#define ERR_LUA   LOG_STREAM(err, log_scripting_lua)
 

Functions

int intf_show_dialog (lua_State *L)
 Displays a window. More...
 
static gui2::widgetfind_widget_impl (lua_State *L, gui2::widget *w, int i, bool readonly)
 
static int intf_find_widget (lua_State *L)
 
static int intf_remove_dialog_item (lua_State *L)
 Removes an entry from a list. More...
 
static int intf_set_dialog_callback (lua_State *L)
 Sets a callback on a widget of the current dialog. More...
 
static int intf_set_dialog_canvas (lua_State *L)
 Sets a canvas on a widget of the current dialog. More...
 
static int intf_set_dialog_focus (lua_State *L)
 Sets a widget to have the focus. More...
 
static int intf_add_item_of_type (lua_State *L)
 Sets a widget's state to active or inactive. More...
 
static int intf_add_dialog_item (lua_State *L)
 Sets a widget's state to active or inactive. More...
 
static int intf_dialog_close (lua_State *L)
 Closes a window. More...
 
int lua_widget::luaW_open (lua_State *L)
 

Variables

static lg::log_domain log_scripting_lua ("scripting/lua")
 

Macro Definition Documentation

◆ ERR_LUA

#define ERR_LUA   LOG_STREAM(err, log_scripting_lua)

Definition at line 56 of file lua_widget_methods.cpp.

Referenced by intf_remove_dialog_item().

Function Documentation

◆ find_widget_impl()

static gui2::widget* find_widget_impl ( lua_State L,
gui2::widget w,
int  i,
bool  readonly 
)
static

◆ intf_add_dialog_item()

static int intf_add_dialog_item ( lua_State L)
static

Sets a widget's state to active or inactive.

  • Arg 1: widget.

Definition at line 387 of file lua_widget_methods.cpp.

References mariadb::value::data, lua_gettop(), luaL_argerror(), luaW_checkwidget(), luaW_pushwidget(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_add_item_of_type()

static int intf_add_item_of_type ( lua_State L)
static

Sets a widget's state to active or inactive.

  • Arg 1: widget.
  • Arg 2: string, the type (id of [node_definition]) of the new node.
  • Arg 3: integer, where to insert the new node.

Definition at line 356 of file lua_widget_methods.cpp.

References mariadb::value::data, lua_gettop(), lua_isnumber(), lua_push(), luaL_argerror(), luaL_checkinteger(), luaL_checkstring, luaW_checkwidget(), luaW_pushwidget(), mariadb::value::string, and w.

Referenced by lua_widget::luaW_open().

◆ intf_dialog_close()

static int intf_dialog_close ( lua_State L)
static

Closes a window.

Definition at line 407 of file lua_widget_methods.cpp.

References lua_gettop(), luaL_argerror(), luaW_checkwidget(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_find_widget()

static int intf_find_widget ( lua_State L)
static

◆ intf_remove_dialog_item()

static int intf_remove_dialog_item ( lua_State L)
static

Removes an entry from a list.

  • Arg 1: widget
  • Arg 2: number, index of the element to delete.
  • Arg 3: number, number of the elements to delete. (0 to delete all elements after index)

Definition at line 229 of file lua_widget_methods.cpp.

References ERR_LUA, lua_ptr< T >::get_ptr(), gui2::widget::get_window(), lua_gettop(), luaL_argerror(), luaL_checkinteger(), luaW_callwidgetcallback(), luaW_checkwidget(), mariadb::value::string, and w.

Referenced by lua_widget::luaW_open().

◆ intf_set_dialog_callback()

static int intf_set_dialog_callback ( lua_State L)
static

Sets a callback on a widget of the current dialog.

  • Arg 1: widget.
  • Arg 2: function.

Definition at line 273 of file lua_widget_methods.cpp.

References c, gui2::event::connect_signal_notify_modified(), lua_ptr< T >::get_ptr(), gui2::widget::get_window(), lua_gettop(), lua_pushvalue(), luaL_argerror(), luaW_checkwidget_ptr(), luaW_setwidgetcallback(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_set_dialog_canvas()

static int intf_set_dialog_canvas ( lua_State L)
static

Sets a canvas on a widget of the current dialog.

  • Arg 1: widget.
  • Arg 2: integer.
  • Arg 3: WML table.

Definition at line 316 of file lua_widget_methods.cpp.

References c, gui2::styled_widget::get_canvases(), i, lua_gettop(), luaL_argerror(), luaL_checkinteger(), luaW_checkconfig(), luaW_checkwidget(), gui2::widget::set_is_dirty(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_set_dialog_focus()

static int intf_set_dialog_focus ( lua_State L)
static

Sets a widget to have the focus.

  • Arg 1: widget.

Definition at line 340 of file lua_widget_methods.cpp.

References gui2::widget::get_window(), luaW_checkwidget(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_show_dialog()

int intf_show_dialog ( lua_State L)

Displays a window.

  • Arg 1: WML table describing the window.
  • Arg 2: function called at pre-show.
  • Arg 3: function called at post-show.
  • Ret 1: integer.

Definition at line 65 of file lua_widget_methods.cpp.

References gui2::build(), lua_call, lua_isnoneornil, lua_pushinteger(), lua_pushvalue(), luaW_checkconfig(), luaW_clearwindowtable(), luaW_pushwidget(), and gui2::window::show().

Referenced by lua_gui2::luaW_open().

Variable Documentation

◆ log_scripting_lua

lg::log_domain log_scripting_lua("scripting/lua")
static