UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_nodes.cpp
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
27
28#include "ui_main.h"
29#include "ui_internal.h"
30#include "ui_behaviour.h"
31#include "ui_node.h"
32#include "ui_nodes.h"
33#include "ui_parse.h"
34#include "ui_input.h"
35
40#include "node/ui_node_bar.h"
41#include "node/ui_node_base.h"
44#include "node/ui_node_button.h"
48#include "node/ui_node_data.h"
49#include "node/ui_node_editor.h"
51#include "node/ui_node_image.h"
52#include "node/ui_node_item.h"
56#include "node/ui_node_model.h"
57#include "node/ui_node_option.h"
60#include "node/ui_node_panel.h"
61#include "node/ui_node_radar.h"
63#include "node/ui_node_rows.h"
66#include "node/ui_node_string.h"
69#include "node/ui_node_tab.h"
70#include "node/ui_node_tbar.h"
71#include "node/ui_node_text.h"
72#include "node/ui_node_text2.h"
76#include "node/ui_node_timer.h"
77#include "node/ui_node_video.h"
79#include "node/ui_node_zone.h"
80
81#include "ui_lua.h"
82
84
140#define NUMBER_OF_BEHAVIOURS lengthof(registerFunctions)
141
146
153{
154 bool result = true;
155 /* old script check */
156 if (node->visibilityCondition != nullptr) {
157 uiCallContext_t context;
158 context.source = node;
159 context.useCmdParam = false;
160 result = UI_GetBooleanFromExpression(node->visibilityCondition, &context);
161 }
162 /* lua script check */
163 else if (node->lua_onVisibleWhen != LUA_NOREF) {
165 }
166 return result;
167}
168
174const char* UI_GetPath (const uiNode_t* node)
175{
176 static char result[512];
177 const uiNode_t* nodes[8];
178 int i = 0;
179
180 while (node) {
181 assert(i < 8);
182 nodes[i] = node;
183 node = node->parent;
184 i++;
185 }
186
188 result[0] = '\0';
189 while (i) {
190 i--;
191 Q_strcat(result, sizeof(result), "%s", nodes[i]->name);
192 if (i > 0)
193 Q_strcat(result, sizeof(result), ".");
194 }
195
196 return result;
197}
198
219void UI_ReadNodePath (const char* path, const uiNode_t* relativeNode, const uiNode_t* iterationNode, uiNode_t** resultNode, const value_t** resultProperty, value_t *luaMethod) {
220 char name[MAX_VAR];
221 uiNode_t* node = nullptr;
222 uiNode_t* childnode = nullptr;
223 const char* nextName;
224 char nextCommand = '^';
225
226 *resultNode = nullptr;
227 if (resultProperty)
228 *resultProperty = nullptr;
229
230 nextName = path;
231 while (nextName && nextName[0] != '\0') {
232 const char* begin = nextName;
233 char command = nextCommand;
234 nextName = strpbrk(begin, ".@#");
235 if (!nextName) {
236 Q_strncpyz(name, begin, sizeof(name));
237 nextCommand = '\0';
238 } else {
239 assert(nextName - begin + 1 <= sizeof(name));
240 Q_strncpyz(name, begin, nextName - begin + 1);
241 nextCommand = *nextName;
242 nextName++;
243 }
244
245 switch (command) {
246 case '^': /* first string */
247 if (Q_streq(name, "this")) {
248 if (relativeNode == nullptr)
249 return;
250 node = const_cast<uiNode_t *>(relativeNode);
251 } else if (Q_streq(name, "parent")) {
252 if (relativeNode == nullptr)
253 return;
254 node = relativeNode->parent;
255 } else if (Q_streq(name, "root")) {
256 if (relativeNode == nullptr)
257 return;
258 node = relativeNode->root;
259 } else if (Q_streq(name, "child")) {
260 if (iterationNode == nullptr)
261 return;
262 node = const_cast<uiNode_t *>(iterationNode);
263 } else
264 node = UI_GetWindow(name);
265 break;
266 case '.': /* child node */
267 if (Q_streq(name, "parent"))
268 childnode = node->parent;
269 else if (Q_streq(name, "root"))
270 childnode = node->root;
271 else {
272 childnode = UI_GetNode(node, name);
273 /* if no node found and if we need it, then it is possible we call a lua based function */
274 if (luaMethod && !childnode) {
275 *resultProperty = UI_GetPropertyOrLuaMethod(node, name, luaMethod);
276 if (luaMethod->type) {
277 childnode = node;
278 }
279 }
280 }
281 node = childnode;
282 break;
283 case '#': /* window index */
285 assert(UI_Node_IsWindow(node));
287 break;
288 case '@': /* property */
289 assert(nextCommand == '\0');
290 *resultProperty = UI_GetPropertyOrLuaMethod(node, name, luaMethod);
291 *resultNode = node;
292 return;
293 }
294
295 if (!node)
296 return;
297 }
298
299 *resultNode = node;
300 return;
301}
302
313uiNode_t* UI_GetNodeByPath (const char* path)
314{
315 uiNode_t* node = nullptr;
316 const value_t* property = nullptr;
317 UI_ReadNodePath(path, nullptr, nullptr, &node, &property);
318 if (property) {
319 Com_Printf("WARNING: Search for node using path [%s] returns property [%s]\n", path, property->string);
320 }
321 return node;
322}
323
332static uiNode_t* UI_AllocNodeWithoutNew (const char* name, const char* type, bool isDynamic)
333{
334 uiNode_t* node;
335 uiBehaviour_t* behaviour;
336 int nodeSize;
337
338 behaviour = UI_GetNodeBehaviour(type);
339 if (behaviour == nullptr)
340 Com_Error(ERR_FATAL, "UI_AllocNodeWithoutNew: Node behaviour '%s' doesn't exist", type);
341
342 nodeSize = sizeof(*node) + behaviour->extraDataSize;
343
344 if (!isDynamic) {
345 void* memory = UI_AllocHunkMemory(nodeSize, STRUCT_MEMORY_ALIGN, true);
346 if (memory == nullptr)
347 Com_Error(ERR_FATAL, "UI_AllocNodeWithoutNew: No more memory to allocate a new node - increase the cvar ui_hunksize");
348 node = static_cast<uiNode_t*>(memory);
349 ui_global.numNodes++;
350 } else {
351 node = static_cast<uiNode_t*>(Mem_PoolAlloc(nodeSize, ui_dynPool, 0));
352 node->dynamic = true;
353 }
354
355 node->behaviour = behaviour;
356#ifdef DEBUG
357 UI_Node_DebugCountWidget(node, 1);
358#endif
359 if (UI_Node_IsAbstract(node))
360 Com_Error(ERR_FATAL, "UI_AllocNodeWithoutNew: Node behavior '%s' is abstract. We can't instantiate it.", type);
361
362 if (name != nullptr) {
363 Q_strncpyz(node->name, name, sizeof(node->name));
364 if (strlen(node->name) != strlen(name))
365 Com_Printf("UI_AllocNodeWithoutNew: Node name \"%s\" truncated. New name is \"%s\"\n", name, node->name);
366 }
367
368 return node;
369}
370
381uiNode_t* UI_AllocNode (const char* name, const char* type, bool isDynamic)
382{
383 uiNode_t* node = UI_AllocNodeWithoutNew(name, type, isDynamic);
384
385 /* default initializtion */
386 UI_Node_InitNode(node);
387
388 /* allocate memory */
389 if (node->dynamic) {
391 }
392
393 /* initialize default properties */
394 UI_Node_Loading(node);
395
396 return node;
397}
398
409uiNode_t* UI_CloneNode (const uiNode_t* node, uiNode_t* newWindow, bool recursive, const char* newName, bool isDynamic)
410{
411 uiNode_t* newNode = UI_AllocNodeWithoutNew(nullptr, UI_Node_GetWidgetName(node), isDynamic);
412
413 /* clone all data */
414 memcpy(newNode, node, UI_Node_GetMemorySize(node));
415 newNode->dynamic = isDynamic;
416
417 /* custom name */
418 if (newName != nullptr) {
419 Q_strncpyz(newNode->name, newName, sizeof(newNode->name));
420 if (strlen(newNode->name) != strlen(newName))
421 Com_Printf("UI_CloneNode: Node name \"%s\" truncated. New name is \"%s\"\n", newName, newNode->name);
422 }
423
424 /* clean up node navigation */
425 if (node->root == node && newWindow == nullptr)
426 newWindow = newNode;
427
428 newNode->root = newWindow;
429 newNode->parent = nullptr;
430 newNode->firstChild = nullptr;
431 newNode->lastChild = nullptr;
432 newNode->next = nullptr;
433 newNode->super = node;
434
435 /* clone node methods */
436 if (node->nodeMethods) {
437 newNode->nodeMethods = HASH_CloneTable(node->nodeMethods);
438 }
439
440 /* allocate memories */
441 if (newNode->dynamic) {
443 }
444
445 /* typically, cloning makes a copy of all the internals of a source node; override the ::clone(node) method
446 to alter this behaviour */
447 UI_Node_Clone(node, newNode);
448
449 /* clone child */
450 if (recursive) {
451 for (uiNode_t* childNode = node->firstChild; childNode; childNode = childNode->next) {
452 uiNode_t* newChildNode = UI_CloneNode(childNode, newWindow, recursive, nullptr, isDynamic);
453 UI_AppendNode(newNode, newChildNode);
454 }
455 }
456
457 return newNode;
458}
459
467static uiNode_t* UI_GetNodeInTreeAtPosition (uiNode_t* node, int rx, int ry)
468{
469 if (node->invis || UI_Node_IsVirtual(node) || !UI_CheckVisibility(node))
470 return nullptr;
471
472 /* relative to the node */
473 rx -= node->box.pos[0];
474 ry -= node->box.pos[1];
475
476 /* check bounding box */
477 if (rx < 0 || ry < 0 || rx >= node->box.size[0] || ry >= node->box.size[1])
478 return nullptr;
479
481 uiNode_t* find = nullptr;
482 if (node->firstChild) {
483 vec2_t clientPosition = {0, 0};
484
486 UI_Node_GetClientPosition(node, clientPosition);
487
488 rx -= clientPosition[0];
489 ry -= clientPosition[1];
490
491 for (uiNode_t* child = node->firstChild; child; child = child->next) {
492 uiNode_t* tmp;
493 tmp = UI_GetNodeInTreeAtPosition(child, rx, ry);
494 if (tmp)
495 find = tmp;
496 }
497
498 rx += clientPosition[0];
499 ry += clientPosition[1];
500 }
501 if (find)
502 return find;
503
504 /* disable ghost/excluderect in debug mode 2 */
505 if (UI_DebugMode() != 2) {
506 /* is the node tangible */
507 if (node->ghost)
508 return nullptr;
509
510 /* check excluded box */
511 for (uiExcludeRect_t* excludeRect = node->firstExcludeRect; excludeRect != nullptr; excludeRect = excludeRect->next) {
512 if (rx >= excludeRect->pos[0]
513 && rx < excludeRect->pos[0] + excludeRect->size[0]
514 && ry >= excludeRect->pos[1]
515 && ry < excludeRect->pos[1] + excludeRect->size[1])
516 return nullptr;
517 }
518 }
519
520 /* we are over the node */
521 return node;
522}
523
528{
529 /* find the first window under the mouse */
530 for (int pos = ui_global.windowStackPos - 1; pos >= 0; pos--) {
531 uiNode_t* window = ui_global.windowStack[pos];
532 uiNode_t* find;
533
534 /* update the layout */
535 UI_Validate(window);
536
537 find = UI_GetNodeInTreeAtPosition(window, x, y);
538 if (find)
539 return find;
540
541 /* we must not search anymore */
542 if (UI_WindowIsDropDown(window))
543 break;
544 if (UI_WindowIsModal(window))
545 break;
546 if (UI_WindowIsFullScreen(window))
547 break;
548 }
549
550 return nullptr;
551}
552
560{
561 unsigned char min = 0;
562 unsigned char max = NUMBER_OF_BEHAVIOURS;
563
564 while (min != max) {
565 const int mid = (min + max) >> 1;
566 const int diff = strcmp(nodeBehaviourList[mid].name, name);
567 assert(mid < max);
568 assert(mid >= min);
569
570 if (diff == 0)
571 return &nodeBehaviourList[mid];
572
573 if (diff > 0)
574 max = mid;
575 else
576 min = mid + 1;
577 }
578
579 return nullptr;
580}
581
586
588{
590}
591
597{
598 uiNode_t* child;
599 child = node->firstChild;
600 while (child) {
601 uiNode_t* next = child->next;
602 UI_DeleteNode(child);
603 child = next;
604 }
605}
606
607static void UI_BeforeDeletingNode (const uiNode_t* node)
608{
609 if (UI_GetHoveredNode() == node) {
611 }
612}
613
619{
620 if (!node->dynamic) {
621 Com_Printf("UI_DeleteNode: Can't delete the static node '%s'\n", UI_GetPath(node));
622 return;
623 }
624
626
627 UI_DeleteAllChild(node);
628 if (node->firstChild != nullptr) {
629 Com_Printf("UI_DeleteNode: Node '%s' contain static nodes. We can't delete it.\n", UI_GetPath(node));
630 return;
631 }
632
633 if (node->parent)
634 UI_RemoveNode(node->parent, node);
635
636 /* delete all allocated properties */
637 for (uiBehaviour_t* behaviour = node->behaviour; behaviour; behaviour = behaviour->super) {
638 const value_t** property = behaviour->localProperties;
639 if (property == nullptr)
640 continue;
641 while (*property) {
642 if (((*property)->type & V_UI_MASK) == V_UI_CVAR) {
643 if (void*& mem = Com_GetValue<void*>(node, *property)) {
645 mem = 0;
646 }
647 }
648
650
651 property++;
652 }
653 }
654
655 UI_Node_DeleteNode(node);
656}
657
658void UI_InitNodes (void)
659{
660 int i = 0;
662
663 /* compute list of node behaviours */
664 for (i = 0; i < NUMBER_OF_BEHAVIOURS; i++) {
665 OBJZERO(*current);
666 current->registration = true;
667 registerFunctions[i](current);
668 current->registration = false;
669 current++;
670 }
671
672 /* @todo This check for a-z sortable behaviour list can be entirely within debug */
673 /* check for safe data: list must be sorted by alphabet */
674 current = nodeBehaviourList;
675 assert(current);
676 for (i = 0; i < NUMBER_OF_BEHAVIOURS - 1; i++) {
677 const uiBehaviour_t* a = current;
678 const uiBehaviour_t* b = current + 1;
679 assert(b);
680 if (strcmp(a->name, b->name) >= 0) {
681#ifdef DEBUG
682 Com_Error(ERR_FATAL, "UI_InitNodes: '%s' is before '%s'. Please order node behaviour registrations by name", a->name, b->name);
683#else
684 Com_Error(ERR_FATAL, "UI_InitNodes: Error: '%s' is before '%s'", a->name, b->name);
685#endif
686 }
687 current++;
688 }
689
690 /* finalize node behaviour initialization */
691 current = nodeBehaviourList;
692 for (i = 0; i < NUMBER_OF_BEHAVIOURS; i++) {
694 current++;
695 }
696}
697
698void uiBox_t::alignBox (uiBox_t& inner, align_t direction)
699{
700 switch (direction % 3) {
701 case 0: /* left */
702 inner.pos[0] = this->pos[0];
703 break;
704 case 1: /* middle */
705 inner.pos[0] = this->pos[0] + (this->size[0] * 0.5) - (inner.size[0] * 0.5);
706 break;
707 case 2: /* right */
708 inner.pos[0] = this->pos[0] + this->size[0] - inner.size[0];
709 break;
710 }
711 switch (direction / 3) {
712 case 0: /* top */
713 inner.pos[1] = this->pos[1];
714 break;
715 case 1: /* middle */
716 inner.pos[1] = this->pos[1] + (this->size[1] * 0.5) - (inner.size[1] * 0.5);
717 break;
718 case 2: /* bottom */
719 inner.pos[1] = this->pos[1] + this->size[1] - inner.size[1];
720 break;
721 default:
722 inner.pos[1] = this->pos[1];
723 Com_Error(ERR_FATAL, "UI_ImageAlignBoxInBox: Align %d not supported\n", direction);
724 }
725}
void Com_Error(int code, const char *fmt,...)
Definition common.cpp:459
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
#define ERR_FATAL
Definition common.h:210
hashTable_s * HASH_CloneTable(hashTable_s *source)
Header file for hashtable.
#define Mem_PoolAlloc(size, pool, tagNum)
Definition mem.h:41
QGL_EXTERN void(APIENTRY *qglActiveTexture)(GLenum texture)
QGL_EXTERN GLuint index
Definition r_gl.h:110
QGL_EXTERN GLint i
Definition r_gl.h:113
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
align_t
We need this here for checking the boundaries from script values.
Definition scripts.h:89
T & Com_GetValue(void *const object, value_t const *const value)
Definition scripts.h:174
Header for lua script functions.
#define Q_streq(a, b)
Definition shared.h:136
#define OBJZERO(obj)
Definition shared.h:178
#define MAX_VAR
Definition shared.h:36
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
Definition shared.cpp:457
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
Definition shared.cpp:475
node behaviour, how a node work
const char * name
uiBehaviour_t * super
intptr_t extraDataSize
void alignBox(uiBox_t &inner, align_t direction)
Definition ui_nodes.cpp:698
vec2_t size
Definition ui_nodes.h:52
vec2_t pos
Definition ui_nodes.h:51
Contain the context of the calling of a function.
Definition ui_actions.h:208
uiNode_t * source
Definition ui_actions.h:210
struct uiExcludeRect_s * next
Definition ui_nodes.h:47
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
struct uiAction_s * visibilityCondition
Definition ui_nodes.h:112
uiNode_t const * super
Definition ui_nodes.h:84
uiNode_t * firstChild
Definition ui_nodes.h:89
bool invis
Definition ui_nodes.h:101
uiNode_t * next
Definition ui_nodes.h:91
LUA_EVENT lua_onVisibleWhen
Definition ui_nodes.h:163
uiNode_t * lastChild
Definition ui_nodes.h:90
bool ghost
Definition ui_nodes.h:105
uiBehaviour_t * behaviour
Definition ui_nodes.h:83
uiExcludeRect_t * firstExcludeRect
Definition ui_nodes.h:116
uiNode_t * parent
Definition ui_nodes.h:92
bool dynamic
Definition ui_nodes.h:85
hashTable_s * nodeMethods
Definition ui_nodes.h:132
uiBox_t box
Definition ui_nodes.h:96
char name[MAX_VAR]
Definition ui_nodes.h:82
uiNode_t * root
Definition ui_nodes.h:93
valueTypes_t type
Definition scripts.h:169
vec_t vec2_t[2]
Definition ufotypes.h:38
void UI_FreeStringProperty(void *pointer)
Free a string property if it is allocated into ui_dynStringPool.
const value_t * UI_GetPropertyOrLuaMethod(const uiNode_t *node, const char *name, value_t *out)
Get a property or lua based method from a node, node behaviour or inherted behaviour.
void UI_InitializeNodeBehaviour(uiBehaviour_t *behaviour)
Initialize a node behaviour memory, after registration, and before using it.
bool UI_GetBooleanFromExpression(uiAction_t *expression, const uiCallContext_t *context)
Check if an expression is true.
uiNode_t * UI_GetHoveredNode(void)
Get the current hovered node.
Definition ui_input.cpp:552
void UI_InvalidateMouse(void)
Force to invalidate the mouse position and then to update hover nodes...
Definition ui_input.cpp:560
Internal data use by the UI package.
void * UI_AllocHunkMemory(size_t size, int align, bool reset)
Definition ui_main.cpp:126
memPool_t * ui_dynPool
Definition ui_main.cpp:41
uiGlobal_t ui_global
Definition ui_main.cpp:38
#define STRUCT_MEMORY_ALIGN
bool UI_ExecuteLuaEventScript_ReturnBool(uiNode_t *node, LUA_EVENT event, bool &result)
Executes a lua event handler and returns the result as a boolean.
Definition ui_lua.cpp:116
Basic lua initialization for the ui.
int UI_DebugMode(void)
Get the current debug mode (0 mean disabled).
Definition ui_main.cpp:52
void UI_Validate(uiNode_t *node)
Validate a node tree.
Definition ui_node.cpp:1078
bool UI_Node_IsVirtual(uiNode_t const *node)
Definition ui_node.cpp:42
void UI_Node_Clone(uiNode_t const *source, uiNode_t *clone)
Definition ui_node.cpp:220
const char * UI_Node_GetWidgetName(uiNode_t const *node)
Definition ui_node.cpp:99
void UI_Node_DeleteNode(uiNode_t *node)
Definition ui_node.cpp:237
void UI_Node_InitNodeDynamic(uiNode_t *node)
Definition ui_node.cpp:226
void UI_Node_GetClientPosition(uiNode_t const *node, vec2_t position)
Definition ui_node.cpp:295
uiNode_t * UI_RemoveNode(uiNode_t *const node, uiNode_t *child)
Remove a node from a parent node.
Definition ui_node.cpp:802
void UI_Node_Loading(uiNode_t *node)
Definition ui_node.cpp:208
bool UI_Node_IsAbstract(uiNode_t const *node)
Definition ui_node.cpp:72
bool UI_Node_IsScrollableContainer(uiNode_t const *node)
Definition ui_node.cpp:93
bool UI_Node_IsWindow(uiNode_t const *node)
Definition ui_node.cpp:60
void UI_AppendNode(uiNode_t *const parent, uiNode_t *newNode)
add a node at the end of the node child
Definition ui_node.cpp:868
uiNode_t * UI_GetNode(const uiNode_t *node, const char *name)
Search a child node by given name.
Definition ui_node.cpp:714
intptr_t UI_Node_GetMemorySize(uiNode_t const *node)
Definition ui_node.cpp:104
void UI_Node_InitNode(uiNode_t *node)
Definition ui_node.cpp:231
C interface to allow to access to cpp node code.
void UI_RegisterAbstractNode(uiBehaviour_t *behaviour)
void UI_RegisterAbstractOptionNode(uiBehaviour_t *behaviour)
void UI_RegisterAbstractScrollableNode(uiBehaviour_t *behaviour)
void UI_RegisterAbstractScrollbarNode(uiBehaviour_t *behaviour)
void UI_RegisterAbstractValueNode(uiBehaviour_t *behaviour)
Define common thing for GUI controls which allow to edit a value (scroolbar, spinner,...
void UI_RegisterBarNode(uiBehaviour_t *behaviour)
void UI_RegisterBaseLayoutNode(uiBehaviour_t *behaviour)
void UI_RegisterBaseInventoryNode(uiBehaviour_t *behaviour)
void UI_RegisterBattlescapeNode(uiBehaviour_t *behaviour)
void UI_RegisterButtonNode(uiBehaviour_t *behaviour)
void UI_RegisterCheckBoxNode(uiBehaviour_t *behaviour)
void UI_RegisterContainerNode(uiBehaviour_t *behaviour)
void UI_RegisterControlsNode(uiBehaviour_t *behaviour)
void UI_RegisterDataNode(uiBehaviour_t *behaviour)
void UI_RegisterEditorNode(uiBehaviour_t *behaviour)
void UI_RegisterGeoscapeNode(uiBehaviour_t *behaviour)
void UI_RegisterImageNode(uiBehaviour_t *behaviour)
void UI_RegisterItemNode(uiBehaviour_t *behaviour)
void UI_RegisterLineChartNode(uiBehaviour_t *behaviour)
Registers lineChart node.
void UI_RegisterMaterialEditorNode(uiBehaviour_t *behaviour)
Material editor related header.
void UI_RegisterMessageListNode(uiBehaviour_t *behaviour)
void UI_RegisterModelNode(uiBehaviour_t *behaviour)
void UI_RegisterOptionNode(uiBehaviour_t *behaviour)
void UI_RegisterOptionListNode(uiBehaviour_t *behaviour)
void UI_RegisterOptionTreeNode(uiBehaviour_t *behaviour)
void UI_RegisterPanelNode(uiBehaviour_t *behaviour)
void UI_RegisterRadarNode(uiBehaviour_t *behaviour)
void UI_RegisterRadioButtonNode(uiBehaviour_t *behaviour)
void UI_RegisterRowsNode(uiBehaviour_t *behaviour)
void UI_RegisterSelectBoxNode(uiBehaviour_t *behaviour)
void UI_RegisterSequenceNode(uiBehaviour_t *behaviour)
void UI_RegisterNullNode(uiBehaviour_t *behaviour)
void UI_RegisterCvarFuncNode(uiBehaviour_t *behaviour)
void UI_RegisterFuncNode(uiBehaviour_t *behaviour)
void UI_RegisterConFuncNode(uiBehaviour_t *behaviour)
void UI_RegisterSpinnerNode(uiBehaviour_t *behaviour)
void UI_RegisterStringNode(uiBehaviour_t *behaviour)
void UI_RegisterTabNode(uiBehaviour_t *behaviour)
void UI_RegisterTBarNode(uiBehaviour_t *behaviour)
void UI_RegisterText2Node(uiBehaviour_t *behaviour)
void UI_RegisterTextNode(uiBehaviour_t *behaviour)
void UI_RegisterTextEntryNode(uiBehaviour_t *behaviour)
void UI_RegisterTextListNode(uiBehaviour_t *behaviour)
void UI_RegisterTextureNode(uiBehaviour_t *behaviour)
void UI_RegisterTimerNode(uiBehaviour_t *behaviour)
void UI_RegisterVideoNode(uiBehaviour_t *behaviour)
void UI_RegisterVScrollbarNode(uiBehaviour_t *behaviour)
void UI_RegisterWindowNode(uiBehaviour_t *behaviour)
bool UI_WindowIsModal(uiNode_t const *const node)
True if the window is a modal.
bool UI_WindowIsFullScreen(const uiNode_t *const node)
Check if a window is fullscreen or not.
bool UI_WindowIsDropDown(uiNode_t const *const node)
True if the window is a drop down.
uiNode_t * UI_WindowNodeGetIndexedChild(uiNode_t *const node, const char *childName)
Get a node from child index.
void UI_RegisterZoneNode(uiBehaviour_t *behaviour)
int UI_GetNodeBehaviourCount(void)
Definition ui_nodes.cpp:587
bool UI_CheckVisibility(uiNode_t *node)
Check the if conditions for a given node.
Definition ui_nodes.cpp:152
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_ReadNo...
Definition ui_nodes.cpp:313
void UI_InitNodes(void)
Definition ui_nodes.cpp:658
static void UI_BeforeDeletingNode(const uiNode_t *node)
Definition ui_nodes.cpp:607
uiBehaviour_t * UI_GetNodeBehaviour(const char *name)
Return a node behaviour by name.
Definition ui_nodes.cpp:559
uiNode_t * UI_AllocNode(const char *name, const char *type, bool isDynamic)
Allocate a node into the UI memory.
Definition ui_nodes.cpp:381
void UI_DeleteAllChild(uiNode_t *node)
Remove all child from a node (only remove dynamic memory allocation nodes).
Definition ui_nodes.cpp:596
static uiBehaviour_t nodeBehaviourList[NUMBER_OF_BEHAVIOURS]
List of all node behaviours, indexes by nodetype num.
Definition ui_nodes.cpp:145
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).
Definition ui_nodes.cpp:332
static const registerFunction_t registerFunctions[]
List of functions to register nodes.
Definition ui_nodes.cpp:89
void(* registerFunction_t)(uiBehaviour_t *node)
Definition ui_nodes.cpp:83
uiNode_t * UI_CloneNode(const uiNode_t *node, uiNode_t *newWindow, bool recursive, const char *newName, bool isDynamic)
Clone a node.
Definition ui_nodes.cpp:409
const char * UI_GetPath(const uiNode_t *node)
Return a path from a window to a node.
Definition ui_nodes.cpp:174
static uiNode_t * UI_GetNodeInTreeAtPosition(uiNode_t *node, int rx, int ry)
Return the first visible node at a position.
Definition ui_nodes.cpp:467
uiBehaviour_t * UI_GetNodeBehaviourByIndex(int index)
Definition ui_nodes.cpp:582
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).
Definition ui_nodes.cpp:219
void UI_DeleteNode(uiNode_t *node)
Definition ui_nodes.cpp:618
uiNode_t * UI_GetNodeAtPosition(int x, int y)
Return the first visible node at a position.
Definition ui_nodes.cpp:527
#define NUMBER_OF_BEHAVIOURS
Definition ui_nodes.cpp:140
#define V_UI_CVAR
Definition ui_parse.h:59
#define V_UI_MASK
Definition ui_parse.h:51
uiNode_t * UI_GetWindow(const char *name)
Searches all windows for the specified one.