UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node.h
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#pragma once
27
28/* prototype */
29struct uiNode_t;
30
31bool UI_Node_IsVirtual (uiNode_t const* node);
32bool UI_Node_IsDrawable (uiNode_t const* node);
33bool UI_Node_IsAbstract (uiNode_t const* node);
34bool UI_Node_IsFunction (uiNode_t const* node);
35bool UI_Node_IsWindow (uiNode_t const* node);
36bool UI_Node_IsOptionContainer (uiNode_t const* node);
37bool UI_Node_IsBattleScape (uiNode_t const* node);
39bool UI_Node_IsDrawItselfChild (uiNode_t const* node);
40bool UI_Node_IsDisabled (uiNode_t const* node);
41bool UI_Node_IsInvisible (uiNode_t const* node);
42bool UI_Node_IsGhost (uiNode_t const* node);
43bool UI_Node_IsFlashing (uiNode_t const* node);
44
45const char* UI_Node_GetWidgetName (uiNode_t const* node);
46intptr_t UI_Node_GetMemorySize (uiNode_t const* node);
47
48void UI_Node_Draw (uiNode_t* node);
49void UI_Node_DrawTooltip (const uiNode_t* node, int x, int y);
51void UI_Node_LeftClick (uiNode_t* node, int x, int y);
52void UI_Node_RightClick (uiNode_t* node, int x, int y);
53void UI_Node_MiddleClick (uiNode_t* node, int x, int y);
54bool UI_Node_Scroll (uiNode_t* node, int deltaX, int deltaY);
55void UI_Node_MouseMove (uiNode_t* node, int x, int y);
56void UI_Node_MouseDown (uiNode_t* node, int x, int y, int button);
57void UI_Node_MouseUp (uiNode_t* node, int x, int y, int button);
58bool UI_Node_MouseLongPress (uiNode_t* node, int x, int y, int button);
59void UI_Node_MouseEnter (uiNode_t* node);
60void UI_Node_MouseLeave (uiNode_t* node);
61bool UI_Node_StartDragging (uiNode_t* node, int startX, int startY, int currentX, int currentY, int button);
62void UI_Node_CapturedMouseMove (uiNode_t* node, int x, int y);
64void UI_Node_Loading (uiNode_t* node);
65void UI_Node_Loaded (uiNode_t* node);
66void UI_Node_Clone (uiNode_t const* source, uiNode_t* clone);
67void UI_Node_InitNode (uiNode_t* node);
69void UI_Node_DeleteNode (uiNode_t* node);
70void UI_Node_WindowOpened (uiNode_t* node, linkedList_t* params);
73void UI_Node_DoLayout (uiNode_t* node);
74void UI_Node_Activate (uiNode_t* node);
75void UI_Node_PropertyChanged (uiNode_t* node, const value_t* property);
76void UI_Node_PosChanged (uiNode_t* node);
77void UI_Node_SizeChanged (uiNode_t* node);
78void UI_Node_GetClientPosition (uiNode_t const* node, vec2_t position);
79bool UI_Node_DndEnter (uiNode_t* node);
80bool UI_Node_DndMove (uiNode_t* node, int x, int y);
81void UI_Node_DndLeave (uiNode_t* node);
82bool UI_Node_DndDrop (uiNode_t* node, int x, int y);
83bool UI_Node_DndFinished (uiNode_t* node, bool isDroped);
84void UI_Node_FocusGained (uiNode_t* node);
85void UI_Node_FocusLost (uiNode_t* node);
86bool UI_Node_KeyPressed (uiNode_t* node, unsigned int key, unsigned short unicode);
87bool UI_Node_KeyReleased (uiNode_t* node, unsigned int key, unsigned short unicode);
90
91const char* UI_Node_GetText (uiNode_t* node);
92void UI_Node_SetText (uiNode_t* node, const char* text);
93const char* UI_Node_GetTooltip (uiNode_t* node);
94void UI_Node_SetTooltip (uiNode_t* node, const char* tooltip);
95void UI_Node_SetFont (uiNode_t* node, const char* name);
96void UI_Node_SetImage (uiNode_t* node, const char* name);
97void UI_Node_SetDisabled (uiNode_t* node, const bool value);
98
99#ifdef DEBUG
100void UI_Node_DebugCountWidget (uiNode_t* node, int count);
101#endif
102
103bool UI_NodeInstanceOf(const uiNode_t* node, const char* behaviourName);
105bool UI_NodeSetProperty(uiNode_t* node, const value_t* property, const char* value);
106void UI_NodeSetPropertyFromRAW(uiNode_t* node, const value_t* property, const void* rawValue, int rawType);
107float UI_GetFloatFromNodeProperty(uiNode_t const* node, const value_t* property);
108const char* UI_GetStringFromNodeProperty(const uiNode_t* node, const value_t* property);
109
110/* visibility */
111void UI_UnHideNode(uiNode_t* node);
112void UI_HideNode(uiNode_t* node);
113void UI_Invalidate(uiNode_t* node);
114void UI_Validate(uiNode_t* node);
115void UI_NodeSetPos(uiNode_t* node, vec2_t pos);
116void UI_NodeSetPos(uiNode_t* node, float x, float y);
118void UI_NodeSetSize (uiNode_t* node, float w, float h);
119void UI_NodeSetBox (uiNode_t* node, float x, float y, float w, float h);
120
121/* position */
122void UI_GetNodeAbsPos(uiNode_t const* node, vec2_t pos);
123void UI_GetNodeScreenPos(const uiNode_t* node, vec2_t pos);
124void UI_NodeAbsoluteToRelativePos(uiNode_t const* node, int* x, int* y);
125void UI_NodeRelativeToAbsolutePoint(const uiNode_t* node, vec2_t pos);
126void UI_NodeGetPoint(const uiNode_t* node, vec2_t pos, int pointDirection);
127
128/* navigation */
129uiNode_t* UI_GetNode(const uiNode_t* node, const char* name);
130uiNode_t* UI_GetPrevNode(const uiNode_t* node);
131uiNode_t* UI_FindNode(const uiNode_t* node, const char* name);
132void UI_InsertNode(uiNode_t* parent, uiNode_t* prevNode, uiNode_t* newNode);
133void UI_AppendNode(uiNode_t* parent, uiNode_t* newNode);
135void UI_MoveNode(uiNode_t* const parent, uiNode_t* prevNode, uiNode_t* node);
136void UI_UpdateRoot(uiNode_t* node, uiNode_t* newRoot);
137
138/* extended node behaviour */
139void UI_Node_SetItem (uiNode_t* node, const char* name, LUA_METHOD fcn);
140LUA_METHOD UI_Node_GetItem (uiNode_t* node, const char* name);
141
142void UI_AddNodeMethod (uiNode_t* node, const char* name, LUA_METHOD fcn);
143bool UI_GetNodeMethod (const uiNode_t* node, const char* name, LUA_METHOD &fcn);
144bool UI_HasNodeMethod (uiNode_t* node, const char* name);
unsigned int key
Definition cl_input.cpp:64
unsigned short unicode
Definition cl_input.cpp:65
voidpf void uLong size
Definition ioapi.h:42
QGL_EXTERN GLuint count
Definition r_gl.h:99
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
int LUA_METHOD
holds a reference to a lua event handler
Definition scripts_lua.h:53
node behaviour, how a node work
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
char * tooltip
Definition ui_nodes.h:99
char * text
Definition ui_nodes.h:121
uiBehaviour_t * behaviour
Definition ui_nodes.h:83
uiNode_t * parent
Definition ui_nodes.h:92
vec_t vec2_t[2]
Definition ufotypes.h:38
void UI_HideNode(uiNode_t *node)
Hides a given node.
Definition ui_node.cpp:635
bool UI_HasNodeMethod(uiNode_t *node, const char *name)
Returns true if a node method of given name is available on this node or its super.
Definition ui_node.cpp:1139
void UI_Node_WindowClosed(uiNode_t *node)
Definition ui_node.cpp:251
uiNode_t * UI_RemoveNode(uiNode_t *node, uiNode_t *child)
Remove a node from a parent node.
Definition ui_node.cpp:802
bool UI_NodeInstanceOf(const uiNode_t *node, const char *behaviourName)
Check the node inheritance.
Definition ui_node.cpp:453
void UI_AddNodeMethod(uiNode_t *node, const char *name, LUA_METHOD fcn)
Adds a lua based method to the list of available node methods for calling.
Definition ui_node.cpp:1094
void UI_NodeRelativeToAbsolutePoint(const uiNode_t *node, vec2_t pos)
Update a relative point to an absolute one.
Definition ui_node.cpp:587
float UI_GetFloatFromNodeProperty(uiNode_t const *node, const value_t *property)
Return a float from a node property.
Definition ui_node.cpp:1031
bool UI_Node_IsFunction(uiNode_t const *node)
Definition ui_node.cpp:85
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_MoveNode(uiNode_t *const parent, uiNode_t *prevNode, uiNode_t *node)
Moves a node in the tree.
Definition ui_node.cpp:840
void UI_Node_DrawTooltip(const uiNode_t *node, int x, int y)
Definition ui_node.cpp:115
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
const char * UI_GetStringFromNodeProperty(const uiNode_t *node, const value_t *property)
Return a string from a node property.
Definition ui_node.cpp:990
void UI_Node_SetImage(uiNode_t *node, const char *name)
Definition ui_node.cpp:398
void UI_Node_PropertyChanged(uiNode_t *node, const value_t *property)
Definition ui_node.cpp:277
uiNode_t * UI_GetPrevNode(const uiNode_t *node)
Returns the previous node based on the order of nodes in the parent.
Definition ui_node.cpp:733
void UI_NodeSetPropertyFromRAW(uiNode_t *node, const value_t *property, const void *rawValue, int rawType)
Definition ui_node.cpp:873
void UI_Node_DrawOverWindow(uiNode_t *node)
Definition ui_node.cpp:121
void UI_Node_InitNodeDynamic(uiNode_t *node)
Definition ui_node.cpp:226
bool UI_Node_KeyReleased(uiNode_t *node, unsigned int key, unsigned short unicode)
Definition ui_node.cpp:353
int UI_Node_GetCellWidth(uiNode_t *node)
Definition ui_node.cpp:361
void UI_Node_SizeChanged(uiNode_t *node)
Definition ui_node.cpp:289
void UI_NodeSetBox(uiNode_t *node, float x, float y, float w, float h)
Update the node size and height and fire callbacks.
Definition ui_node.cpp:699
LUA_METHOD UI_Node_GetItem(uiNode_t *node, const char *name)
This functions queries a lua based method in the internal uiNode behaviour.
Definition ui_node.cpp:1171
void UI_Node_GetClientPosition(uiNode_t const *node, vec2_t position)
Definition ui_node.cpp:295
void UI_Node_FocusLost(uiNode_t *node)
Definition ui_node.cpp:341
void UI_Node_Activate(uiNode_t *node)
Definition ui_node.cpp:271
void UI_NodeSetSize(uiNode_t *node, vec2_t size)
Update the node size and fire the size callback.
Definition ui_node.cpp:678
void UI_Node_FocusGained(uiNode_t *node)
Definition ui_node.cpp:335
const char * UI_Node_GetTooltip(uiNode_t *node)
Definition ui_node.cpp:406
void UI_UpdateRoot(uiNode_t *node, uiNode_t *newRoot)
Definition ui_node.cpp:853
void UI_Node_PosChanged(uiNode_t *node)
Definition ui_node.cpp:283
bool UI_Node_KeyPressed(uiNode_t *node, unsigned int key, unsigned short unicode)
Definition ui_node.cpp:347
void UI_Node_MouseUp(uiNode_t *node, int x, int y, int button)
Definition ui_node.cpp:164
bool UI_Node_DndEnter(uiNode_t *node)
Definition ui_node.cpp:303
void UI_NodeAbsoluteToRelativePos(uiNode_t const *node, int *x, int *y)
Update an absolute position to a relative one.
Definition ui_node.cpp:604
void UI_Node_Loading(uiNode_t *node)
Definition ui_node.cpp:208
bool UI_Node_IsDrawItselfChild(uiNode_t const *node)
Definition ui_node.cpp:77
bool UI_Node_IsGhost(uiNode_t const *node)
Definition ui_node.cpp:426
bool UI_Node_IsAbstract(uiNode_t const *node)
Definition ui_node.cpp:72
void UI_Node_DoLayout(uiNode_t *node)
Definition ui_node.cpp:263
void UI_Node_MouseDown(uiNode_t *node, int x, int y, int button)
Definition ui_node.cpp:158
bool UI_Node_IsDrawable(uiNode_t const *node)
Definition ui_node.cpp:48
void UI_Node_SetTooltip(uiNode_t *node, const char *tooltip)
Definition ui_node.cpp:410
int UI_Node_GetCellHeight(uiNode_t *node)
Definition ui_node.cpp:367
void UI_Invalidate(uiNode_t *node)
Invalidate a node and all his parent to request a layout update.
Definition ui_node.cpp:1065
void UI_Node_Draw(uiNode_t *node)
Definition ui_node.cpp:109
void UI_NodeGetPoint(const uiNode_t *node, vec2_t pos, int pointDirection)
return a relative position of a point into a node.
Definition ui_node.cpp:484
void UI_Node_MouseLeave(uiNode_t *node)
Definition ui_node.cpp:176
uiNode_t * UI_FindNode(const uiNode_t *node, const char *name)
Recursive searches for a child node by name in the entire subtree.
Definition ui_node.cpp:745
void UI_Node_MouseMove(uiNode_t *node, int x, int y)
Definition ui_node.cpp:152
void UI_AppendNode(uiNode_t *parent, uiNode_t *newNode)
add a node at the end of the node child
Definition ui_node.cpp:868
bool UI_Node_Scroll(uiNode_t *node, int deltaX, int deltaY)
Definition ui_node.cpp:146
void UI_InsertNode(uiNode_t *parent, uiNode_t *prevNode, uiNode_t *newNode)
Insert a node next another one into a node. If prevNode is nullptr add the node on the head of the wi...
Definition ui_node.cpp:764
void UI_Node_MouseEnter(uiNode_t *node)
Definition ui_node.cpp:170
void UI_Node_Loaded(uiNode_t *node)
Definition ui_node.cpp:214
bool UI_Node_MouseLongPress(uiNode_t *node, int x, int y, int button)
Definition ui_node.cpp:182
void UI_Node_SetItem(uiNode_t *node, const char *name, LUA_METHOD fcn)
This functions adds a lua based method to the internal uiNode behaviour.
Definition ui_node.cpp:1159
bool UI_Node_IsScrollableContainer(uiNode_t const *node)
Definition ui_node.cpp:93
void UI_Node_CapturedMouseMove(uiNode_t *node, int x, int y)
Definition ui_node.cpp:194
void UI_Node_CapturedMouseLost(uiNode_t *node)
Definition ui_node.cpp:200
bool UI_GetNodeMethod(const uiNode_t *node, const char *name, LUA_METHOD &fcn)
Finds the lua based method on this node or its super.
Definition ui_node.cpp:1116
bool UI_Node_DndFinished(uiNode_t *node, bool isDroped)
Definition ui_node.cpp:327
void UI_Node_LeftClick(uiNode_t *node, int x, int y)
Definition ui_node.cpp:128
bool UI_Node_IsWindow(uiNode_t const *node)
Definition ui_node.cpp:60
void UI_NodeSetPos(uiNode_t *node, vec2_t pos)
Update the node size and fire the pos callback.
Definition ui_node.cpp:658
void UI_Node_WindowActivate(uiNode_t *node)
Definition ui_node.cpp:257
const char * UI_Node_GetText(uiNode_t *node)
Definition ui_node.cpp:373
void UI_UnHideNode(uiNode_t *node)
Unhides a given node.
Definition ui_node.cpp:647
bool UI_Node_DndDrop(uiNode_t *node, int x, int y)
Definition ui_node.cpp:321
void UI_GetNodeAbsPos(uiNode_t const *node, vec2_t pos)
Returns the absolute position of a node.
Definition ui_node.cpp:526
uiNode_t * UI_GetNode(const uiNode_t *node, const char *name)
Search a child node by given name.
Definition ui_node.cpp:714
bool UI_Node_StartDragging(uiNode_t *node, int startX, int startY, int currentX, int currentY, int button)
Definition ui_node.cpp:188
bool UI_Node_IsOptionContainer(uiNode_t const *node)
Definition ui_node.cpp:54
bool UI_Node_IsDisabled(uiNode_t const *node)
Definition ui_node.cpp:418
intptr_t UI_Node_GetMemorySize(uiNode_t const *node)
Definition ui_node.cpp:104
void UI_Node_SetFont(uiNode_t *node, const char *name)
Definition ui_node.cpp:390
bool UI_NodeSetProperty(uiNode_t *node, const value_t *property, const char *value)
Set node property.
Definition ui_node.cpp:902
void UI_Node_RightClick(uiNode_t *node, int x, int y)
Definition ui_node.cpp:134
bool UI_Node_IsBattleScape(uiNode_t const *node)
Definition ui_node.cpp:66
bool UI_NodeInstanceOfPointer(const uiNode_t *node, const uiBehaviour_t *behaviour)
Check the node inheritance.
Definition ui_node.cpp:468
void UI_Node_DndLeave(uiNode_t *node)
Definition ui_node.cpp:315
bool UI_Node_IsInvisible(uiNode_t const *node)
Definition ui_node.cpp:422
void UI_Node_InitNode(uiNode_t *node)
Definition ui_node.cpp:231
void UI_Node_SetDisabled(uiNode_t *node, const bool value)
Definition ui_node.cpp:434
void UI_GetNodeScreenPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node in the screen. Screen position is not used for the node rende...
Definition ui_node.cpp:554
void UI_Node_MiddleClick(uiNode_t *node, int x, int y)
Definition ui_node.cpp:140
void UI_Node_SetText(uiNode_t *node, const char *text)
Definition ui_node.cpp:382
void UI_Node_WindowOpened(uiNode_t *node, linkedList_t *params)
Definition ui_node.cpp:245
bool UI_Node_DndMove(uiNode_t *node, int x, int y)
Definition ui_node.cpp:309
bool UI_Node_IsFlashing(uiNode_t const *node)
Definition ui_node.cpp:430
static int startY
static int startX