|
UFO: Alien Invasion
|
#include "ui_main.h"#include "ui_internal.h"#include "ui_parse.h"#include "ui_input.h"#include "ui_node.h"#include "ui_actions.h"#include "ui_lua.h"#include "node/ui_node_abstractnode.h"#include "../cl_language.h"
Go to the source code of this file.
Data Structures | |
| struct | ui_typedActionToken_t |
Functions | |
| static void | UI_ExecuteActions (const uiAction_t *firstAction, uiCallContext_t *context) |
| Execute a tree of actions from a source. | |
| static void | UI_CheckActionTokenTypeSanity (void) |
| Check if the action token list is sorted by alphabet, else dichotomic search can't work. | |
| int | UI_GetActionTokenType (const char *token, int group) |
| return an action type from a token, and a group | |
| static const char * | UI_GenCommandReadProperty (const char *input, char *output, int outputSize) |
| read a property name from an input buffer to an output | |
| int | UI_GetParamNumber (const uiCallContext_t *context) |
| const char * | UI_GetParam (const uiCallContext_t *context, int paramID) |
| const char * | UI_GenInjectedString (const char *input, bool addNewLine, const uiCallContext_t *context) |
| Replace injection identifiers (e.g. <eventParam>) by a value. | |
| static void | UI_NodeSetPropertyFromActionValue (uiNode_t *node, const value_t *property, const uiCallContext_t *context, uiAction_t *value) |
| static void | UI_ExecuteSetAction (const uiAction_t *action, const uiCallContext_t *context) |
| static void | UI_ExecuteCallAction (const uiAction_t *action, const uiCallContext_t *context) |
| uiValue_t * | UI_GetVariable (const uiCallContext_t *context, int relativeVarId) |
| Return a variable from the context. | |
| static void | UI_ReleaseVariable (uiValue_t *variable) |
| static void | UI_ExecuteAction (const uiAction_t *action, uiCallContext_t *context) |
| Execute an action from a source. | |
| void | UI_ExecuteConFuncActions (uiNode_t *source, const uiAction_t *firstAction) |
| allow to inject command param into cmd of confunc command | |
| void | UI_ExecuteEventActions (uiNode_t *source, const uiAction_t *firstAction) |
| void | UI_ExecuteEventActionsEx (uiNode_t *source, const uiAction_t *firstAction, linkedList_t *params) |
| bool | UI_IsInjectedString (const char *string) |
| Test if a string use an injection syntax. | |
| void | UI_FreeStringProperty (void *pointer) |
| Free a string property if it is allocated into ui_dynStringPool. | |
| uiAction_t * | UI_AllocStaticCommandAction (const char *command) |
| Allocate and initialize a command action. | |
| void | UI_PoolAllocAction (uiAction_t **action, int type, const void *data) |
Set a new action to a uiAction_t pointer. | |
| void | UI_AddListener (uiNode_t *node, const value_t *property, const uiNode_t *functionNode) |
| Add a callback of a function into a node event. There can be more than on listener. | |
| static void | UI_AddListener_f (void) |
| add a call of a function into a node event | |
| void | UI_RemoveListener (uiNode_t *node, const value_t *property, uiNode_t *functionNode) |
| Remove a function callback from a node event. There can be more than on listener. | |
| static void | UI_RemoveListener_f (void) |
| Remove a function callback from a node event. | |
| static void | UI_CvarChangeListener (const char *cvarName, const char *oldValue, const char *newValue, void *data) |
| static void | UI_AddCvarListener_f (void) |
| static void | UI_RemoveCvarListener_f (void) |
| void | UI_InitActions (void) |
Variables | |
| static const ui_typedActionToken_t | actionTokens [] |
| List of typed token. | |
Definition at line 983 of file ui_actions.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_RegisterChangeListener(), cvarChangeListener_t::data, LIST_AddString(), LIST_ContainsString(), and UI_CvarChangeListener().
Referenced by UI_InitActions().
Add a callback of a function into a node event. There can be more than on listener.
| [in,out] | node | The node to add the listener to. |
| [in] | property | The property of the node to add the listener to. |
| [in] | functionNode | The node of the listener callback. |
Definition at line 835 of file ui_actions.cpp.
References Com_GetValue(), uiTerminalActionData_t::constData, uiTerminalActionData_t::constString, uiAction_t::d, uiAction_t::d1, uiAction_t::d2, EA_LISTENER, uiAction_t::left, Mem_PoolAllocType, Mem_PoolStrDup, uiAction_t::next, uiAction_t::nonTerminal, uiNode_t::onClick, uiAction_t::terminal, uiAction_t::type, UI_GetPath(), and ui_sysPool.
Referenced by uiConFuncNode::onWindowOpened(), and UI_AddListener_f().
add a call of a function into a node event
Definition at line 870 of file ui_actions.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), value_t::type, UI_AddListener(), UI_GetNodeByPath(), UI_ReadNodePath(), and V_UI_ACTION.
Referenced by UI_InitActions().
| uiAction_t * UI_AllocStaticCommandAction | ( | const char * | command | ) |
Allocate and initialize a command action.
| [in] | command | A command for the action |
Definition at line 796 of file ui_actions.cpp.
References uiTerminalActionData_t::constString, uiAction_t::d, uiAction_t::d1, EA_CMD, uiAction_t::terminal, uiAction_t::type, and UI_AllocStaticAction().
Referenced by UI_Window_SetCloseButton().
Check if the action token list is sorted by alphabet, else dichotomic search can't work.
Definition at line 95 of file ui_actions.cpp.
References actionTokens, i, lengthof, and Sys_Error().
Referenced by UI_InitActions().
|
static |
Definition at line 975 of file ui_actions.cpp.
References data, LIST_Foreach, and UI_ExecuteConfunc().
Referenced by UI_AddCvarListener_f(), and UI_RemoveCvarListener_f().
|
static |
Execute an action from a source.
| [in] | context | Context node |
| [in] | action | Action to execute |
Definition at line 550 of file ui_actions.cpp.
References uiCallContext_t::breakLoop, Cbuf_AddText(), Com_Error(), Com_Printf(), uiTerminalActionData_t::constString, Cvar_Delete(), uiAction_t::d, uiAction_t::d1, EA_ASSIGN, EA_BREAK, EA_CALL, EA_CMD, EA_DELETE, EA_ELIF, EA_ELSE, EA_FORCHILDIN, EA_IF, EA_LISTENER, EA_NULL, EA_POPVARS, EA_PUSHVARS, EA_WHILE, ERR_FATAL, uiNode_t::firstChild, i, uiTerminalActionData_t::integer, uiAction_t::left, uiAction_t::next, uiNode_t::next, uiAction_t::nonTerminal, uiAction_t::right, uiCallContext_t::tagNode, uiAction_t::terminal, uiAction_t::type, UI_ExecuteActions(), UI_ExecuteCallAction(), UI_ExecuteSetAction(), UI_GenInjectedString(), UI_GetBooleanFromExpression(), UI_GetNodeFromExpression(), ui_global, UI_MAX_VARIABLESTACK, UI_ReleaseVariable(), uiCallContext_t::varNumber, and uiCallContext_t::varPosition.
Referenced by UI_ExecuteActions().
|
static |
Execute a tree of actions from a source.
| [in] | context | Context node |
| [in] | firstAction | Action to execute |
Definition at line 701 of file ui_actions.cpp.
References uiCallContext_t::breakLoop, Com_Printf(), uiCallContext_t::source, UI_ExecuteAction(), and UI_GetPath().
Referenced by UI_ExecuteAction(), UI_ExecuteCallAction(), UI_ExecuteConFuncActions(), UI_ExecuteEventActions(), and UI_ExecuteEventActionsEx().
|
inlinestatic |
Definition at line 425 of file ui_actions.cpp.
References uiCallContext_t::breakLoop, Com_GetValue(), Com_Printf(), uiTerminalActionData_t::constString, uiAction_t::d, uiAction_t::d1, linkedList_t::data, EA_LISTENER, EA_VALUE_PATHNODE, EA_VALUE_PATHNODE_WITHINJECTION, EA_VALUE_PATHPROPERTY, EA_VALUE_PATHPROPERTY_WITHINJECTION, uiAction_t::left, LIST_AddString(), LIST_Delete(), uiNode_t::lua_onClick, Mem_Free, linkedList_t::next, uiAction_t::next, uiAction_t::nonTerminal, value_t::ofs, uiNode_t::onClick, uiCallContext_t::paramNumber, uiCallContext_t::params, uiAction_t::right, uiCallContext_t::source, value_t::string, uiCallContext_t::tagNode, uiAction_t::terminal, uiAction_t::type, value_t::type, UI_ExecuteActions(), UI_ExecuteLuaConFunc(), UI_ExecuteLuaMethod(), UI_GenInjectedString(), UI_GetPath(), UI_GetStringFromExpression(), UI_ReadNodePath(), uiCallContext_t::useCmdParam, V_UI_ACTION, V_UI_NODEMETHOD, V_UI_NODEMETHOD_LUA, uiCallContext_t::varNumber, and uiCallContext_t::varPosition.
Referenced by UI_ExecuteAction().
| void UI_ExecuteConFuncActions | ( | uiNode_t * | source, |
| const uiAction_t * | firstAction ) |
allow to inject command param into cmd of confunc command
Definition at line 717 of file ui_actions.cpp.
References OBJZERO, uiCallContext_t::source, UI_ExecuteActions(), and uiCallContext_t::useCmdParam.
Referenced by UI_ConfuncCommand_f().
| void UI_ExecuteEventActions | ( | uiNode_t * | source, |
| const uiAction_t * | firstAction ) |
Definition at line 726 of file ui_actions.cpp.
References OBJZERO, uiCallContext_t::source, UI_ExecuteActions(), and uiCallContext_t::useCmdParam.
Referenced by uiSequenceNode::draw(), uiTimerNode::draw(), uiVideoNode::drawOverWindow(), uiNode::onActivate(), uiRadioButtonNode::onActivate(), uiOptionListNode::onCapturedMouseMove(), uiOptionTreeNode::onCapturedMouseMove(), uiContainerNode::onDndFinished(), uiCheckBoxNode::onLeftClick(), uiLocatedNode::onLeftClick(), uiRadioButtonNode::onLeftClick(), uiText2Node::onLeftClick(), uiTextEntryNode::onLeftClick(), uiTextListNode::onLeftClick(), uiTextNode::onLeftClick(), uiLocatedNode::onMiddleClick(), uiBaseInventoryNode::onMouseDown(), uiContainerNode::onMouseDown(), uiMaterialEditorNode::onMouseDown(), uiLocatedNode::onMouseEnter(), uiLocatedNode::onMouseLeave(), uiLocatedNode::onRightClick(), uiText2Node::onRightClick(), uiTextListNode::onRightClick(), uiTextNode::onRightClick(), uiLocatedNode::onScroll(), uiMessageListNode::onScroll(), uiOptionListNode::onScroll(), uiOptionTreeNode::onScroll(), uiPanelNode::onScroll(), uiTextNode::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_FinishWindowsInit(), UI_FocusExecuteActionNode(), UI_OptionListNodeUpdateScroll(), UI_OptionTree_SelectValue(), UI_OptionTreeNodeUpdateScroll(), UI_TextEntryNodeAbortEdition(), UI_TextEntryNodeValidateEdition(), UI_TextNodeSelectLine(), UI_TextScrollEnd(), UI_TopDownFlowLayout(), and UI_ZoneNodeRepeat().
| void UI_ExecuteEventActionsEx | ( | uiNode_t * | source, |
| const uiAction_t * | firstAction, | ||
| linkedList_t * | params ) |
Definition at line 735 of file ui_actions.cpp.
References LIST_Count(), OBJZERO, uiCallContext_t::paramNumber, uiCallContext_t::params, uiCallContext_t::source, UI_ExecuteActions(), and uiCallContext_t::useCmdParam.
Referenced by uiWindowNode::onWindowOpened(), and UI_CvarListenerNodeCallback().
|
inlinestatic |
Definition at line 370 of file ui_actions.cpp.
References CL_Translate(), Com_Error(), Com_Printf(), uiTerminalActionData_t::constString, Cvar_ForceSet(), uiAction_t::d, uiAction_t::d1, EA_VALUE_CVARNAME, EA_VALUE_CVARNAME_WITHINJECTION, EA_VALUE_PATHPROPERTY, EA_VALUE_PATHPROPERTY_WITHINJECTION, ERR_FATAL, uiAction_t::left, uiAction_t::nonTerminal, uiAction_t::right, uiCallContext_t::source, uiCallContext_t::tagNode, uiAction_t::terminal, uiAction_t::type, UI_GenInjectedString(), UI_GetPath(), UI_GetStringFromExpression(), UI_NodeSetPropertyFromActionValue(), and UI_ReadNodePath().
Referenced by UI_ExecuteAction().
Free a string property if it is allocated into ui_dynStringPool.
| [in,out] | pointer | The pointer to the data that should be freed |
Definition at line 778 of file ui_actions.cpp.
References _Mem_AllocatedInPool(), Mem_Free, pointer, ui_dynStringPool, and ui_global.
Referenced by UI_DeleteNode(), UI_Model_SetAnimationSource(), UI_Model_SetModelSource(), UI_Model_SetSkinSource(), UI_Model_SetTagSource(), UI_Node_SetFont(), UI_Node_SetImage(), UI_Node_SetText(), UI_Node_SetTooltip(), UI_NodeSetProperty(), UI_NodeSetPropertyFromRAW(), UI_ReleaseVariable(), UI_Sequence_SetSource(), UI_TBar_SetImage(), and UI_Video_SetSource().
|
inlinestatic |
read a property name from an input buffer to an output
Definition at line 143 of file ui_actions.cpp.
Referenced by UI_GenInjectedString().
| const char * UI_GenInjectedString | ( | const char * | input, |
| bool | addNewLine, | ||
| const uiCallContext_t * | context ) |
Replace injection identifiers (e.g. <eventParam>) by a value.
Definition at line 209 of file ui_actions.cpp.
References uiNode_t::behaviour, Com_Printf(), Cvar_Get(), length, uiNode_t::parent, Q_streq, Q_strstart(), uiNode_t::root, uiCallContext_t::source, cvar_t::string, UI_GenCommandReadProperty(), UI_GetParam(), UI_GetParamNumber(), UI_GetPath(), UI_GetPropertyFromBehaviour(), UI_GetStringFromNodeProperty(), UI_ReadNodePath(), and va().
Referenced by UI_ExecuteAction(), UI_ExecuteCallAction(), UI_ExecuteSetAction(), UI_GetBooleanFromExpression(), UI_GetFloatFromExpression(), UI_GetNodeFromExpression(), and UI_GetStringFromExpression().
return an action type from a token, and a group
| [in] | token | Requested token |
| [in] | group | Requested group, EA_ACTION, EA_BINARYOPERATOR, or EA_UNARYOPERATOR |
Definition at line 113 of file ui_actions.cpp.
References actionTokens, EA_NULL, and lengthof.
Referenced by UI_ParseActionList(), and UI_ParseExpression().
| const char * UI_GetParam | ( | const uiCallContext_t * | context, |
| int | paramID ) |
Get a param from an execution context
| [in] | context | The execution context |
| [in] | paramID | The ID of the requested param (first param is integer 1) |
Definition at line 179 of file ui_actions.cpp.
References Cmd_Argv(), Com_Printf(), linkedList_t::data, linkedList_t::next, uiCallContext_t::paramNumber, uiCallContext_t::params, and uiCallContext_t::useCmdParam.
Referenced by UI_AbstractNodeCallCreateChild(), UI_AbstractNodeCallDeleteTimed(), UI_GenInjectedString(), UI_GetFloatFromExpression(), UI_GetStringFromExpression(), and UI_OptionTreeSetSelectedValue().
| int UI_GetParamNumber | ( | const uiCallContext_t * | context | ) |
Get the number of param from an execution context
| [in] | context | The execution context |
Definition at line 166 of file ui_actions.cpp.
References Cmd_Argc(), uiCallContext_t::paramNumber, and uiCallContext_t::useCmdParam.
Referenced by UI_AbstractNodeCallCreateChild(), UI_AbstractNodeCallDelete(), UI_AbstractNodeCallDeleteTimed(), UI_AbstractNodeCallRemovaAllChild(), UI_GenInjectedString(), UI_GetFloatFromExpression(), UI_GetStringFromExpression(), and UI_OptionTreeSetSelectedValue().
| uiValue_t * UI_GetVariable | ( | const uiCallContext_t * | context, |
| int | relativeVarId ) |
Return a variable from the context.
| context | Call context |
| relativeVarId | id of the variable relative to the context |
Definition at line 517 of file ui_actions.cpp.
References ui_global, and uiCallContext_t::varPosition.
Referenced by UI_GetFloatFromExpression(), UI_GetNodeFromExpression(), and UI_GetStringFromExpression().
Definition at line 1034 of file ui_actions.cpp.
References Cmd_AddCommand(), UI_AddCvarListener_f(), UI_AddListener_f(), UI_CheckActionTokenTypeSanity(), UI_RemoveCvarListener_f(), and UI_RemoveListener_f().
Referenced by UI_Init().
| bool UI_IsInjectedString | ( | const char * | string | ) |
Test if a string use an injection syntax.
| [in] | string | The string to check for injection |
Definition at line 751 of file ui_actions.cpp.
Referenced by UI_ParseSetAction(), and UI_ParseValueExpression().
|
static |
Apply an action value to a node property. If the tuple property/value allow it, the function pre compute the value and update the action value to speed up the next call.
| node | Node to edit |
| property | Property of the node to edit |
| value | Action value containing the value to set to the node property |
| context | Call context of the script |
Definition at line 342 of file ui_actions.cpp.
References Com_GetValue(), uiTerminalActionData_t::constData, uiTerminalActionData_t::constString, uiAction_t::d, uiAction_t::d1, uiAction_t::d2, uiTerminalActionData_t::data, EA_VALUE_RAW, EA_VALUE_STRING, uiTerminalActionData_t::integer, Q_strstart(), uiAction_t::terminal, uiAction_t::type, value_t::type, UI_GetStringFromExpression(), UI_InitRawActionValue(), UI_NodeSetProperty(), UI_NodeSetPropertyFromRAW(), V_UI_CVAR, and V_UI_MASK.
Referenced by UI_ExecuteSetAction().
| void UI_PoolAllocAction | ( | uiAction_t ** | action, |
| int | type, | ||
| const void * | data ) |
Set a new action to a uiAction_t pointer.
| [in,out] | action | Allocated action |
| [in] | type | Only EA_CMD is supported |
| [in] | data | The data for this action - in case of EA_CMD this is the commandline |
ui_global.actions array Definition at line 814 of file ui_actions.cpp.
References Com_Error(), data, EA_CMD, ERR_FATAL, Mem_PoolAllocType, Mem_PoolStrDup, type, and ui_sysPool.
Referenced by UI_PopupList(), and UI_SetOneButton().
Definition at line 525 of file ui_actions.cpp.
References Com_Error(), EA_VALUE_CVAR, EA_VALUE_FLOAT, EA_VALUE_NODE, EA_VALUE_STRING, ERR_FATAL, OBJZERO, uiValue_t::string, uiValue_t::type, UI_FreeStringProperty(), and uiValue_t::value.
Referenced by UI_ExecuteAction().
Definition at line 1001 of file ui_actions.cpp.
References cvar_t::changeListener, Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_UnRegisterChangeListener(), cvarChangeListener_t::data, cvarChangeListener_t::exec, LIST_ContainsString(), LIST_IsEmpty(), LIST_RemoveEntry(), cvarChangeListener_t::next, and UI_CvarChangeListener().
Referenced by UI_InitActions().
Remove a function callback from a node event. There can be more than on listener.
| [in,out] | node | The node to remove the listener from. |
| [in] | property | The property of the node to remove the listener from. |
| [in] | functionNode | The node of the listener callback. |
Definition at line 906 of file ui_actions.cpp.
References Cmd_Argv(), Com_GetValue(), Com_Printf(), uiAction_t::d, uiAction_t::d1, data, uiTerminalActionData_t::data, EA_LISTENER, uiAction_t::left, Mem_Free, uiAction_t::next, uiAction_t::nonTerminal, uiNode_t::onClick, and uiAction_t::terminal.
Referenced by uiConFuncNode::onWindowClosed(), and UI_RemoveListener_f().
Remove a function callback from a node event.
Definition at line 945 of file ui_actions.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), value_t::type, UI_GetNodeByPath(), UI_ReadNodePath(), UI_RemoveListener(), and V_UI_ACTION.
Referenced by UI_InitActions().
|
static |
List of typed token.
Definition at line 46 of file ui_actions.cpp.
Referenced by UI_CheckActionTokenTypeSanity(), and UI_GetActionTokenType().