|
UFO: Alien Invasion
|
Basic lua initialization for the ui. More...
#include "ui_lua.h"#include "../../shared/cxx.h"#include "../../shared/defines.h"#include "../../shared/shared.h"#include "../../common/cvar.h"#include "../../common/hashtable.h"#include "../../common/filesys.h"#include "../../common/scripts_lua.h"#include "../cl_lua.h"#include "ui_main.h"#include "ui_components.h"#include "ui_behaviour.h"#include "ui_node.h"#include "ui_parse.h"#include "ui_internal.h"#include "../../common/swig_lua_runtime.h"
Go to the source code of this file.
Functions | |
| void | UI_InitLua (void) |
| Performs UI specific initialization. Call this after CL_InitLua. | |
| void | UI_ShutdownLua (void) |
| Performs UI specific lua shutdown. Call this before CL_ShutdownLua. | |
| bool | UI_ExecuteLuaEventScript (uiNode_t *node, LUA_EVENT event) |
| Executes a lua event handler. | |
| bool | UI_ExecuteLuaEventScript_ParamList (uiNode_t *node, LUA_EVENT event, linkedList_t *params) |
| Executes a lua event handler with string parameter list. | |
| bool | UI_ExecuteLuaEventScript_ReturnBool (uiNode_t *node, LUA_EVENT event, bool &result) |
| Executes a lua event handler and returns the result as a boolean. | |
| bool | UI_ExecuteLuaEventScript_XY (uiNode_t *node, LUA_EVENT event, int x, int y) |
| Executes a lua event handler with (x,y) argument. | |
| bool | UI_ExecuteLuaEventScript_DxDy (uiNode_t *node, LUA_EVENT event, int dx, int dy) |
| Executes a lua event handler with (dx,dy) argument. | |
| bool | UI_ExecuteLuaEventScript_Key (uiNode_t *node, LUA_EVENT event, unsigned int key, unsigned short unicode) |
| Executes a lua event handler with (keycode,unicode) argument. | |
| bool | UI_ExecuteLuaEventScript_DragDrop (uiNode_t *node, LUA_EVENT event, bool &result) |
| Executes a lua event handler for dragdrop interaction. | |
| bool | UI_ExecuteLuaEventScript_DragDrop_XY (uiNode_t *node, LUA_EVENT event, int x, int y, bool &result) |
| Executes a lua event handler for dragdrop interaction. | |
| bool | UI_ExecuteLuaEventScript_DragDrop_IsDropped (uiNode_t *node, LUA_EVENT event, bool isDropped, bool &result) |
| Executes a lua event handler for dragdrop interaction. | |
| bool | UI_ExecuteLuaMethod (uiNode_t *node, LUA_FUNCTION fcn, linkedList_t *params, int nparams) |
| Executes a lua based method defined on the behaviour class of a node. | |
| bool | UI_ExecuteLuaConFunc (uiNode_t *node, LUA_FUNCTION fcn) |
| Executes a lua based confunc node. | |
| bool | UI_ExecuteLuaMethod_ByName (uiNode_t *node, const char *name, linkedList_t *params, int nparams) |
| Executes a lua based method defined on the behaviour class of a node. | |
| void | UI_RegisterHandler_OnLoad (LUA_FUNCTION fcn) |
| Register global lua callback function called after loading the module. | |
| void | UI_CallHandler_OnLoad (lua_State *L, const char *key) |
| Call the registered callback handler. This stub primarily exists should the signature of the call change in the future. CL_ExecuteCallback only supports a callback with no arguments. | |
| bool | UI_ParseAndLoadLuaScript (const char *name, const char **text) |
| Parses and loads a .ufo file holding a lua script. | |
| uiNode_t * | UI_CreateControl (uiNode_t *parent, const char *type, const char *name, const char *super) |
| Create a new control inherited from a given node class or other node. | |
| void | UI_PrintNodeTree (uiNode_t *node, int level) |
| const char * | UI_Node_TypeOf (uiNode_t *node) |
| uiNode_t * | UI_CreateComponent (const char *type, const char *name, const char *super) |
| Create a new component inherited from a given node class or other node. | |
| uiNode_t * | UI_CreateWindow (const char *type, const char *name, const char *super) |
| Create a window node with specified type and inheritance. | |
Variables | |
| char | ui_scriptname [256] = "" |
Basic lua initialization for the ui.
Definition in file ui_lua.cpp.
| void UI_CallHandler_OnLoad | ( | lua_State * | L, |
| const char * | key ) |
Call the registered callback handler. This stub primarily exists should the signature of the call change in the future. CL_ExecuteCallback only supports a callback with no arguments.
Definition at line 372 of file ui_lua.cpp.
References CL_ExecuteCallback(), and key.
Referenced by UI_ParseAndLoadLuaScript().
| uiNode_t * UI_CreateComponent | ( | const char * | type, |
| const char * | name, | ||
| const char * | super ) |
Create a new component inherited from a given node class or other node.
| [in] | type | The behaviour type of the component to create. |
| [in] | name | The name of the component to create. |
| [in] | super | The name this component inherits from. If NULL the component has no super defined. |
Definition at line 544 of file ui_lua.cpp.
References uiNode_t::behaviour, Com_Printf(), name, uiBehaviour_t::name, type, UI_AllocNode(), UI_CloneNode(), UI_GetComponent(), UI_GetNodeBehaviour(), UI_InsertComponent(), UI_Node_Loaded(), UI_TokenIsName(), and UI_TokenIsReserved().
Referenced by _wrap_create_component().
| uiNode_t * UI_CreateControl | ( | uiNode_t * | parent, |
| const char * | type, | ||
| const char * | name, | ||
| const char * | super ) |
Create a new control inherited from a given node class or other node.
| [in] | parent | The parent control or window/component owning this control. |
| [in] | type | The behaviour type of the control to create. This can be a previously defined control instance. |
| [in] | name | The name of the control to create. |
| [in] | super | The name this control inherits from. If specified overrides the behaviour type of super must match type. |
Definition at line 428 of file ui_lua.cpp.
References uiNode_t::behaviour, Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, name, uiBehaviour_t::name, uiNode_t::root, uiNode_t::super, type, UI_AllocNode(), UI_AppendNode(), UI_CloneNode(), UI_GetComponent(), UI_GetNode(), UI_GetNodeBehaviour(), UI_GetPath(), UI_Node_Loaded(), UI_TokenIsName(), UI_TokenIsReserved(), and UI_UpdateRoot().
Referenced by _wrap_create_control(), UI_CreateBar(), UI_CreateBaseInventory(), UI_CreateBaseLayout(), UI_CreateButton(), UI_CreateCheckBox(), UI_CreateConFunc(), UI_CreateContainer(), UI_CreateData(), UI_CreateGeoscape(), UI_CreateImage(), UI_CreateItem(), UI_CreateLineChart(), UI_CreateMessageList(), UI_CreateModel(), UI_CreateOption(), UI_CreateOptionList(), UI_CreateOptionTree(), UI_CreatePanel(), UI_CreateRadar(), UI_CreateRadioButton(), UI_CreateRows(), UI_CreateSelectBox(), UI_CreateSequence(), UI_CreateSpinner(), UI_CreateString(), UI_CreateTab(), UI_CreateTBar(), UI_CreateText(), UI_CreateText2(), UI_CreateTextEntry(), UI_CreateTextList(), UI_CreateTexture(), UI_CreateTimer(), UI_CreateVideo(), UI_CreateVScrollbar(), UI_CreateWidget(), and UI_CreateZone().
| uiNode_t * UI_CreateWindow | ( | const char * | type, |
| const char * | name, | ||
| const char * | super ) |
Create a window node with specified type and inheritance.
| [in] | type | The behaviour type of the window to create. |
| [in] | name | The name of the window to create. |
| [in] | super | The name this window inherits from. If NULL the window has no super defined. |
Definition at line 618 of file ui_lua.cpp.
References Com_Error(), Com_Printf(), ERR_FATAL, i, name, Q_streq, uiNode_t::root, Sys_Error(), type, UI_AllocNode(), UI_CloneNode(), UI_GetWindow(), ui_global, UI_InsertWindow(), UI_MAX_WINDOWS, UI_Node_Loaded(), UI_TokenIsName(), and UI_TokenIsReserved().
| bool UI_ExecuteLuaConFunc | ( | uiNode_t * | node, |
| LUA_FUNCTION | fcn ) |
Executes a lua based confunc node.
| [in] | node | The node the method is defined on. |
| [in] | fcn | The The method to execute. |
Definition at line 323 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), i, uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by UI_ConfuncCommand_f(), and UI_ExecuteCallAction().
Executes a lua event handler.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
Definition at line 71 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiSequenceNode::draw(), uiTimerNode::draw(), uiVideoNode::drawOverWindow(), uiNode::onActivate(), uiRadioButtonNode::onActivate(), uiOptionListNode::onCapturedMouseMove(), uiOptionTreeNode::onCapturedMouseMove(), uiContainerNode::onDndFinished(), uiLocatedNode::onFocusGained(), uiLocatedNode::onFocusLost(), uiTextListNode::onLeftClick(), uiNode::onLoaded(), uiBaseInventoryNode::onMouseDown(), uiContainerNode::onMouseDown(), uiMaterialEditorNode::onMouseDown(), uiLocatedNode::onMouseEnter(), uiLocatedNode::onMouseLeave(), uiTextListNode::onRightClick(), uiOptionListNode::onScroll(), uiOptionTreeNode::onScroll(), uiPanelNode::onScroll(), uiWindowNode::onWindowActivate(), uiWindowNode::onWindowClosed(), uiAbstractScrollableNode::setScrollY(), uiAbstractValueNode::setValue(), UI_AbstractOption_SetCurrentValue(), UI_AbstractScrollbarNodeSet(), UI_AbstractValue_SetValueCvar(), UI_BaseInventoryNodeUpdateScroll(), UI_ClientLayout(), UI_ColumnLayout(), UI_ContainerNodeAutoPlaceItem(), UI_OptionListNodeUpdateScroll(), UI_OptionTree_SelectValue(), UI_OptionTreeNodeUpdateScroll(), UI_TextEntryNodeValidateEdition(), UI_TextNodeSelectLine(), UI_TextScrollEnd(), and UI_TopDownFlowLayout().
Executes a lua event handler for dragdrop interaction.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [out] | result | A reference to a bool set to the function result. |
Definition at line 211 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiLocatedNode::onDndEnter(), and uiLocatedNode::onDndLeave().
| bool UI_ExecuteLuaEventScript_DragDrop_IsDropped | ( | uiNode_t * | node, |
| LUA_EVENT | event, | ||
| bool | isDropped, | ||
| bool & | result ) |
Executes a lua event handler for dragdrop interaction.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in] | isDropped | The boolean of the call signature (isDropped). |
| [out] | result | A reference to a bool set to the function result. |
Definition at line 266 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiLocatedNode::onDndFinished().
| bool UI_ExecuteLuaEventScript_DragDrop_XY | ( | uiNode_t * | node, |
| LUA_EVENT | event, | ||
| int | x, | ||
| int | y, | ||
| bool & | result ) |
Executes a lua event handler for dragdrop interaction.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in] | x | The x value of the call signature (x, y) |
| [in] | y | The y value of the call signature (x, y) |
| [out] | result | A reference to a bool set to the function result. |
Definition at line 238 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiLocatedNode::onDndDrop(), and uiLocatedNode::onDndMove().
Executes a lua event handler with (dx,dy) argument.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in] | dx | The dx-coordinate of the (dx,dy) argument. |
| [in] | dy | The dy-coordinate of the (dx,dy) argument. |
Definition at line 166 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiLocatedNode::onScroll().
| bool UI_ExecuteLuaEventScript_Key | ( | uiNode_t * | node, |
| LUA_EVENT | event, | ||
| unsigned int | key, | ||
| unsigned short | unicode ) |
Executes a lua event handler with (keycode,unicode) argument.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in] | key | The key value of the (keycode,unicode) argument. |
| [in] | unicode | The unicode value of the (keycode,unicode) argument. |
Definition at line 189 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), key, uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, UI_GetPath(), and unicode.
Referenced by uiLocatedNode::onKeyPressed(), and uiLocatedNode::onKeyReleased().
| bool UI_ExecuteLuaEventScript_ParamList | ( | uiNode_t * | node, |
| LUA_EVENT | event, | ||
| linkedList_t * | params ) |
Executes a lua event handler with string parameter list.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in] | params | LinkedLst of strings |
Definition at line 91 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), LIST_Foreach, uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiWindowNode::onWindowOpened().
Executes a lua event handler and returns the result as a boolean.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in,out] | result | The boolean value returned by the lua script. |
Definition at line 116 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by UI_CheckVisibility().
Executes a lua event handler with (x,y) argument.
| [in] | node | The node the event handler is associated with. |
| [in] | event | The event to execute. |
| [in] | x | The x-coordinate of the (x,y) argument. |
| [in] | y | The y-coordinate of the (x,y) argument. |
Definition at line 143 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by uiCheckBoxNode::onLeftClick(), uiLocatedNode::onLeftClick(), uiRadioButtonNode::onLeftClick(), uiText2Node::onLeftClick(), uiTextEntryNode::onLeftClick(), uiTextListNode::onLeftClick(), uiTextNode::onLeftClick(), uiLocatedNode::onMiddleClick(), and uiLocatedNode::onRightClick().
| bool UI_ExecuteLuaMethod | ( | uiNode_t * | node, |
| LUA_FUNCTION | fcn, | ||
| linkedList_t * | params, | ||
| int | nparams ) |
Executes a lua based method defined on the behaviour class of a node.
| [in] | node | The node the method is defined on. |
| [in] | fcn | The The method to execute. |
| [in] | params | A linked list of parameters for the lua based function call. |
| [in] | nparams | The number of parameters for the lua based function call. |
Definition at line 295 of file ui_lua.cpp.
References uiNode_t::behaviour, CL_GetLuaState(), Com_Printf(), i, LIST_GetByIdx(), uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::name, SWIG_NewPointerObj, and UI_GetPath().
Referenced by UI_ExecuteCallAction(), and UI_ExecuteLuaMethod_ByName().
| bool UI_ExecuteLuaMethod_ByName | ( | uiNode_t * | node, |
| const char * | name, | ||
| linkedList_t * | params, | ||
| int | nparams ) |
Executes a lua based method defined on the behaviour class of a node.
| [in] | node | The node the method is defined on |
| [in] | name | The name of the node |
| [in] | params | List of Lua method parameters |
| [in] | nparams | Number of parameters on the list |
Definition at line 350 of file ui_lua.cpp.
References Com_Printf(), name, uiNode_t::name, UI_ExecuteLuaMethod(), and UI_GetNodeMethod().
Performs UI specific initialization. Call this after CL_InitLua.
Definition at line 55 of file ui_lua.cpp.
Referenced by UI_Init().
| const char * UI_Node_TypeOf | ( | uiNode_t * | node | ) |
Definition at line 529 of file ui_lua.cpp.
References uiNode_t::behaviour, and uiBehaviour_t::name.
| bool UI_ParseAndLoadLuaScript | ( | const char * | name, |
| const char ** | text ) |
Parses and loads a .ufo file holding a lua script.
| [in] | name | The name of the .ufo file (holding the lua script). |
| [in] | text | The contents of the .ufo file, only provided to be in line with code handling other .ufo content types. |
Definition at line 386 of file ui_lua.cpp.
References CL_GetLuaState(), Com_Error(), Com_Printf(), name, Q_strncpyz(), UI_CallHandler_OnLoad(), and ui_scriptname.
Referenced by CL_ParseClientData(), and UI_Restart_f().
Definition at line 513 of file ui_lua.cpp.
References Com_Printf(), uiNode_t::firstChild, i, level, uiNode_t::name, uiNode_t::next, and UI_PrintNodeTree().
Referenced by _wrap_nodetree(), and UI_PrintNodeTree().
| void UI_RegisterHandler_OnLoad | ( | LUA_FUNCTION | fcn | ) |
Register global lua callback function called after loading the module.
Definition at line 363 of file ui_lua.cpp.
References CL_RegisterCallback(), and ui_scriptname.
Referenced by _wrap_register_onload().
Performs UI specific lua shutdown. Call this before CL_ShutdownLua.
Definition at line 61 of file ui_lua.cpp.
Referenced by UI_Shutdown().
| char ui_scriptname[256] = "" |
Definition at line 49 of file ui_lua.cpp.
Referenced by UI_ParseAndLoadLuaScript(), and UI_RegisterHandler_OnLoad().