UFO: Alien Invasion
|
#include "../../common/hashtable.h"
#include "../../common/scripts_lua.h"
#include "ui_main.h"
#include "ui_internal.h"
#include "ui_behaviour.h"
#include "ui_node.h"
#include "ui_nodes.h"
#include "ui_parse.h"
#include "ui_input.h"
#include "node/ui_node_abstractnode.h"
#include "node/ui_node_abstractscrollbar.h"
#include "node/ui_node_abstractoption.h"
#include "node/ui_node_abstractvalue.h"
#include "node/ui_node_bar.h"
#include "node/ui_node_base.h"
#include "node/ui_node_baseinventory.h"
#include "node/ui_node_battlescape.h"
#include "node/ui_node_button.h"
#include "node/ui_node_checkbox.h"
#include "node/ui_node_controls.h"
#include "node/ui_node_container.h"
#include "node/ui_node_data.h"
#include "node/ui_node_editor.h"
#include "node/ui_node_geoscape.h"
#include "node/ui_node_image.h"
#include "node/ui_node_item.h"
#include "node/ui_node_linechart.h"
#include "node/ui_node_material_editor.h"
#include "node/ui_node_messagelist.h"
#include "node/ui_node_model.h"
#include "node/ui_node_option.h"
#include "node/ui_node_optionlist.h"
#include "node/ui_node_optiontree.h"
#include "node/ui_node_panel.h"
#include "node/ui_node_radar.h"
#include "node/ui_node_radiobutton.h"
#include "node/ui_node_rows.h"
#include "node/ui_node_selectbox.h"
#include "node/ui_node_sequence.h"
#include "node/ui_node_string.h"
#include "node/ui_node_special.h"
#include "node/ui_node_spinner.h"
#include "node/ui_node_tab.h"
#include "node/ui_node_tbar.h"
#include "node/ui_node_text.h"
#include "node/ui_node_text2.h"
#include "node/ui_node_textlist.h"
#include "node/ui_node_textentry.h"
#include "node/ui_node_texture.h"
#include "node/ui_node_timer.h"
#include "node/ui_node_video.h"
#include "node/ui_node_vscrollbar.h"
#include "node/ui_node_zone.h"
#include "ui_lua.h"
Go to the source code of this file.
Macros | |
#define | NUMBER_OF_BEHAVIOURS lengthof(registerFunctions) |
Typedefs | |
typedef void(* | registerFunction_t )(uiBehaviour_t *node) |
Functions | |
bool | UI_CheckVisibility (uiNode_t *node) |
Check the if conditions for a given node. More... | |
const char * | UI_GetPath (const uiNode_t *node) |
Return a path from a window to a node. More... | |
void | UI_ReadNodePath (const char *path, const uiNode_t *relativeNode, const uiNode_t *iterationNode, uiNode_t **resultNode, const value_t **resultProperty, value_t *luaMethod) |
Read a path and return every we can use (node and property) More... | |
uiNode_t * | UI_GetNodeByPath (const char *path) |
Return a node by a path name (names with dot separation) It is a simplification facade over UI_ReadNodePath. More... | |
static uiNode_t * | UI_AllocNodeWithoutNew (const char *name, const char *type, bool isDynamic) |
Allocate a node into the UI memory (do not call behaviour->new) More... | |
uiNode_t * | UI_AllocNode (const char *name, const char *type, bool isDynamic) |
Allocate a node into the UI memory. More... | |
uiNode_t * | UI_CloneNode (const uiNode_t *node, uiNode_t *newWindow, bool recursive, const char *newName, bool isDynamic) |
Clone a node. More... | |
static uiNode_t * | UI_GetNodeInTreeAtPosition (uiNode_t *node, int rx, int ry) |
Return the first visible node at a position. More... | |
uiNode_t * | UI_GetNodeAtPosition (int x, int y) |
Return the first visible node at a position. More... | |
uiBehaviour_t * | UI_GetNodeBehaviour (const char *name) |
Return a node behaviour by name. More... | |
uiBehaviour_t * | UI_GetNodeBehaviourByIndex (int index) |
int | UI_GetNodeBehaviourCount (void) |
void | UI_DeleteAllChild (uiNode_t *node) |
Remove all child from a node (only remove dynamic memory allocation nodes) More... | |
static void | UI_BeforeDeletingNode (const uiNode_t *node) |
void | UI_DeleteNode (uiNode_t *node) |
void | UI_InitNodes (void) |
Variables | |
static const registerFunction_t | registerFunctions [] |
List of functions to register nodes. More... | |
static uiBehaviour_t | nodeBehaviourList [NUMBER_OF_BEHAVIOURS] |
List of all node behaviours, indexes by nodetype num. More... | |
#define NUMBER_OF_BEHAVIOURS lengthof(registerFunctions) |
Definition at line 140 of file ui_nodes.cpp.
Referenced by UI_GetNodeBehaviour(), UI_GetNodeBehaviourCount(), and UI_InitNodes().
typedef void(* registerFunction_t)(uiBehaviour_t *node) |
Definition at line 83 of file ui_nodes.cpp.
uiNode_t* UI_AllocNode | ( | const char * | name, |
const char * | type, | ||
bool | isDynamic | ||
) |
Allocate a node into the UI memory.
[in] | name | Name of the new node, else nullptr if we don't want to edit it. |
[in] | type | Name of the node behavior |
[in] | isDynamic | Allocate a node in static or dynamic memory |
Definition at line 381 of file ui_nodes.cpp.
References uiNode_t::dynamic, UI_AllocNodeWithoutNew(), UI_Node_InitNode(), UI_Node_InitNodeDynamic(), and UI_Node_Loading().
Referenced by uiConFuncNode::onLoaded(), UI_AbstractNodeCallCreateChild(), UI_AllocOptionNode(), UI_CreateComponent(), UI_CreateControl(), UI_CreateWindow(), UI_ParseComponent(), UI_ParseNode(), UI_ParseWindow(), UI_Window_SetCloseButton(), and UI_Window_SetDragButton().
|
static |
Allocate a node into the UI memory (do not call behaviour->new)
[in] | name | Name of the new node, else nullptr if we don't want to edit it. |
[in] | type | Name of the node behavior |
[in] | isDynamic | Allocate a node in static or dynamic memory |
Definition at line 332 of file ui_nodes.cpp.
References uiNode_t::behaviour, Com_Error(), Com_Printf(), uiNode_t::dynamic, ERR_FATAL, uiBehaviour_t::extraDataSize, Mem_PoolAlloc, uiNode_t::name, uiGlobal_s::numNodes, Q_strncpyz(), STRUCT_MEMORY_ALIGN, UI_AllocHunkMemory(), ui_dynPool, UI_GetNodeBehaviour(), ui_global, and UI_Node_IsAbstract().
Referenced by UI_AllocNode(), and UI_CloneNode().
Definition at line 607 of file ui_nodes.cpp.
References UI_GetHoveredNode(), and UI_InvalidateMouse().
Referenced by UI_DeleteNode().
bool UI_CheckVisibility | ( | uiNode_t * | node | ) |
Check the if conditions for a given node.
Definition at line 152 of file ui_nodes.cpp.
References uiNode_t::lua_onVisibleWhen, uiCallContext_s::source, UI_ExecuteLuaEventScript_ReturnBool(), UI_GetBooleanFromExpression(), uiCallContext_s::useCmdParam, and uiNode_t::visibilityCondition.
Referenced by UI_CheckMouseMove(), UI_DrawModelNode(), UI_DrawNode(), and UI_GetNodeInTreeAtPosition().
uiNode_t* UI_CloneNode | ( | const uiNode_t * | node, |
uiNode_t * | newWindow, | ||
bool | recursive, | ||
const char * | newName, | ||
bool | isDynamic | ||
) |
Clone a node.
[in] | node | Node to clone |
[in] | recursive | True if we also must clone subnodes |
[in] | newWindow | Window where the nodes must be add (this function only link node into window, not window into the new node) |
[in] | newName | New node name, else nullptr to use the source name |
[in] | isDynamic | Allocate a node in static or dynamic memory |
exclude rect is not safe cloned.
actions are not cloned. It is be a problem if we use add/remove listener into a cloned node.
Definition at line 409 of file ui_nodes.cpp.
References Com_Printf(), uiNode_t::dynamic, uiNode_t::firstChild, HASH_CloneTable(), uiNode_t::lastChild, uiNode_t::name, uiNode_t::next, uiNode_t::nodeMethods, uiNode_t::parent, Q_strncpyz(), uiNode_t::root, uiNode_t::super, UI_AllocNodeWithoutNew(), UI_AppendNode(), UI_CloneNode(), UI_Node_Clone(), UI_Node_GetMemorySize(), UI_Node_GetWidgetName(), and UI_Node_InitNodeDynamic().
Referenced by UI_AbstractNodeCallCreateChild(), UI_CloneNode(), UI_CreateComponent(), UI_CreateControl(), UI_CreateWindow(), UI_ParseComponent(), UI_ParseNode(), and UI_ParseWindow().
Remove all child from a node (only remove dynamic memory allocation nodes)
node | The node we want to clean |
Definition at line 596 of file ui_nodes.cpp.
References uiNode_t::firstChild, uiNode_t::next, and UI_DeleteNode().
Referenced by UI_AbstractNodeCallRemovaAllChild(), UI_DeleteNode(), and uiNode_t_remove_children().
Delete the node and remove it from his parent
node | The node we want to delete |
Definition at line 618 of file ui_nodes.cpp.
References uiNode_t::behaviour, Com_Printf(), uiNode_t::dynamic, uiNode_t::firstChild, uiBehaviour_t::localProperties, uiNode_t::parent, uiBehaviour_t::super, UI_BeforeDeletingNode(), UI_DeleteAllChild(), UI_FreeStringProperty(), UI_GetPath(), UI_Node_DeleteNode(), UI_RemoveNode(), V_UI_CVAR, and V_UI_MASK.
Referenced by _wrap_delete_node(), UI_AbstractNodeCallDelete(), UI_AbstractNodeCallDeleteTimed(), UI_DeleteAllChild(), UI_DeleteOption(), UI_DrawNode(), and uiNode_t_delete_node().
Return the first visible node at a position.
Definition at line 527 of file ui_nodes.cpp.
References UI_GetNodeInTreeAtPosition(), ui_global, UI_Validate(), UI_WindowIsDropDown(), UI_WindowIsFullScreen(), UI_WindowIsModal(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by uiEditorNode::drawOverWindow(), uiEditorNode::onMouseDown(), UI_DNDMouseMove(), and UI_MouseMove().
uiBehaviour_t* UI_GetNodeBehaviour | ( | const char * | name | ) |
Return a node behaviour by name.
[in] | name | Behaviour name requested |
Definition at line 559 of file ui_nodes.cpp.
References NUMBER_OF_BEHAVIOURS.
Referenced by TEST_F(), UFO_AnalyseTestWindow(), UI_AllocNodeWithoutNew(), UI_CreateComponent(), UI_CreateControl(), UI_InitializeNodeBehaviour(), UI_ParseComponent(), UI_ParseNode(), and UI_Shutdown().
uiBehaviour_t* UI_GetNodeBehaviourByIndex | ( | int | index | ) |
Definition at line 582 of file ui_nodes.cpp.
References index.
Definition at line 587 of file ui_nodes.cpp.
References NUMBER_OF_BEHAVIOURS.
uiNode_t* UI_GetNodeByPath | ( | const char * | path | ) |
Return a node by a path name (names with dot separation) It is a simplification facade over UI_ReadNodePath.
Definition at line 313 of file ui_nodes.cpp.
References Com_Printf(), and UI_ReadNodePath().
Referenced by GAME_GetImportData(), UI_AddListener_f(), UI_PushDropDownWindow_f(), UI_RemoveListener_f(), and UI_TextScrollEnd().
Return the first visible node at a position.
[in] | node | Node where we must search |
[in] | rx | Relative x position to the parent of the node |
[in] | ry | Relative y position to the parent of the node |
Definition at line 467 of file ui_nodes.cpp.
References uiNode_t::box, uiNode_t::firstChild, uiNode_t::firstExcludeRect, uiNode_t::ghost, uiNode_t::invis, uiExcludeRect_s::next, uiNode_t::next, uiBox_t::pos, uiBox_t::size, UI_CheckVisibility(), UI_DebugMode(), UI_Node_GetClientPosition(), UI_Node_IsScrollableContainer(), and UI_Node_IsVirtual().
Referenced by UI_GetNodeAtPosition().
const char* UI_GetPath | ( | const uiNode_t * | node | ) |
Return a path from a window to a node.
Definition at line 174 of file ui_nodes.cpp.
References i, name, uiNode_t::parent, and Q_strcat().
Referenced by _wrap_nodepath(), uiModelNode::doLayout(), uiTextNode::doLayout(), uiSelectBoxNode::drawOverWindow(), Key_WriteBindings(), uiRadioButtonNode::onActivate(), uiVScrollbarNode::onLoaded(), uiConFuncNode::onLoaded(), uiImageNode::onLoaded(), uiText2Node::onLoaded(), uiFuncNode::onLoaded(), uiTabNode::onWindowOpened(), UI_AbstractOption_GetCurrentValue(), UI_AddLineChartCoord(), UI_AddLineChartLine(), UI_AddListener(), UI_ColumnLayout(), UI_CreateControl(), UI_CvarListenerNodeBind(), UI_DeleteNode(), UI_ExecuteActions(), UI_ExecuteCallAction(), UI_ExecuteLuaConFunc(), UI_ExecuteLuaEventScript(), UI_ExecuteLuaEventScript_DragDrop(), UI_ExecuteLuaEventScript_DragDrop_IsDropped(), UI_ExecuteLuaEventScript_DragDrop_XY(), UI_ExecuteLuaEventScript_DxDy(), UI_ExecuteLuaEventScript_Key(), UI_ExecuteLuaEventScript_ParamList(), UI_ExecuteLuaEventScript_ReturnBool(), UI_ExecuteLuaEventScript_XY(), UI_ExecuteLuaMethod(), UI_ExecuteSetAction(), UI_GenInjectedString(), UI_GetFloatFromNodeProperty(), UI_GetNodeAbsPos(), UI_GetNodeFromExpression(), UI_GetNodeScreenPos(), UI_GetStringFromNodeProperty(), UI_InitRawActionValue(), UI_Node_GetText(), UI_NodeSetProperty(), UI_NodeSetPropertyFromRAW(), UI_ParseActionList(), UI_ParseCallAction(), UI_ParseEventProperty(), UI_ParseExcludeRect(), UI_ParseNode(), UI_ParseNodeBody(), UI_ParseNodeProperties(), UI_ParseSetAction(), UI_ShowChartDots(), and UI_ShowChartLine().
Definition at line 658 of file ui_nodes.cpp.
References Com_Error(), ERR_FATAL, i, uiBehaviour_t::name, nodeBehaviourList, NUMBER_OF_BEHAVIOURS, OBJZERO, registerFunctions, uiBehaviour_t::registration, and UI_InitializeNodeBehaviour().
Referenced by UI_Init().
void UI_ReadNodePath | ( | const char * | path, |
const uiNode_t * | relativeNode, | ||
const uiNode_t * | iterationNode, | ||
uiNode_t ** | resultNode, | ||
const value_t ** | resultProperty, | ||
value_t * | luaMethod | ||
) |
Read a path and return every we can use (node and property)
The path token must be a window name, and then node child. Reserved token 'root' and 'parent' can be used to navigate. If relativeNode is set, the path can start with reserved token 'this', 'root', 'parent' and 'child' (relative to this node). The function can return a node property by using a '@', the path 'foo@pos' will return the window foo and the property 'pos' from the 'window' behaviour.
[in] | path | Path to read. Contain a node location with dot seprator and a facultative property |
[in] | relativeNode | relative node where the path start. It allow to use facultative command to start the path (this, parent, root). |
[in] | iterationNode | relative node referencing child in 'forchildin' iteration, mapped to '*node:child', can be nullptr |
[out] | resultNode | Node found. Else nullptr. |
[out] | resultProperty | Property found. Else nullptr. |
[in,out] | luaMethod | A pointer to a value_t structure that is filled with a lua based method identification, can be nullptr |
Definition at line 219 of file ui_nodes.cpp.
References MAX_VAR, name, uiNode_t::parent, Q_streq, Q_strncpyz(), uiNode_t::root, value_s::type, UI_GetNode(), UI_GetPropertyOrLuaMethod(), UI_GetWindow(), UI_Node_IsWindow(), and UI_WindowNodeGetIndexedChild().
Referenced by UI_AddListener_f(), UI_ExecuteCallAction(), UI_ExecuteSetAction(), UI_GenInjectedString(), UI_GetBooleanFromExpression(), UI_GetNodeByPath(), UI_GetNodeFromExpression(), UI_RemoveListener_f(), and UI_SetKeyBindingEx().
|
static |
List of all node behaviours, indexes by nodetype num.
Definition at line 145 of file ui_nodes.cpp.
Referenced by UI_InitNodes().
|
static |
List of functions to register nodes.
Definition at line 89 of file ui_nodes.cpp.
Referenced by UI_InitNodes().