ui_nodes.h File Reference

#include "../../shared/ufotypes.h"
#include "../../common/scripts.h"
Include dependency graph for ui_nodes.h:
This graph shows which files directly or indirectly include this file:

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_tUI_AllocNode (const char *name, const char *type, qboolean isDynamic)
 Allocate a node into the UI memory.
uiNode_tUI_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_sUI_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_sUI_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_tUI_GetNodeBehaviour (const char *name) __attribute__((warn_unused_result))
 Return a node behaviour by name.
uiBehaviour_tUI_GetNodeBehaviourByIndex (int index) __attribute__((warn_unused_result))
int UI_GetNodeBehaviourCount (void) __attribute__((warn_unused_result))
struct value_sUI_GetPropertyFromBehaviour (const uiBehaviour_t *behaviour, const char *name) __attribute__((warn_unused_result))
 Get a property from a behaviour or his inheritance.

Detailed Description

Definition in file ui_nodes.h.


Define Documentation

#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.

Parameters:
TYPE Extradata type
MEMBER Attribute name
See also:
offsetof

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.

Parameters:
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 Documentation

typedef struct uiBehaviour_s uiBehaviour_t

node behaviour, how a node work

See also:
virtualFunctions
typedef struct uiNode_s uiNode_t

Atomic structure used to define most of the UI.

typedef void(* uiNodeMethod_t)(struct uiNode_s *node, const struct uiCallContext_s *context)

Definition at line 46 of file ui_nodes.h.


Function Documentation

uiNode_t* UI_AllocNode ( const char *  name,
const char *  type,
qboolean  isDynamic 
)

Allocate a node into the UI memory.

Note:
It's not a dynamic memory allocation. Please only use it at the loading time
Todo:
Assert out when we are not in parsing/loading stage
Parameters:
[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().

qboolean UI_CheckVisibility ( uiNode_t node  ) 

Check the if conditions for a given node.

See also:
V_UI_IF
Returns:
qfalse if the node is not drawn due to not meet if conditions

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).

Parameters:
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

Parameters:
node The node we want to delete

Todo:
We must delete all EA_LISTENER too

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]
uiBehaviour_t* UI_GetNodeBehaviour ( const char *  name  ) 

Return a node behaviour by name.

Note:
Use a dichotomic search. nodeBehaviourList must be sorted by name.
Parameters:
[in] name Behaviour name requested
Returns:
The bahaviour found, else NULL

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.

Returns:
The requested node, else NULL if not found
 // 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  ) 
struct value_s* UI_GetPropertyFromBehaviour ( const uiBehaviour_t behaviour,
const char *  name 
) [read]

Get a property from a behaviour or his inheritance.

Parameters:
[in] behaviour Context behaviour
[in] name Property name we search
Returns:
A value_t with the requested name, else NULL

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   ) 
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.

Parameters:
[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])

Todo:
find a way to fix the bad cast. only here to remove "discards qualifiers" warning

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().


Generated by  doxygen 1.6.2