The Battle for Wesnoth  1.19.6+dev
Namespaces | Macros | Functions | Variables
lua_widget_methods.cpp File Reference
#include "config.hpp"
#include "gui/core/canvas.hpp"
#include "gui/core/event/handler.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/selectable_item.hpp"
#include "gui/widgets/slider.hpp"
#include "gui/widgets/stacked_widget.hpp"
#include "gui/widgets/tree_view.hpp"
#include "gui/widgets/tree_view_node.hpp"
#include "gui/widgets/widget.hpp"
#include "gui/widgets/window.hpp"
#include "log.hpp"
#include "scripting/lua_common.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 "utils/scope_exit.hpp"
#include <functional>
#include <vector>
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_clear_items (lua_State *L)
 Removes all entries 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)
 Adds an item to a container widget that supports different types of items, for example a treeview. More...
 
static int intf_add_dialog_item (lua_State *L)
 Adds an item to a container widget, for example a listbox. 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 45 of file lua_widget_methods.cpp.

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

Adds an item to a container widget, for example a listbox.

  • Arg 1: widget.
  • Arg 2: integer (optional), where to insert the new item.

Definition at line 449 of file lua_widget_methods.cpp.

References data, lua_push(), 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

Adds an item to a container widget that supports different types of items, for example a treeview.

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

Definition at line 417 of file lua_widget_methods.cpp.

References data, lua_push(), luaW_checkwidget(), luaW_pushwidget(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_clear_items()

static int intf_clear_items ( lua_State *  L)
static

Removes all entries from a list.

  • Arg 1: widget

Definition at line 290 of file lua_widget_methods.cpp.

References gui2::tree_view::clear(), luaW_checkwidget(), 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 472 of file lua_widget_methods.cpp.

References gui2::window::close(), luaW_checkwidget(), and w.

Referenced by lua_widget::luaW_open().

◆ intf_find_widget()

static int intf_find_widget ( lua_State *  L)
static

Definition at line 187 of file lua_widget_methods.cpp.

References find_widget_impl(), luaW_checkwidget(), luaW_pushwidget(), and w.

Referenced by lua_widget::luaW_open().

◆ 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 (optional), index of the element to delete.
  • Arg 3: number (optional), number of the elements to delete. (0 to delete all elements after index)

Definition at line 261 of file lua_widget_methods.cpp.

References luaW_checkwidget(), 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 331 of file lua_widget_methods.cpp.

References c, gui2::event::connect_signal_notify_modified(), lua_ptr< T >::get_ptr(), 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 377 of file lua_widget_methods.cpp.

References c, i, luaW_checkconfig(), luaW_checkwidget(), 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 401 of file lua_widget_methods.cpp.

References gui2::window::keyboard_capture(), 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 54 of file lua_widget_methods.cpp.

References luaW_checkconfig(), luaW_clearwindowtable(), luaW_pushwidget(), ON_SCOPE_EXIT, gui2::open_window_stack, and gui2::remove_from_window_stack().

Referenced by lua_gui2::luaW_open().

Variable Documentation

◆ log_scripting_lua

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