UFO: Alien Invasion
|
#include "ui_main.h"
#include "ui_internal.h"
#include "ui_behaviour.h"
#include "ui_parse.h"
#include "../../common/hashtable.h"
#include "../../common/scripts.h"
#include "../../common/scripts_lua.h"
#include "../../common/swig_lua_runtime.h"
Go to the source code of this file.
Macros | |
#define | LOCAL_PROPERTY_SIZE 128 |
Functions | |
const struct value_s * | UI_RegisterNodePropertyPosSize_ (uiBehaviour_t *behaviour, const char *name, int type, size_t pos, size_t size) |
Register a property to a behaviour. It should not be used in the code. More... | |
const struct value_s * | UI_RegisterNodeMethod (uiBehaviour_t *behaviour, const char *name, uiNodeMethod_t function) |
Register a node method to a behaviour. More... | |
const value_t * | UI_GetPropertyFromBehaviour (const uiBehaviour_t *behaviour, const char *name) |
Get a property from a behaviour or his inheritance It use a dichotomic search. More... | |
const value_t * | UI_GetPropertyOrLuaMethod (const uiNode_t *node, const char *name, value_t *out) |
Get a property or lua based method from a node, node behaviour or inherted behaviour. More... | |
void | UI_InitializeNodeBehaviour (uiBehaviour_t *behaviour) |
Initialize a node behaviour memory, after registration, and before using it. More... | |
void | UI_AddBehaviourMethod (uiBehaviour_t *behaviour, const char *name, LUA_METHOD fcn) |
Adds a lua based method to the list of available behaviour methods for calling. More... | |
bool | UI_GetBehaviourMethod (const uiBehaviour_t *behaviour, const char *name, LUA_METHOD &fcn) |
Finds the lua based method on this behaviour or its super. More... | |
bool | UI_HasBehaviourMethod (uiBehaviour_t *behaviour, const char *name) |
Returns true if a node method of given name is available on this behaviour or its super. More... | |
#define LOCAL_PROPERTY_SIZE 128 |
Size of the temporary property-list allocation (per behaviour)
Definition at line 38 of file ui_behaviour.cpp.
Referenced by UI_RegisterNodePropertyPosSize_().
void UI_AddBehaviourMethod | ( | uiBehaviour_t * | behaviour, |
const char * | name, | ||
LUA_METHOD | fcn | ||
) |
Adds a lua based method to the list of available behaviour methods for calling.
[in] | behaviour | The behaviour to extend. |
[in] | name | The name of the new method to add |
[in] | fcn | The lua based function reference. |
Definition at line 251 of file ui_behaviour.cpp.
References Com_Printf(), HASH_Insert(), HASH_NewTable(), uiBehaviour_t::name, and uiBehaviour_t::nodeMethods.
Referenced by uiNode_t_add_classmethod().
bool UI_GetBehaviourMethod | ( | const uiBehaviour_t * | behaviour, |
const char * | name, | ||
LUA_METHOD & | fcn | ||
) |
Finds the lua based method on this behaviour or its super.
[in] | behaviour | The node behaviour to examine. |
[in] | name | The name of the method to find |
[out] | fcn | A reference to a LUA_METHOD value to the corresponding lua based function or to LUA_NOREF if the method is not found |
Definition at line 272 of file ui_behaviour.cpp.
References HASH_Get(), uiBehaviour_t::nodeMethods, and uiBehaviour_t::super.
Referenced by UI_GetNodeMethod(), UI_HasBehaviourMethod(), and UI_HasNodeMethod().
const value_t* UI_GetPropertyFromBehaviour | ( | const uiBehaviour_t * | behaviour, |
const char * | name | ||
) |
Get a property from a behaviour or his inheritance It use a dichotomic search.
Return a property from a node behaviour.
[in] | behaviour | Context behaviour |
[in] | name | Property name we search |
Definition at line 100 of file ui_behaviour.cpp.
References uiBehaviour_t::localProperties, uiBehaviour_t::propertyCount, Q_strcasecmp, value_s::string, and uiBehaviour_t::super.
Referenced by uiFuncNode::onLoaded(), uiPanelNode::onPropertyChanged(), uiConFuncNode::onWindowClosed(), uiConFuncNode::onWindowOpened(), UI_GenInjectedString(), UI_GetPropertyOrLuaMethod(), UI_InitializeNodeBehaviour(), UI_ParseNodeBody(), UI_ParseNodeProperties(), and UI_Window_SetCloseButton().
const value_t* UI_GetPropertyOrLuaMethod | ( | const uiNode_t * | node, |
const char * | name, | ||
value_t * | out | ||
) |
Get a property or lua based method from a node, node behaviour or inherted behaviour.
Return a property or lua based method from a node, node behaviour or inherited behaviour.
[in] | node | The node holding the method |
[in] | name | Property name we search |
[out] | out | A reference to a value_t structure wich is filled if a lua based method is available. Set to nullptr to onlys scan for properties and not for lua based methods. |
Definition at line 136 of file ui_behaviour.cpp.
References uiNode_t::behaviour, Mem_StrDup, value_s::ofs, value_s::size, value_s::string, value_s::type, UI_GetNodeMethod(), UI_GetPropertyFromBehaviour(), and V_UI_NODEMETHOD_LUA.
Referenced by UI_ReadNodePath().
bool UI_HasBehaviourMethod | ( | uiBehaviour_t * | behaviour, |
const char * | name | ||
) |
Returns true if a node method of given name is available on this behaviour or its super.
[in] | behaviour | The node behaviour to examine. |
[in] | name | The name of the method to find |
Definition at line 292 of file ui_behaviour.cpp.
References UI_GetBehaviourMethod().
void UI_InitializeNodeBehaviour | ( | uiBehaviour_t * | behaviour | ) |
Initialize a node behaviour memory, after registration, and before using it.
behaviour | Behaviour to initialize |
<
<
Definition at line 160 of file ui_behaviour.cpp.
References Com_Error(), ERR_FATAL, uiBehaviour_t::extends, uiBehaviour_t::extraDataSize, i, uiBehaviour_t::isInitialized, uiBehaviour_t::localProperties, uiBehaviour_t::manager, Mem_Free, uiBehaviour_t::name, uiBehaviour_t::propertyCount, Q_strcasecmp, Q_streq, Q_strvalid, value_s::string, STRUCT_MEMORY_ALIGN, uiBehaviour_t::super, UI_AllocHunkMemory(), UI_GetNodeBehaviour(), UI_GetPropertyFromBehaviour(), UI_InitializeNodeBehaviour(), and V_UI_NODEMETHOD.
Referenced by UI_InitializeNodeBehaviour(), and UI_InitNodes().
const struct value_s* UI_RegisterNodeMethod | ( | uiBehaviour_t * | behaviour, |
const char * | name, | ||
uiNodeMethod_t | function | ||
) |
Register a node method to a behaviour.
behaviour | Target behaviour |
name | Name of the property |
function | function to execute the node method |
Definition at line 88 of file ui_behaviour.cpp.
References UI_RegisterNodePropertyPosSize_(), and V_UI_NODEMETHOD.
Referenced by UI_RegisterAbstractNode(), UI_RegisterAbstractScrollableNode(), UI_RegisterCheckBoxNode(), UI_RegisterCvarFuncNode(), UI_RegisterEditorNode(), UI_RegisterGeoscapeNode(), UI_RegisterOptionTreeNode(), and UI_RegisterTextEntryNode().
const struct value_s* UI_RegisterNodePropertyPosSize_ | ( | uiBehaviour_t * | behaviour, |
const char * | name, | ||
int | type, | ||
size_t | pos, | ||
size_t | size | ||
) |
Register a property to a behaviour. It should not be used in the code.
behaviour | Target behaviour |
name | Name of the property |
type | Type of the property |
pos | position of the attribute (which store property memory) into the node structure |
size | size of the attribute (which store property memory) into the node structure |
Definition at line 53 of file ui_behaviour.cpp.
References Com_Error(), ERR_FATAL, LOCAL_PROPERTY_SIZE, uiBehaviour_t::localProperties, Mem_PoolAllocTypeN, uiBehaviour_t::name, name, uiBehaviour_t::propertyCount, STRUCT_MEMORY_ALIGN, UI_AllocHunkMemory(), ui_sysPool, V_CVAR_OR_LONGSTRING, V_CVAR_OR_STRING, V_LONGSTRING, and V_STRING.
Referenced by UI_RegisterNodeMethod().