#include "../../shared/ufotypes.h"
#include "../../common/scripts.h"
Go to the source code of this file.
Data Structures | |
struct | uiExcludeRect_s |
struct | uiNode_s |
Atomic structure used to define most of the UI. More... | |
struct | uiBehaviour_s |
node behaviour, how a node work More... | |
Defines | |
#define | UI_MAX_EXLUDERECTS 64 |
#define | UI_EXTRADATA_POINTER(NODE, TYPE) ((TYPE*)((char*)NODE + sizeof(uiNode_t))) |
Return extradata structure from a node. | |
#define | UI_EXTRADATA(NODE, TYPE) (*UI_EXTRADATA_POINTER(NODE, TYPE)) |
#define | UI_EXTRADATACONST_POINTER(NODE, TYPE) ((TYPE*)((const char*)NODE + sizeof(uiNode_t))) |
#define | UI_EXTRADATACONST(NODE, TYPE) (*UI_EXTRADATACONST_POINTER(NODE, const TYPE)) |
#define | UI_EXTRADATA_OFFSETOF(TYPE, MEMBER) ((size_t) &((TYPE *)(UI_EXTRADATA_POINTER(0, TYPE)))->MEMBER) |
Return the offset of an extradata node attribute. | |
Typedefs | |
typedef struct uiExcludeRect_s | uiExcludeRect_t |
typedef void(* | uiNodeMethod_t )(struct uiNode_s *node, const struct uiCallContext_s *context) |
typedef struct uiNode_s | uiNode_t |
Atomic structure used to define most of the UI. | |
typedef struct uiBehaviour_s | uiBehaviour_t |
node behaviour, how a node work | |
Functions | |
void | UI_InitNodes (void) |
uiNode_t * | UI_AllocNode (const char *name, const char *type, qboolean isDynamic) |
Allocate a node into the UI memory. | |
uiNode_t * | UI_GetNodeByPath (const char *path) __attribute__((warn_unused_result)) |
Return a node by a path name (names with dot separation) It is a simplification facade over UI_ReadNodePath. | |
void | UI_ReadNodePath (const char *path, const uiNode_t *relativeNode, uiNode_t **resultNode, const value_t **resultProperty) |
Read a path and return every we can use (node and property). | |
struct uiNode_s * | UI_GetNodeAtPosition (int x, int y) __attribute__((warn_unused_result)) |
Return the first visible node at a position. | |
const char * | UI_GetPath (const uiNode_t *node) __attribute__((warn_unused_result)) |
Return a path from a window to a node. | |
struct uiNode_s * | UI_CloneNode (const struct uiNode_s *node, struct uiNode_s *newWindow, qboolean recursive, const char *newName, qboolean isDynamic) __attribute__((warn_unused_result)) |
qboolean | UI_CheckVisibility (uiNode_t *node) |
Check the if conditions for a given node. | |
void | UI_DeleteAllChild (uiNode_t *node) |
Remove all child from a node (only remove dynamic memory allocation nodes). | |
void | UI_DeleteNode (uiNode_t *node) |
uiBehaviour_t * | UI_GetNodeBehaviour (const char *name) __attribute__((warn_unused_result)) |
Return a node behaviour by name. | |
uiBehaviour_t * | UI_GetNodeBehaviourByIndex (int index) __attribute__((warn_unused_result)) |
int | UI_GetNodeBehaviourCount (void) __attribute__((warn_unused_result)) |
struct value_s * | UI_GetPropertyFromBehaviour (const uiBehaviour_t *behaviour, const char *name) __attribute__((warn_unused_result)) |
Get a property from a behaviour or his inheritance. |
Definition in file ui_nodes.h.
#define UI_EXTRADATA | ( | NODE, | |||
TYPE | ) | (*UI_EXTRADATA_POINTER(NODE, TYPE)) |
Definition at line 118 of file ui_nodes.h.
#define UI_EXTRADATA_OFFSETOF | ( | TYPE, | |||
MEMBER | ) | ((size_t) &((TYPE *)(UI_EXTRADATA_POINTER(0, TYPE)))->MEMBER) |
Return the offset of an extradata node attribute.
TYPE | Extradata type | |
MEMBER | Attribute name |
Definition at line 128 of file ui_nodes.h.
#define UI_EXTRADATA_POINTER | ( | NODE, | |||
TYPE | ) | ((TYPE*)((char*)NODE + sizeof(uiNode_t))) |
Return extradata structure from a node.
TYPE | Extradata type | |
NODE | Pointer to the node |
Definition at line 117 of file ui_nodes.h.
#define UI_EXTRADATACONST | ( | NODE, | |||
TYPE | ) | (*UI_EXTRADATACONST_POINTER(NODE, const TYPE)) |
Definition at line 120 of file ui_nodes.h.
#define UI_EXTRADATACONST_POINTER | ( | NODE, | |||
TYPE | ) | ((TYPE*)((const char*)NODE + sizeof(uiNode_t))) |
Definition at line 119 of file ui_nodes.h.
#define UI_MAX_EXLUDERECTS 64 |
Definition at line 40 of file ui_nodes.h.
Referenced by UI_ParseExcludeRect().
typedef struct uiBehaviour_s uiBehaviour_t |
node behaviour, how a node work
typedef struct uiExcludeRect_s uiExcludeRect_t |
typedef void(* uiNodeMethod_t)(struct uiNode_s *node, const struct uiCallContext_s *context) |
Definition at line 46 of file ui_nodes.h.
Allocate a node into the UI memory.
[in] | name | Name of the new node, else NULL if we dont want to edit it. |
[in] | type | Name of the node behavior |
[in] | isDynamic | Allocate a node in static or dynamic memory |
Definition at line 376 of file ui_nodes.c.
References uiNode_s::behaviour, uiNode_s::dynamic, uiBehaviour_s::new, and UI_AllocNodeWithoutNew().
Referenced by UI_AbstractNodeCallCreateChild(), UI_AddOption(), UI_ConFuncNodeLoaded(), UI_ParseNode(), UI_ParseWindow(), and UI_WindowNodeLoaded().
Check the if conditions for a given node.
Definition at line 167 of file ui_nodes.c.
References qfalse, qtrue, uiCallContext_s::source, UI_GetBooleanFromExpression(), uiCallContext_s::useCmdParam, and uiNode_s::visibilityCondition.
Referenced by UI_CheckMouseMove(), UI_DrawModelNode(), UI_DrawNode(), and UI_GetNodeInTreeAtPosition().
struct uiNode_s* UI_CloneNode | ( | const struct uiNode_s * | node, | |
struct uiNode_s * | newWindow, | |||
qboolean | recursive, | |||
const char * | newName, | |||
qboolean | isDynamic | |||
) | [read] |
void UI_DeleteAllChild | ( | uiNode_t * | node | ) |
Remove all child from a node (only remove dynamic memory allocation nodes).
node | The node we want to clean |
Definition at line 529 of file ui_nodes.c.
References uiNode_s::firstChild, uiNode_s::next, next, and UI_DeleteNode().
Referenced by UI_AbstractNodeCallRemovaAllChild(), and UI_DeleteNode().
void UI_DeleteNode | ( | uiNode_t * | node | ) |
Delete the node and remove it from his parent
node | The node we want to delete |
Definition at line 544 of file ui_nodes.c.
References uiNode_s::behaviour, byte, Com_Printf(), uiBehaviour_s::delete, uiNode_s::dynamic, uiNode_s::firstChild, uiNode_s::parent, uiBehaviour_s::properties, uiBehaviour_s::super, UI_DeleteAllChild(), UI_FreeStringProperty(), UI_GetPath(), UI_RemoveNode(), V_UI_CVAR, and V_UI_MASK.
Referenced by UI_AbstractNodeCallDelete(), UI_DeleteAllChild(), and UI_DeleteOption().
struct uiNode_s* UI_GetNodeAtPosition | ( | int | x, | |
int | y | |||
) | [read] |
Return the first visible node at a position.
Definition at line 458 of file ui_nodes.c.
References pos, UI_GetNodeInTreeAtPosition(), ui_global, UI_Validate(), UI_WindowIsDropDown(), UI_WindowIsFullScreen(), UI_WindowIsModal(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_DNDMouseMove(), UI_EditorNodeDrawOverWindow(), UI_EditorNodeMouseDown(), and UI_MouseMove().
uiBehaviour_t* UI_GetNodeBehaviour | ( | const char * | name | ) |
Return a node behaviour by name.
[in] | name | Behaviour name requested |
Definition at line 492 of file ui_nodes.c.
References NUMBER_OF_BEHAVIOURS.
Referenced by UI_AllocNodeWithoutNew(), UI_InitializeNodeBehaviour(), UI_ParseNode(), and UI_Shutdown().
uiBehaviour_t* UI_GetNodeBehaviourByIndex | ( | int | index | ) |
Definition at line 515 of file ui_nodes.c.
int UI_GetNodeBehaviourCount | ( | void | ) |
Definition at line 520 of file ui_nodes.c.
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.
// get keylist node from options_keys node from options window node = UI_GetNodeByPath("options.options_keys.keylist"); @sa UI_ReadNodePath
FIXME warning if it return a peroperty
Definition at line 304 of file ui_nodes.c.
References UI_ReadNodePath().
Referenced by CL_NationStatsUpdate_f(), GAME_CP_CampaignListClick_f(), UI_ActiveVScrollbarNode_f(), UI_AddListener_f(), UI_FireInit_f(), UI_PushDropDownWindow_f(), UI_RemoveListener_f(), and UI_TextScrollEnd().
const char* UI_GetPath | ( | const uiNode_t * | node | ) |
Return a path from a window to a node.
Definition at line 182 of file ui_nodes.c.
References i, MAX_VAR, name, uiNode_s::parent, and Q_strcat().
Referenced by Key_WriteBindings(), UI_AbstractOptionGetCurrentValue(), UI_AddListener(), UI_ButtonNodeLoaded(), UI_ColumnLayout(), UI_ConFuncNodeLoaded(), UI_DeleteNode(), UI_ExecuteCallAction(), UI_ExecuteSetAction(), UI_FuncNodeLoaded(), UI_GenInjectedString(), UI_GetFloatFromNodeProperty(), UI_GetNodeAbsPos(), UI_GetNodeFromExpression(), UI_GetStringFromNodeProperty(), UI_ImageNodeLoaded(), UI_InitRawActionValue(), UI_LineChartNodeDraw(), UI_ModelNodeLoaded(), UI_NodeSetProperty(), UI_NodeSetPropertyFromRAW(), UI_PanelNodeLoaded(), UI_ParseActionList(), UI_ParseCallAction(), UI_ParseEventProperty(), UI_ParseExcludeRect(), UI_ParseNode(), UI_ParseNodeBody(), UI_ParseNodeProperties(), UI_ParseSetAction(), UI_RadioButtonNodeActivate(), UI_TabNodeInit(), UI_TextNodeLoaded(), UI_VScrollbarNodeLoaded(), UI_WindowNodeClone(), and UI_WindowNodeSetRenderNode().
struct value_s* UI_GetPropertyFromBehaviour | ( | const uiBehaviour_t * | behaviour, | |
const char * | name | |||
) | [read] |
Get a property from a behaviour or his inheritance.
[in] | behaviour | Context behaviour |
[in] | name | Property name we search |
Definition at line 149 of file ui_nodes.c.
References uiBehaviour_s::properties, uiBehaviour_s::super, and UI_FindPropertyByName().
Referenced by UI_ConFuncNodeClose(), UI_ConFuncNodeInit(), UI_FuncNodeLoaded(), UI_GenInjectedString(), UI_GetReferenceFloat(), UI_GetReferenceString(), UI_InitializeNodeBehaviour(), UI_PanelPropertyChanged(), UI_ParseNodeBody(), UI_ParseNodeProperties(), UI_ReadNodePath(), UI_RegisterAbstractNode(), UI_RegisterOptionNode(), and UI_RegisterPanelNode().
void UI_InitNodes | ( | void | ) |
Definition at line 752 of file ui_nodes.c.
References Com_Error(), ERR_FATAL, i, uiBehaviour_s::name, NUMBER_OF_BEHAVIOURS, registerFunctions, and UI_InitializeNodeBehaviour().
Referenced by UI_Init().
void UI_ReadNodePath | ( | const char * | path, | |
const uiNode_t * | relativeNode, | |||
uiNode_t ** | resultNode, | |||
const value_t ** | resultProperty | |||
) |
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' and 'parent' (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). |
[out] | resultNode | Node found. Else NULL. |
[out] | resultProperty | Property found. Else NULL. TODO Speed up, evilly used function, use strncmp instead of using buffer copy (name[MAX_VAR]) |
FIXME use a warning instead of an assert
Definition at line 222 of file ui_nodes.c.
References uiNode_s::behaviour, MAX_VAR, name, uiNode_s::parent, Q_strncpyz(), uiNode_s::root, UI_GetNode(), UI_GetPropertyFromBehaviour(), UI_GetWindow(), ui_windowBehaviour, and UI_WindowNodeGetIndexedChild().
Referenced by UI_AddListener_f(), UI_ExecuteCallAction(), UI_ExecuteSetAction(), UI_GenInjectedString(), UI_GetNodeByPath(), UI_GetNodeFromExpression(), UI_RemoveListener_f(), and UI_SetKeyBinding().