The Battle for Wesnoth  1.15.5+dev
Namespaces | Functions | Variables
lua_widget.cpp File Reference
#include "scripting/lua_widget.hpp"
#include "scripting/lua_widget_attributes.hpp"
#include "log.hpp"
#include "gui/widgets/widget.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_unit.hpp"
#include "scripting/lua_unit_type.hpp"
#include "scripting/lua_ptr.hpp"
#include "scripting/push_check.hpp"
#include "lua/lauxlib.h"
#include "lua/lua.h"
#include <type_traits>
Include dependency graph for lua_widget.cpp:

Go to the source code of this file.

Namespaces

 lua_widget
 

Functions

void luaW_pushwidget (lua_State *L, gui2::widget &w)
 
gui2::widgetluaW_checkwidget (lua_State *L, int n)
 
lua_ptr< gui2::widget > & luaW_checkwidget_ptr (lua_State *L, int n)
 
bool luaW_iswidget (lua_State *L, int index)
 
static void luaW_pushwidgettablecontainer (lua_State *L)
 
void luaW_pushwindowtable (lua_State *L, gui2::window *owner)
 [-0, +1, -] More...
 
void luaW_clearwindowtable (lua_State *L, gui2::window *owner)
 [-0, +0, -] More...
 
void luaW_pushwidgettable (lua_State *L, gui2::widget *wg, gui2::window *owner)
 [-0, +1, -] More...
 
bool luaW_setwidgetcallback (lua_State *L, gui2::widget *wg, gui2::window *owner, utils::string_view name)
 returns true if a callback already existed. [-1, +0, -] More...
 
void luaW_getwidgetcallback (lua_State *L, gui2::widget *wg, gui2::window *owner, utils::string_view name)
 pushed ther callback function onoto the stack [-0, +1, -] More...
 
void luaW_callwidgetcallback (lua_State *L, gui2::widget *wg, gui2::window *owner, utils::string_view name)
 callas a widgets callback [-0, +0, e] More...
 
static int impl_widget_collect (lua_State *L)
 
void lua_widget::register_metatable (lua_State *L)
 

Variables

static const char widgetKey [] = "widget"
 
static char widgetdataKey [] = "widgetdata"
 

Function Documentation

◆ impl_widget_collect()

static int impl_widget_collect ( lua_State L)
static

Definition at line 183 of file lua_widget.cpp.

References luaL_checkudata(), w, and widgetKey.

Referenced by lua_widget::register_metatable().

◆ luaW_callwidgetcallback()

void luaW_callwidgetcallback ( lua_State L,
gui2::widget wg,
gui2::window owner,
utils::string_view  name 
)

callas a widgets callback [-0, +0, e]

Definition at line 174 of file lua_widget.cpp.

References lua_call, lua_isfunction, luaW_getwidgetcallback(), and luaW_pushwidget().

Referenced by intf_remove_dialog_item(), and WIDGET_GETTER().

◆ luaW_checkwidget()

gui2::widget& luaW_checkwidget ( lua_State L,
int  n 
)

◆ luaW_checkwidget_ptr()

lua_ptr<gui2::widget>& luaW_checkwidget_ptr ( lua_State L,
int  n 
)

◆ luaW_clearwindowtable()

void luaW_clearwindowtable ( lua_State L,
gui2::window owner 
)

[-0, +0, -]

Definition at line 103 of file lua_widget.cpp.

References lua_pop, lua_pushlightuserdata(), lua_pushnil(), lua_rawset(), and luaW_pushwidgettablecontainer().

Referenced by intf_show_dialog().

◆ luaW_getwidgetcallback()

void luaW_getwidgetcallback ( lua_State L,
gui2::widget wg,
gui2::window owner,
utils::string_view  name 
)

pushed ther callback function onoto the stack [-0, +1, -]

Definition at line 162 of file lua_widget.cpp.

References lua_absindex(), lua_push(), lua_rawget(), lua_remove, and luaW_pushwidgettable().

Referenced by luaW_callwidgetcallback().

◆ luaW_iswidget()

bool luaW_iswidget ( lua_State L,
int  index 
)

Definition at line 62 of file lua_widget.cpp.

References luaL_testudata(), and widgetKey.

◆ luaW_pushwidget()

void luaW_pushwidget ( lua_State L,
gui2::widget w 
)

◆ luaW_pushwidgettable()

void luaW_pushwidgettable ( lua_State L,
gui2::widget wg,
gui2::window owner 
)

◆ luaW_pushwidgettablecontainer()

static void luaW_pushwidgettablecontainer ( lua_State L)
static

◆ luaW_pushwindowtable()

void luaW_pushwindowtable ( lua_State L,
gui2::window owner 
)

◆ luaW_setwidgetcallback()

bool luaW_setwidgetcallback ( lua_State L,
gui2::widget wg,
gui2::window owner,
utils::string_view  name 
)

returns true if a callback already existed. [-1, +0, -]

Definition at line 140 of file lua_widget.cpp.

References lua_absindex(), lua_isnoneornil, lua_pop, lua_push(), lua_rawget(), lua_rawset(), lua_rotate(), and luaW_pushwidgettable().

Referenced by intf_set_dialog_callback(), and WIDGET_GETTER().

Variable Documentation

◆ widgetdataKey

char widgetdataKey[] = "widgetdata"
static

Definition at line 33 of file lua_widget.cpp.

Referenced by luaW_pushwidgettablecontainer().

◆ widgetKey

const char widgetKey[] = "widget"
static