UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_window.h
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
25#pragma once
26
29
30/* prototype */
31struct uiNode_t;
32struct uiAction_s;
33struct uiBehaviour_t;
34struct uiKeyBinding_s;
35
37 void draw(uiNode_t* node) override;
38 void initNode(uiNode_t* node) override;
39 void deleteNode(uiNode_t* node) override;
40 void doLayout(uiNode_t* node) override;
41 void onLoading(uiNode_t* node) override;
42 void onLoaded(uiNode_t* node) override;
43 void onWindowOpened(uiNode_t* node, linkedList_t* params) override;
44 void onWindowClosed(uiNode_t* node) override;
45 void onWindowActivate(uiNode_t* node) override;
46 void onSizeChanged(uiNode_t* node) override;
47 void clone(uiNode_t const* source, uiNode_t* clone) override;
48public:
49 void setFill(uiNode_t* node, bool value);
50};
51
52#define INDEXEDCHILD_HASH_SIZE 32
53
54typedef struct node_index_s {
56 struct node_index_s* hash_next;
57 struct node_index_s* next;
59
95
97bool UI_WindowIsFullScreen(uiNode_t const* window);
98bool UI_WindowIsDropDown(uiNode_t const* window);
99bool UI_WindowIsModal(uiNode_t const* window);
100void UI_WindowNodeRegisterKeyBinding(uiNode_t* window, struct uiKeyBinding_s* binding);
101struct uiKeyBinding_s* UI_WindowNodeGetKeyBinding(uiNode_t const* node, unsigned int key);
103/* child index */
104uiNode_t* UI_WindowNodeGetIndexedChild(uiNode_t* node, const char* childName);
107
108void UI_Window_SetBackgroundByName(uiNode_t* node, const char* name);
109void UI_Window_SetCloseButton(uiNode_t* node, bool value);
110void UI_Window_SetDragButton(uiNode_t* node, bool value);
112
113void UI_WindowNode_SetFill(uiNode_t* node, bool value);
unsigned int key
Definition cl_input.cpp:64
void onWindowClosed(uiNode_t *node) override
Called when we close the node on the screen.
void deleteNode(uiNode_t *node) override
Actions to do on deleting the node.
void setFill(uiNode_t *node, bool value)
void onLoading(uiNode_t *node) override
Called at the begin of the load from script.
void clone(uiNode_t const *source, uiNode_t *clone) override
void onWindowOpened(uiNode_t *node, linkedList_t *params) override
Called when we init the node on the screen.
void onSizeChanged(uiNode_t *node) override
Callback stub.
void onWindowActivate(uiNode_t *node) override
Called when a windows gets active again after some other window was popped from the stack.
void onLoaded(uiNode_t *node) override
Called at the end of the load from script.
void initNode(uiNode_t *node) override
void doLayout(uiNode_t *node) override
Call to update the node layout. This common code revalidates the node tree.
void draw(uiNode_t *node) override
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
int LUA_EVENT
holds a reference to a lua event handler
Definition scripts_lua.h:49
struct node_index_s * next
uiNode_t * node
struct node_index_s * hash_next
node behaviour, how a node work
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
extradata for the window node
struct uiKeyBinding_s * keyList
node_index_t * index_hash[INDEXEDCHILD_HASH_SIZE]
uiSprite_t * background
struct uiAction_s * onScriptLoaded
node_index_t * index
LUA_EVENT lua_onScriptLoaded
struct uiAction_s * onWindowClosed
LUA_EVENT lua_onWindowActivate
struct uiAction_s * onWindowOpened
LUA_EVENT lua_onWindowClosed
struct uiAction_s * onWindowActivate
LUA_EVENT lua_onWindowOpened
float vec_t
Definition ufotypes.h:37
vec_t vec2_t[2]
Definition ufotypes.h:38
const uiKeyBinding_t * binding
void UI_RegisterWindowNode(uiBehaviour_t *behaviour)
#define INDEXEDCHILD_HASH_SIZE
void UI_Window_SetBackgroundByName(uiNode_t *node, const char *name)
set background sprite
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...
uiNode_t * UI_WindowNodeGetIndexedChild(uiNode_t *node, const char *childName)
Get a node from child index.
void UI_Window_SetCloseButton(uiNode_t *node, bool value)
Create/remove close button on window.
struct uiKeyBinding_s * UI_WindowNodeGetKeyBinding(uiNode_t const *node, unsigned int key)
Search a a key binding from a window node. Window node store key bindings for his node child.
vec_t * UI_WindowNodeGetNoticePosition(uiNode_t *node)
Get the noticePosition from a window node.
void UI_WindowNodeRegisterKeyBinding(uiNode_t *window, struct uiKeyBinding_s *binding)
bool UI_WindowNodeAddIndexedNode(uiNode_t *node, uiNode_t *child)
Add a node to the child index.
bool UI_WindowNodeRemoveIndexedNode(uiNode_t *node, uiNode_t *child)
Remove a node from the child index.
bool UI_WindowIsFullScreen(uiNode_t const *window)
Check if a window is fullscreen or not.
bool UI_WindowIsModal(uiNode_t const *window)
True if the window is a modal.
void UI_WindowNode_SetFill(uiNode_t *node, bool value)
bool UI_WindowIsDropDown(uiNode_t const *window)
True if the window is a drop down.
void UI_Window_SetDragButton(uiNode_t *node, bool value)
Create/remove drag button.