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