#include "ui_main.h"
#include "ui_internal.h"
#include "ui_parse.h"
#include "ui_input.h"
#include "ui_actions.h"
#include "node/ui_node_abstractnode.h"
#include "../client.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) |
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, qboolean 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) |
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) |
qboolean | 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 mn_dynStringPool. | |
uiAction_t * | UI_AllocStaticCommandAction (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, 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. | |
void | UI_InitActions (void) |
Variables | |
static const ui_typedActionToken_t | actionTokens [] |
List of typed token. |
Definition in file ui_actions.c.
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 759 of file ui_actions.c.
References Com_Printf(), uiAction_s::d, uiNode_s::dynamic, EA_LISTENER, Mem_PoolAlloc, Mem_PoolStrDup, uiAction_s::next, uiAction_s::nonTerminal, uiNode_s::onClick, uiAction_s::terminal, uiAction_s::type, UI_GetPath(), and ui_sysPool.
Referenced by UI_AddListener_f(), and UI_ConFuncNodeInit().
static void UI_AddListener_f | ( | void | ) | [static] |
add a call of a function into a node event
Definition at line 798 of file ui_actions.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), value_s::type, UI_AddListener(), UI_GetNodeByPath(), UI_ReadNodePath(), and V_UI_ACTION.
Referenced by UI_InitActions().
uiAction_t* UI_AllocStaticCommandAction | ( | char * | command | ) |
Allocate and initialize a command action.
[in] | command | A command for the action |
Definition at line 720 of file ui_actions.c.
References uiAction_s::d, EA_CMD, uiAction_s::terminal, uiAction_s::type, and UI_AllocStaticAction().
Referenced by UI_WindowNodeLoaded().
static void UI_CheckActionTokenTypeSanity | ( | void | ) | [static] |
Check if the action token list is sorted by alphabet, else dichotomic search can't work.
Definition at line 91 of file ui_actions.c.
References i, lengthof, Sys_Error(), and ui_typedActionToken_t::token.
Referenced by UI_InitActions().
static void UI_ExecuteAction | ( | const uiAction_t * | action, | |
uiCallContext_t * | context | |||
) | [static] |
Execute an action from a source.
[in] | context | Context node |
[in] | action | Action to execute |
Definition at line 538 of file ui_actions.c.
References Cbuf_AddText(), Com_Error(), Com_Printf(), Cvar_Delete(), uiAction_s::d, EA_ASSIGN, EA_CALL, EA_CMD, EA_DELETE, EA_ELIF, EA_ELSE, EA_IF, EA_LISTENER, EA_NULL, EA_POPVARS, EA_PUSHVARS, EA_WHILE, ERR_FATAL, i, uiAction_s::next, uiAction_s::nonTerminal, qtrue, uiAction_s::terminal, uiAction_s::type, UI_ExecuteActions(), UI_ExecuteCallAction(), UI_ExecuteSetAction(), UI_GenInjectedString(), UI_GetBooleanFromExpression(), ui_global, UI_MAX_VARIABLESTACK, UI_ReleaseVariable(), uiGlobal_s::variableStack, uiCallContext_s::varNumber, and uiCallContext_s::varPosition.
Referenced by UI_ExecuteActions().
static void UI_ExecuteActions | ( | const uiAction_t * | firstAction, | |
uiCallContext_t * | context | |||
) | [static] |
Definition at line 635 of file ui_actions.c.
References Com_Printf(), uiAction_s::next, and UI_ExecuteAction().
Referenced by UI_ExecuteAction(), UI_ExecuteCallAction(), UI_ExecuteConFuncActions(), and UI_ExecuteEventActions().
static void UI_ExecuteCallAction | ( | const uiAction_t * | action, | |
const uiCallContext_t * | context | |||
) | [inline, static] |
Definition at line 426 of file ui_actions.c.
References byte, Com_Printf(), uiAction_s::d, linkedList_s::data, EA_LISTENER, EA_VALUE_PATHNODE, EA_VALUE_PATHNODE_WITHINJECTION, EA_VALUE_PATHPROPERTY, EA_VALUE_PATHPROPERTY_WITHINJECTION, left, LIST_AddString(), LIST_Delete(), uiAction_s::next, linkedList_s::next, uiAction_s::nonTerminal, value_s::ofs, uiNode_s::onClick, uiCallContext_s::paramNumber, uiCallContext_s::params, qfalse, uiCallContext_s::source, uiAction_s::terminal, value_s::type, uiAction_s::type, UI_ExecuteActions(), UI_GenInjectedString(), UI_GetPath(), UI_GetStringFromExpression(), UI_ReadNodePath(), uiCallContext_s::useCmdParam, V_UI_ACTION, V_UI_NODEMETHOD, uiCallContext_s::varNumber, and uiCallContext_s::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 652 of file ui_actions.c.
References qtrue, uiCallContext_s::source, UI_ExecuteActions(), and uiCallContext_s::useCmdParam.
Referenced by UI_ConfuncCommand_f().
void UI_ExecuteEventActions | ( | uiNode_t * | source, | |
const uiAction_t * | firstAction | |||
) |
Definition at line 661 of file ui_actions.c.
References qfalse, uiCallContext_s::source, UI_ExecuteActions(), and uiCallContext_s::useCmdParam.
Referenced by UI_AbstractNodeActivate(), UI_AbstractOptionSetCurrentValue(), UI_AbstractScrollableNodeSetY(), UI_BarNodeCapturedMouseMove(), UI_BaseInventoryNodeMouseDown(), UI_BaseInventoryNodeUpdateScroll(), UI_ButtonNodeClick(), UI_CheckBoxNodeActivate(), UI_CheckBoxNodeClick(), UI_ClientLayout(), UI_ColumnLayout(), UI_ContainerNodeAutoPlace(), UI_ContainerNodeDNDFinished(), UI_ContainerNodeMouseDown(), UI_ContainerNodeUpdateScroll(), UI_FireInit_f(), UI_FocusExecuteActionNode(), UI_KeyBindingNodeClick(), UI_KeyBindingNodeKeyPressed(), UI_LeftClick(), UI_MaterialEditorMouseDown(), UI_MessageListNodeMouseWheel(), UI_MiddleClick(), UI_MouseMove(), UI_MouseWheel(), UI_OptionListNodeMouseWheel(), UI_OptionListNodeUpdateScroll(), UI_OptionTreeNodeMouseWheel(), UI_OptionTreeNodeUpdateScroll(), UI_OptionTreeSetSelectedValue(), UI_RadioButtonNodeActivate(), UI_RadioButtonNodeClick(), UI_RightClick(), UI_SpinnerNodeStep(), UI_TextEntryNodeAbortEdition(), UI_TextEntryNodeClick(), UI_TextEntryNodeValidateEdition(), UI_TextListNodeClick(), UI_TextListNodeMouseWheel(), UI_TextListNodeRightClick(), UI_TextNodeClick(), UI_TextNodeMouseWheel(), UI_TextNodeRightClick(), UI_TextNodeSelectLine(), UI_TextScrollEnd(), UI_VScrollbarNodeSet(), UI_WindowNodeClose(), UI_WindowNodeDraw(), UI_WindowNodeInit(), and UI_ZoneNodeRepeat().
static void UI_ExecuteSetAction | ( | const uiAction_t * | action, | |
const uiCallContext_t * | context | |||
) | [inline, static] |
Definition at line 367 of file ui_actions.c.
References _, Com_Error(), Com_Printf(), Cvar_ForceSet(), uiAction_s::d, EA_VALUE_CVARNAME, EA_VALUE_CVARNAME_WITHINJECTION, EA_VALUE_PATHPROPERTY, EA_VALUE_PATHPROPERTY_WITHINJECTION, ERR_FATAL, left, uiAction_s::nonTerminal, qfalse, right, uiCallContext_s::source, uiAction_s::terminal, uiAction_s::type, UI_GenInjectedString(), UI_GetPath(), UI_GetStringFromExpression(), UI_NodeSetPropertyFromActionValue(), and UI_ReadNodePath().
Referenced by UI_ExecuteAction().
void UI_FreeStringProperty | ( | void * | pointer | ) |
Free a string property if it is allocated into mn_dynStringPool.
[in,out] | pointer | The pointer to the data that should be freed |
Definition at line 702 of file ui_actions.c.
References _Mem_AllocatedInPool(), uiGlobal_s::adata, uiGlobal_s::adataize, Mem_Free, ui_dynStringPool, and ui_global.
Referenced by UI_DeleteNode(), UI_NodeSetProperty(), UI_NodeSetPropertyFromRAW(), and UI_ReleaseVariable().
static const char* UI_GenCommandReadProperty | ( | const char * | input, | |
char * | output, | |||
int | outputSize | |||
) | [inline, static] |
read a property name from an input buffer to an output
Definition at line 140 of file ui_actions.c.
Referenced by UI_GenInjectedString().
const char* UI_GenInjectedString | ( | const char * | input, | |
qboolean | addNewLine, | |||
const uiCallContext_t * | context | |||
) |
Replace injection identifiers (e.g. <eventParam>) by a value.
cmd "set someCvar <min>/<max>"
Definition at line 206 of file ui_actions.c.
References uiNode_s::behaviour, Com_Printf(), Cvar_Get(), MAX_VAR, next, uiNode_s::parent, uiNode_s::root, uiCallContext_s::source, string, cvar_s::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().
int UI_GetActionTokenType | ( | const char * | token, | |
int | group | |||
) |
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 110 of file ui_actions.c.
References EA_NULL, lengthof, and ui_typedActionToken_t::type.
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 176 of file ui_actions.c.
References Cmd_Argv(), Com_Printf(), linkedList_s::data, linkedList_s::next, uiCallContext_s::paramNumber, uiCallContext_s::params, and uiCallContext_s::useCmdParam.
Referenced by UI_AbstractNodeCallCreateChild(), 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 163 of file ui_actions.c.
References Cmd_Argc(), uiCallContext_s::paramNumber, and uiCallContext_s::useCmdParam.
Referenced by UI_AbstractNodeCallCreateChild(), UI_AbstractNodeCallDelete(), 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 505 of file ui_actions.c.
References ui_global, uiGlobal_s::variableStack, and uiCallContext_s::varPosition.
Referenced by UI_GetFloatFromExpression(), UI_GetNodeFromExpression(), and UI_GetStringFromExpression().
void UI_InitActions | ( | void | ) |
Definition at line 904 of file ui_actions.c.
References Cmd_AddCommand(), UI_AddListener_f(), UI_CheckActionTokenTypeSanity(), and UI_RemoveListener_f().
Referenced by UI_Init().
qboolean UI_IsInjectedString | ( | const char * | string | ) |
Test if a string use an injection syntax.
[in] | string | The string to check for injection |
Definition at line 675 of file ui_actions.c.
Referenced by UI_ParseSetAction(), and UI_ParseValueExpression().
static void UI_NodeSetPropertyFromActionValue | ( | uiNode_t * | node, | |
const value_t * | property, | |||
const uiCallContext_t * | context, | |||
uiAction_t * | value | |||
) | [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 343 of file ui_actions.c.
References uiAction_s::d, EA_VALUE_RAW, EA_VALUE_STRING, uiAction_s::terminal, uiAction_s::type, UI_GetStringFromExpression(), UI_InitRawActionValue(), UI_NodeSetProperty(), and UI_NodeSetPropertyFromRAW().
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 738 of file ui_actions.c.
References Com_Error(), EA_CMD, ERR_FATAL, Mem_PoolAlloc, Mem_PoolStrDup, and ui_sysPool.
Referenced by UI_PopupList(), and UI_SetOneButton().
static void UI_ReleaseVariable | ( | uiValue_t * | variable | ) | [static] |
Definition at line 513 of file ui_actions.c.
References Com_Error(), EA_VALUE_CVAR, EA_VALUE_FLOAT, EA_VALUE_NODE, EA_VALUE_STRING, ERR_FATAL, uiValue_s::string, uiValue_s::type, UI_FreeStringProperty(), and uiValue_s::value.
Referenced by UI_ExecuteAction().
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 834 of file ui_actions.c.
References Cmd_Argv(), Com_Printf(), uiAction_s::d, data, EA_LISTENER, Mem_Free, uiAction_s::next, uiAction_s::nonTerminal, value_s::ofs, uiNode_s::onClick, uiAction_s::terminal, and uiAction_s::type.
Referenced by UI_ConFuncNodeClose(), and UI_RemoveListener_f().
static void UI_RemoveListener_f | ( | void | ) | [static] |
Remove a function callback from a node event.
Definition at line 874 of file ui_actions.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), value_s::type, UI_GetNodeByPath(), UI_ReadNodePath(), UI_RemoveListener(), and V_UI_ACTION.
Referenced by UI_InitActions().
const ui_typedActionToken_t actionTokens[] [static] |
List of typed token.
Definition at line 44 of file ui_actions.c.