UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_lua.h
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 1997-2001 Id Software, Inc.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#pragma once
27
29
30// prototype
31struct uiNode_t;
32struct linkedList_t;
33
34/* ui lua startup/shutdown */
35void UI_InitLua (void);
36void UI_ShutdownLua (void);
37
38/* register and call ufo module onload callback */
40void UI_CallHandler_OnLoad (lua_State* L, const char* key);
41
42/* lua script functions */
43bool UI_ParseAndLoadLuaScript (const char* name, const char** text);
46bool UI_ExecuteLuaEventScript_ReturnBool (uiNode_t* node, LUA_EVENT event, bool &result);
47bool UI_ExecuteLuaEventScript_XY (uiNode_t* node, LUA_EVENT event, int x, int y);
48bool UI_ExecuteLuaEventScript_DxDy (uiNode_t* node, LUA_EVENT event, int dx, int dy);
49bool UI_ExecuteLuaEventScript_Key (uiNode_t* node, LUA_EVENT event, unsigned int key, unsigned short unicode);
50
51bool UI_ExecuteLuaEventScript_DragDrop (uiNode_t* node, LUA_EVENT event, bool &result);
52bool UI_ExecuteLuaEventScript_DragDrop_XY (uiNode_t* node, LUA_EVENT event, int x, int y, bool &result);
53bool UI_ExecuteLuaEventScript_DragDrop_IsDropped (uiNode_t* node, LUA_EVENT event, bool isDropped, bool &result);
54
55bool UI_ExecuteLuaMethod (uiNode_t* node, LUA_FUNCTION fcn, linkedList_t* params, int nparams);
57bool UI_ExecuteLuaMethod_ByName (uiNode_t* node, const char* name, linkedList_t* params, int nparams);
58
59/* lua uiNode create functions */
60uiNode_t* UI_CreateControl (uiNode_t* parent, const char* type, const char* name, const char* super);
61uiNode_t* UI_CreateComponent (const char* type, const char* name, const char* super);
62uiNode_t* UI_CreateWindow (const char* type, const char* name, const char* super);
63
64/* information */
65void UI_PrintNodeTree (uiNode_t* node, int level = 0);
66const char* UI_Node_TypeOf(uiNode_t* node);
67
unsigned int key
Definition cl_input.cpp:64
unsigned short unicode
Definition cl_input.cpp:65
level_locals_t level
Definition g_main.cpp:38
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
Header for lua script functions.
int LUA_FUNCTION
callback signatures for functions defined in Lua
Definition scripts_lua.h:45
int LUA_EVENT
holds a reference to a lua event handler
Definition scripts_lua.h:49
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
const char * UI_Node_TypeOf(uiNode_t *node)
Definition ui_lua.cpp:529
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.
Definition ui_lua.cpp:428
bool UI_ExecuteLuaEventScript_DragDrop(uiNode_t *node, LUA_EVENT event, bool &result)
Executes a lua event handler for dragdrop interaction.
Definition ui_lua.cpp:211
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.
Definition ui_lua.cpp:238
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
Definition ui_lua.cpp:71
bool UI_ExecuteLuaEventScript_XY(uiNode_t *node, LUA_EVENT event, int x, int y)
Executes a lua event handler with (x,y) argument.
Definition ui_lua.cpp:143
uiNode_t * UI_CreateWindow(const char *type, const char *name, const char *super)
Create a window node with specified type and inheritance.
Definition ui_lua.cpp:618
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.
Definition ui_lua.cpp:295
bool UI_ExecuteLuaEventScript_DragDrop_IsDropped(uiNode_t *node, LUA_EVENT event, bool isDropped, bool &result)
Executes a lua event handler for dragdrop interaction.
Definition ui_lua.cpp:266
bool UI_ParseAndLoadLuaScript(const char *name, const char **text)
Parses and loads a .ufo file holding a lua script.
Definition ui_lua.cpp:386
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.
Definition ui_lua.cpp:189
void UI_ShutdownLua(void)
Performs UI specific lua shutdown. Call this before CL_ShutdownLua.
Definition ui_lua.cpp:61
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.
Definition ui_lua.cpp:350
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.
Definition ui_lua.cpp:544
void UI_InitLua(void)
Performs UI specific initialization. Call this after CL_InitLua.
Definition ui_lua.cpp:55
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 cha...
Definition ui_lua.cpp:372
bool UI_ExecuteLuaConFunc(uiNode_t *node, LUA_FUNCTION fcn)
Executes a lua based confunc node.
Definition ui_lua.cpp:323
void UI_RegisterHandler_OnLoad(LUA_FUNCTION fcn)
Register global lua callback function called after loading the module.
Definition ui_lua.cpp:363
bool UI_ExecuteLuaEventScript_ParamList(uiNode_t *node, LUA_EVENT event, linkedList_t *params)
Executes a lua event handler with string parameter list.
Definition ui_lua.cpp:91
bool UI_ExecuteLuaEventScript_DxDy(uiNode_t *node, LUA_EVENT event, int dx, int dy)
Executes a lua event handler with (dx,dy) argument.
Definition ui_lua.cpp:166
void UI_PrintNodeTree(uiNode_t *node, int level=0)
Definition ui_lua.cpp:513
bool UI_ExecuteLuaEventScript_ReturnBool(uiNode_t *node, LUA_EVENT event, bool &result)
Executes a lua event handler and returns the result as a boolean.
Definition ui_lua.cpp:116