UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_node_window.cpp
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24 */
25 
26 #include "../ui_main.h"
27 #include "../ui_parse.h"
28 #include "../ui_font.h"
29 #include "../ui_nodes.h"
30 #include "../ui_internal.h"
31 #include "../ui_render.h"
32 #include "../ui_sprite.h"
33 #include "../ui_lua.h"
34 #include "ui_node_window.h"
35 #include "ui_node_panel.h"
36 #include "ui_node_abstractnode.h"
37 
38 #include "../../client.h" /* gettext _() */
39 #include "../../../common/scripts_lua.h"
40 
41 #define EXTRADATA_TYPE windowExtraData_t
42 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
43 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
44 
45 #define TOP_HEIGHT 30
46 
47 static const int CONTROLS_IMAGE_DIMENSIONS = 16;
48 static const int CONTROLS_PADDING = 8;
49 
50 static const vec4_t modalBackground = {0, 0, 0, 0.6};
51 static const vec4_t anamorphicBorder = {0, 0, 0, 1};
52 
53 static const char* WINDOW_FONT_BIG = "f_big";
54 
55 static const char* WINDOW_CLOSE_BUTTON_NAME = "close_window_button";
56 static const char* WINDOW_DRAG_BUTTON_NAME = "move_window_button";
57 
61 void UI_Window_SetBackgroundByName (uiNode_t* node, const char* name) {
62  uiSprite_t* sprite = UI_GetSpriteByName(name);
63  UI_EXTRADATA(node, windowExtraData_t).background = sprite;
64 }
65 
70 uiNode_t* UI_WindowNodeGetIndexedChild (uiNode_t* const node, const char* childName)
71 {
72  unsigned int hash = Com_HashKey(childName, INDEXEDCHILD_HASH_SIZE);
73  for (node_index_t* a = EXTRADATA(node).index_hash[hash]; a; a = a->hash_next) {
74  if (Q_streq(childName, a->node->name)) {
75  return a->node;
76  }
77  }
78  return nullptr;
79 }
80 
84 bool UI_WindowNodeAddIndexedNode (uiNode_t* const node, uiNode_t* const child)
85 {
86  node_index_t* a;
87  unsigned int hash = Com_HashKey(child->name, INDEXEDCHILD_HASH_SIZE);
88  for (a = EXTRADATA(node).index_hash[hash]; a; a = a->hash_next) {
89  if (Q_streq(child->name, a->node->name)) {
91  break;
92  }
93  }
94 
95  if (!a) {
97  a->next = EXTRADATA(node).index;
98  a->hash_next = EXTRADATA(node).index_hash[hash];
99  EXTRADATA(node).index_hash[hash] = a;
100  EXTRADATA(node).index = a;
101  }
102 
103  return false;
104 }
105 
109 bool UI_WindowNodeRemoveIndexedNode (uiNode_t* const node, uiNode_t* const child)
110 {
112  return false;
113 }
114 
118 bool UI_WindowIsFullScreen (const uiNode_t* const node)
119 {
120  assert(UI_NodeInstanceOf(node, "window"));
121  return EXTRADATACONST(node).isFullScreen;
122 }
123 
125 {
126  const char* text;
127  vec2_t pos;
128  const char* font = UI_GetFontFromNode(node);
129 
130  UI_GetNodeAbsPos(node, pos);
131 
132  /* black border for anamorphic mode */
135  if (UI_WindowIsFullScreen(node)) {
136  /* top */
137  if (pos[1] != 0)
139  /* left-right */
140  if (pos[0] != 0)
141  UI_DrawFill(0, pos[1], pos[0], node->box.size[1], anamorphicBorder);
142  if (pos[0] + node->box.size[0] < viddef.virtualWidth) {
143  const int width = viddef.virtualWidth - (pos[0] + node->box.size[0]);
144  UI_DrawFill(viddef.virtualWidth - width, pos[1], width, node->box.size[1], anamorphicBorder);
145  }
146  /* bottom */
147  if (pos[1] + node->box.size[1] < viddef.virtualHeight) {
148  const int height = viddef.virtualHeight - (pos[1] + node->box.size[1]);
150  }
151  }
152 
153  /* hide background if window is modal */
154  if (EXTRADATA(node).modal && ui_global.windowStack[ui_global.windowStackPos - 1] == node)
156 
157  if (EXTRADATA(node).background) {
158  UI_DrawSpriteInBox(false, EXTRADATA(node).background, SPRITE_STATUS_NORMAL, pos[0], pos[1], node->box.size[0], node->box.size[1]);
159  }
160 
161  /* draw the title */
162  text = UI_GetReferenceString(node, node->text);
163  if (text)
164  UI_DrawStringInBox(font, ALIGN_CC, pos[0] + node->padding, pos[1] + node->padding, node->box.size[0] - node->padding - node->padding, TOP_HEIGHT + 10 - node->padding - node->padding, text);
165 }
166 
169  EXTRADATA(node).lua_onWindowOpened = LUA_NOREF;
170  EXTRADATA(node).lua_onWindowClosed = LUA_NOREF;
171  EXTRADATA(node).lua_onWindowActivate = LUA_NOREF;
172  EXTRADATA(node).lua_onScriptLoaded = LUA_NOREF;
173 }
174 
180 {
181  uiNode::deleteNode(node);
182  UI_RemoveWindow(node);
183 }
184 
186 {
187  if (!node->invalidated)
188  return;
189 
190  /* use a the space */
191  if (EXTRADATA(node).fill) {
192  if (node->box.size[0] != viddef.virtualWidth) {
193  node->box.size[0] = viddef.virtualWidth;
194  }
195  if (node->box.size[1] != viddef.virtualHeight) {
196  node->box.size[1] = viddef.virtualHeight;
197  }
198  }
199 
200  /* move fullscreen window on the center of the screen */
201  if (UI_WindowIsFullScreen(node)) {
202  node->box.pos[0] = (int) ((viddef.virtualWidth - node->box.size[0]) / 2);
203  node->box.pos[1] = (int) ((viddef.virtualHeight - node->box.size[1]) / 2);
204  }
205 
206  /* reposition the close button */
207  if (EXTRADATA(node).closeButton) {
209  control->box.pos[0] = node->box.size[0] - CONTROLS_PADDING - control->box.size[0];
210  }
211  /* resize the dragw button */
212  if (EXTRADATA(node).dragButton) {
213  uiNode_t* control = UI_FindNode(node, WINDOW_DRAG_BUTTON_NAME);
214  control->box.size[0] = node->box.size[0];
215  }
216 
219  if (EXTRADATA(node).starLayout) {
220  UI_StarLayout(node);
221  }
222 
223  /* super */
225 }
226 
231 {
232  uiLocatedNode::onWindowOpened(node, nullptr);
233 
234  /* script callback */
235  if (EXTRADATA(node).onWindowOpened) {
236  UI_ExecuteEventActionsEx(node, EXTRADATA(node).onWindowOpened, params);
237  }
238  if (EXTRADATA(node).lua_onWindowOpened != LUA_NOREF) {
239  UI_ExecuteLuaEventScript_ParamList(node, EXTRADATA(node).lua_onWindowOpened, params);
240  }
241 
242  UI_Invalidate(node);
243 }
244 
249 {
251 
252  /* script callback */
253  if (EXTRADATA(node).onWindowClosed) {
254  UI_ExecuteEventActions(node, EXTRADATA(node).onWindowClosed);
255  }
256  if (EXTRADATA(node).lua_onWindowClosed != LUA_NOREF) {
257  UI_ExecuteLuaEventScript(node, EXTRADATA(node).lua_onWindowClosed);
258  }
259 }
260 
265 {
267 
268  /* script callback */
269  if (EXTRADATA(node).onWindowActivate) {
270  UI_ExecuteEventActions(node, EXTRADATA(node).onWindowActivate);
271  }
272  if (EXTRADATA(node).lua_onWindowActivate != LUA_NOREF) {
273  UI_ExecuteLuaEventScript(node, EXTRADATA(node).lua_onWindowActivate);
274  }
275 }
276 
279 
280  /* check for fullscreen window */
281  if (EXTRADATA(node).fill) {
282  node->box.size[0] = viddef.virtualWidth;
283  node->box.size[1] = viddef.virtualHeight;
284  }
286 }
287 
292 {
293  if (EXTRADATA(node).fill) {
294  node->box.size[0] = viddef.virtualWidth;
295  node->box.size[1] = viddef.virtualHeight;
296  } else {
297  node->box.size[0] = VID_NORM_WIDTH;
298  node->box.size[1] = VID_NORM_HEIGHT;
299  }
300  node->font = const_cast<char*>(WINDOW_FONT_BIG);
301  node->padding = 5;
302 }
303 
308 void UI_Window_SetCloseButton (uiNode_t* node, bool value) {
309  if (value) {
310  uiNode_t* control = UI_AllocNode(WINDOW_CLOSE_BUTTON_NAME, "button", node->dynamic);
311  const int positionFromRight = CONTROLS_PADDING;
312  static const char* closeCommand = "ui_close <path:root>;";
313 
314  control->root = node;
315  UI_NodeSetProperty(control, UI_GetPropertyFromBehaviour(control->behaviour, "icon"), "icons/system_close");
317  control->box.size[0] = CONTROLS_IMAGE_DIMENSIONS;
318  control->box.size[1] = CONTROLS_IMAGE_DIMENSIONS;
319  control->box.pos[0] = node->box.size[0] - positionFromRight - control->box.size[0];
320  control->box.pos[1] = CONTROLS_PADDING;
321  control->tooltip = _("Close the window");
322  control->onClick = UI_AllocStaticCommandAction(closeCommand);
323  UI_AppendNode(node, control);
324  }
325  else {
326  // drop the close node
328  if (control) {
329  UI_RemoveNode (node, control);
330  }
331  }
332  EXTRADATA(node).closeButton = value;
333 }
334 
338 void UI_Window_SetDragButton (uiNode_t* node, bool value) {
339  if (value) {
340  // create the drag node
341  uiNode_t* control = UI_AllocNode(WINDOW_DRAG_BUTTON_NAME, "controls", node->dynamic);
342  control->root = node;
343  control->box.size[0] = node->box.size[0];
344  control->box.size[1] = TOP_HEIGHT;
345  control->box.pos[0] = 0;
346  control->box.pos[1] = 0;
347  control->tooltip = _("Drag to move window");
348  /* if there is a close button already on this windown, then insert the drag button before the close
349  button; this is needed so the drag button is "below" the close button; if we don't do this, the
350  drag button recieves input events for the close button first making the close button no longer
351  working */
353  if (close != nullptr) {
354  // get the previous node of close
355  close = UI_GetPrevNode(close);
356  UI_InsertNode(node, close, control);
357  }
358  else {
359  UI_AppendNode(node, control);
360  }
361  }
362  else {
363  // drop the drag node
364  uiNode_t* control = UI_FindNode(node, WINDOW_DRAG_BUTTON_NAME);
365  if (control) {
366  UI_RemoveNode (node, control);
367  }
368  }
369  EXTRADATA(node).dragButton = value;
370 }
371 
376 {
377  /* note: the order here is important, first the drag button, then the close button otherwise the drag button
378  will be over the close button and the close button will no longer recieve input events */
379  UI_Window_SetDragButton(node, EXTRADATA(node).dragButton);
380  UI_Window_SetCloseButton (node, EXTRADATA(node).closeButton);
382 
383  if (EXTRADATA(node).starLayout)
384  UI_Invalidate(node);
385 }
386 
392  EXTRADATA(node).isFullScreen = (node->box.size[0] >= VID_NORM_WIDTH) && (node->box.size[1] >= VID_NORM_HEIGHT);
393 }
394 
395 void uiWindowNode::clone (const uiNode_t* source, uiNode_t* clone)
396 {
397  uiLocatedNode::clone(source, clone);
398  /* clean up index */
399  EXTRADATA(clone).index = nullptr;
400  OBJZERO(EXTRADATA(clone).index_hash);
401 }
402 
409 {
410  if (Vector2Empty(EXTRADATA(node).noticePos))
411  return nullptr;
412  return EXTRADATA(node).noticePos;
413 }
414 
420 bool UI_WindowIsDropDown(uiNode_t const* const node)
421 {
422  return EXTRADATACONST(node).dropdown;
423 }
424 
430 bool UI_WindowIsModal(uiNode_t const* const node)
431 {
432  return EXTRADATACONST(node).modal;
433 }
434 
443 {
444  assert(UI_NodeInstanceOf(node, "window"));
445  binding->next = EXTRADATA(node).keyList;
446  EXTRADATA(node).keyList = binding;
447 }
448 
450 
457 uiKeyBinding_t* UI_WindowNodeGetKeyBinding (uiNode_t const* const node, unsigned int key)
458 {
459  uiKeyBinding_t* binding = EXTRADATACONST(node).keyList;
460  assert(UI_NodeInstanceOf(node, "window"));
461  while (binding) {
462  if (binding->key == key)
463  break;
464  binding = binding->next;
465  }
466  return binding;
467 }
468 
469 void uiWindowNode::setFill (uiNode_t* node, bool value) {
470  UI_EXTRADATA(node, windowExtraData_t).fill = value;
471  onSizeChanged(node);
472 }
473 
475 {
476  behaviour->name = "window";
477  behaviour->manager = UINodePtr(new uiWindowNode());
478  behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
479  behaviour->lua_SWIG_typeinfo = UI_SWIG_TypeQuery("uiWindowNode_t *");
480 
481  /* In windows where notify messages appear (like e.g. the video options window when you have to restart the game until
482  * the settings take effects) you can define the position of those messages with this option. */
483  UI_RegisterExtradataNodeProperty(behaviour, "noticepos", V_POS, windowExtraData_t, noticePos);
484  /* Create subnode allowing to move the window when we click on the header. Updating this attribute at runtime will change nothing. */
485  UI_RegisterExtradataNodeProperty(behaviour, "dragbutton", V_BOOL, windowExtraData_t, dragButton);
486  /* Add a button on the top right the window to close it. Updating this attribute at runtime will change nothing. */
487  UI_RegisterExtradataNodeProperty(behaviour, "closebutton", V_BOOL, windowExtraData_t, closeButton);
488  /* If true, the user can't select something outside the modal window. He must first close the window. */
489  UI_RegisterExtradataNodeProperty(behaviour, "modal", V_BOOL, windowExtraData_t, modal);
490  /* If true, the window will be closed if the user clicks outside of the window. */
491  UI_RegisterExtradataNodeProperty(behaviour, "dropdown", V_BOOL, windowExtraData_t, dropdown);
492  /* If true, the user can't use ''ESC'' key to close the window. */
493  UI_RegisterExtradataNodeProperty(behaviour, "preventtypingescape", V_BOOL, windowExtraData_t, preventTypingEscape);
494  /* If true, the window is filled according to the widescreen. */
495  UI_RegisterExtradataNodeProperty(behaviour, "fill", V_BOOL, windowExtraData_t, fill);
496  /* If true, the window content position is updated according to the "star" layout when the window size change.
497  * @todo Need more documentation.
498  */
499  UI_RegisterExtradataNodeProperty(behaviour, "starlayout", V_BOOL, windowExtraData_t, starLayout);
500 
501  /* Invoked when the window is added to the rendering stack. */
502  UI_RegisterExtradataNodeProperty(behaviour, "onWindowOpened", V_UI_ACTION, windowExtraData_t, onWindowOpened);
503  /* Invoked when the window is removed from the rendering stack. */
504  UI_RegisterExtradataNodeProperty(behaviour, "onWindowClosed", V_UI_ACTION, windowExtraData_t, onWindowClosed);
505  /* Called when a windows gets active again after some other window was popped from the stack. */
506  UI_RegisterExtradataNodeProperty(behaviour, "onWindowActivate", V_UI_ACTION, windowExtraData_t, onWindowActivate);
507  /* Invoked after all UI scripts are loaded. */
508  UI_RegisterExtradataNodeProperty(behaviour, "onScriptLoaded", V_UI_ACTION, windowExtraData_t, onScriptLoaded);
509 
510  /* Sprite used to display the background */
511  UI_RegisterExtradataNodeProperty(behaviour, "background", V_UI_SPRITEREF, EXTRADATA_TYPE, background);
512 }
uiNode_t * windowStack[UI_MAX_WINDOWSTACK]
Definition: ui_internal.h:77
bool invalidated
Definition: ui_nodes.h:104
vec2_t size
Definition: ui_nodes.h:52
int UI_DrawStringInBox(const char *fontID, align_t align, int x, int y, int width, int height, const char *text, longlines_t method)
draw a line into a bounding box
Definition: ui_render.cpp:359
virtual void onWindowActivate(uiNode_t *node)
bool UI_NodeSetProperty(uiNode_t *node, const value_t *property, const char *value)
Set node property.
Definition: ui_node.cpp:890
struct node_index_s * hash_next
bool UI_NodeInstanceOf(const uiNode_t *node, const char *behaviourName)
Check the node inheritance.
Definition: ui_node.cpp:441
uiGlobal_t ui_global
Definition: ui_main.cpp:38
void onWindowActivate(uiNode_t *node) override
Called when a windows gets active again after some other window was popped from the stack...
const char * name
Definition: ui_behaviour.h:41
void UI_Invalidate(uiNode_t *node)
Invalidate a node and all his parent to request a layout update.
Definition: ui_node.cpp:1053
bool UI_WindowIsFullScreen(const uiNode_t *const node)
Check if a window is fullscreen or not.
#define _(String)
Definition: cl_shared.h:43
#define EXTRADATA(node)
int windowStackPos
Definition: ui_internal.h:78
void initNode(uiNode_t *node) override
void UI_InsertNode(uiNode_t *const 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:752
void UI_WindowNodeRegisterKeyBinding(uiNode_t *node, uiKeyBinding_t *binding)
Add a key binding to a window node. Window node store key bindings for his node child.
void onLoading(uiNode_t *node) override
Called at the begin of the load from script.
char name[MAX_VAR]
Definition: ui_nodes.h:82
uiBehaviour_t * behaviour
Definition: ui_nodes.h:83
float vec_t
Definition: ufotypes.h:37
void onWindowOpened(uiNode_t *node, linkedList_t *params) override
Called when we init the node on the screen.
virtual void onWindowOpened(uiNode_t *node, linkedList_t *params)
UINodePtr manager
Definition: ui_behaviour.h:43
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
Definition: ui_lua.cpp:71
#define V_UI_SPRITEREF
Definition: ui_parse.h:56
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
Definition: ui_sprite.cpp:187
viddef_t viddef
Definition: cl_video.cpp:34
static const vec4_t anamorphicBorder
#define TOP_HEIGHT
uiAction_t * UI_AllocStaticCommandAction(const char *command)
Allocate and initialize a command action.
Definition: ui_actions.cpp:796
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
void UI_Window_FlagFullscreen(uiNode_t *node)
If the node size equals the full screen size, flag the node as isFullscreen, so it is displayed prope...
void UI_AppendNode(uiNode_t *const parent, uiNode_t *newNode)
add a node at the end of the node child
Definition: ui_node.cpp:856
int virtualHeight
Definition: cl_video.h:74
bool dynamic
Definition: ui_nodes.h:85
void deleteNode(uiNode_t *node) override
Actions to do on deleting the node.
bool UI_WindowNodeRemoveIndexedNode(uiNode_t *const node, uiNode_t *const child)
Remove a node from the child index.
char * tooltip
Definition: ui_nodes.h:99
void UI_Window_SetBackgroundByName(uiNode_t *node, const char *name)
set background sprite
#define EXTRADATACONST(node)
virtual void clone(uiNode_t const *source, uiNode_t *clone)
struct uiAction_s * onClick
Definition: ui_nodes.h:135
const value_t * UI_GetPropertyFromBehaviour(const uiBehaviour_t *behaviour, const char *name)
Get a property from a behaviour or his inheritance It use a dichotomic search.
void UI_RegisterWindowNode(uiBehaviour_t *behaviour)
void onSizeChanged(uiNode_t *node) override
Callback stub.
static const char * WINDOW_FONT_BIG
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
Definition: ui_behaviour.h:109
struct uiKeyBinding_s * next
Definition: ui_input.h:38
uiNode_t * UI_RemoveNode(uiNode_t *const node, uiNode_t *child)
Remove a node from a parent node.
Definition: ui_node.cpp:790
uiNode_t * UI_AllocNode(const char *name, const char *type, bool isDynamic)
Allocate a node into the UI memory.
Definition: ui_nodes.cpp:381
#define Vector2Empty(a)
Definition: vector.h:74
uiNode_t * root
Definition: ui_nodes.h:93
void UI_Window_SetCloseButton(uiNode_t *node, bool value)
Create/remove close button on window.
unsigned int key
Definition: cl_input.cpp:68
uiKeyBinding_t * UI_WindowNodeGetKeyBinding(uiNode_t const *const node, unsigned int key)
Search a a key binding from a window node. Window node store key bindings for his node child...
char * font
Definition: ui_nodes.h:122
#define OBJZERO(obj)
Definition: shared.h:178
void UI_ExecuteEventActionsEx(uiNode_t *source, const uiAction_t *firstAction, linkedList_t *params)
Definition: ui_actions.cpp:735
static const vec4_t modalBackground
static wrapCache_t * hash[MAX_WRAP_HASH]
Definition: r_font.cpp:86
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:733
SharedPtr< uiNode > UINodePtr
static const int CONTROLS_PADDING
int padding
Definition: ui_nodes.h:109
void * lua_SWIG_typeinfo
Definition: ui_behaviour.h:57
uiNode_t * UI_WindowNodeGetIndexedChild(uiNode_t *const node, const char *childName)
Get a node from child index.
#define UI_EXTRADATA(NODE, TYPE)
Definition: ui_nodes.h:185
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
Definition: ui_actions.cpp:726
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
Definition: ui_parse.cpp:1406
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:721
void UI_Window_SetDragButton(uiNode_t *node, bool value)
Create/remove drag button.
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void doLayout(uiNode_t *node) override
Call to update the node layout. This common code revalidates the node tree.
vec_t * UI_WindowNodeGetNoticePosition(uiNode_t *node)
Get the noticePosition from a window node.
extradata for the window node
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
Definition: ui_node.cpp:514
#define VID_NORM_WIDTH
Definition: cl_renderer.h:40
struct node_index_s * next
static const char * WINDOW_CLOSE_BUTTON_NAME
bool UI_ExecuteLuaEventScript_ParamList(uiNode_t *node, LUA_EVENT event, linkedList_t *params)
Executes a lua event handler with string parameter list.
Definition: ui_lua.cpp:91
#define VID_NORM_HEIGHT
Definition: cl_renderer.h:41
virtual void initNode(uiNode_t *node)
bool UI_WindowIsModal(uiNode_t const *const node)
True if the window is a modal.
intptr_t extraDataSize
Definition: ui_behaviour.h:54
static const int CONTROLS_IMAGE_DIMENSIONS
void setFill(uiNode_t *node, bool value)
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
Definition: ui_font.cpp:145
Definition: scripts.h:50
node behaviour, how a node work
Definition: ui_behaviour.h:39
virtual void onWindowClosed(uiNode_t *node)
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
void UI_RemoveWindow(uiNode_t *window)
Removes a window from the list of all windows.
Definition: ui_windows.cpp:644
#define INDEXEDCHILD_HASH_SIZE
unsigned int Com_HashKey(const char *name, int hashsize)
returns hash key for a string
Definition: shared.cpp:336
vec_t vec2_t[2]
Definition: ufotypes.h:38
virtual void deleteNode(uiNode_t *node)
bool UI_WindowIsDropDown(uiNode_t const *const node)
True if the window is a drop down.
const uiKeyBinding_t * binding
int virtualWidth
Definition: cl_video.h:74
memPool_t * ui_sysPool
Definition: ui_main.cpp:42
#define V_UI_ACTION
Definition: ui_parse.h:54
#define Q_streq(a, b)
Definition: shared.h:136
bool UI_WindowNodeAddIndexedNode(uiNode_t *const node, uiNode_t *const child)
Add a node to the child index.
uiBox_t box
Definition: ui_nodes.h:96
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
Definition: ui_render.cpp:37
static const char * WINDOW_DRAG_BUTTON_NAME
#define Mem_PoolAllocType(type, pool)
Definition: mem.h:43
#define EXTRADATA_TYPE
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
Definition: ui_sprite.cpp:115
uiNode_t * node
virtual void doLayout(uiNode_t *node)
Call to update the node layout. This common code revalidates the node tree.
void UI_StarLayout(uiNode_t *node)
Do a star layout with child according to there num.
Definition: scripts.h:55
void onLoaded(uiNode_t *node) override
Called at the end of the load from script.
void draw(uiNode_t *node) override
char * text
Definition: ui_nodes.h:121
void clone(uiNode_t const *source, uiNode_t *clone) override
vec_t vec4_t[4]
Definition: ufotypes.h:40
vec2_t pos
Definition: ui_nodes.h:51
void onWindowClosed(uiNode_t *node) override
Called when we close the node on the screen.