UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_node_window.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #include "../../../shared/mathlib.h"
28 #include "ui_node_abstractnode.h"
29 
30 /* prototype */
31 struct uiNode_t;
32 struct uiAction_s;
33 struct uiBehaviour_t;
34 struct uiKeyBinding_s;
35 
36 class uiWindowNode : public uiLocatedNode {
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;
48 public:
49  void setFill(uiNode_t* node, bool value);
50 };
51 
52 #define INDEXEDCHILD_HASH_SIZE 32
53 
54 typedef struct node_index_s {
57  struct node_index_s* next;
58 } node_index_t;
59 
63 typedef struct {
65  bool dragButton;
66  bool closeButton;
68  bool modal;
69  bool dropdown;
70  bool isFullScreen;
71  bool fill;
72  bool starLayout;
88 
91 
95 
96 void UI_RegisterWindowNode(uiBehaviour_t* behaviour);
97 bool UI_WindowIsFullScreen(uiNode_t const* window);
98 bool UI_WindowIsDropDown(uiNode_t const* window);
99 bool UI_WindowIsModal(uiNode_t const* window);
101 struct uiKeyBinding_s* UI_WindowNodeGetKeyBinding(uiNode_t const* node, unsigned int key);
103 /* child index */
104 uiNode_t* UI_WindowNodeGetIndexedChild(uiNode_t* node, const char* childName);
107 
108 void UI_Window_SetBackgroundByName(uiNode_t* node, const char* name);
109 void UI_Window_SetCloseButton(uiNode_t* node, bool value);
110 void UI_Window_SetDragButton(uiNode_t* node, bool value);
112 
113 void UI_WindowNode_SetFill(uiNode_t* node, bool value);
void UI_Window_SetCloseButton(uiNode_t *node, bool value)
Create/remove close button on window.
struct node_index_s * hash_next
bool UI_WindowNodeRemoveIndexedNode(uiNode_t *node, uiNode_t *child)
Remove a node from the child index.
struct uiAction_s * onWindowOpened
void onWindowActivate(uiNode_t *node) override
Called when a windows gets active again after some other window was popped from the stack...
LUA_EVENT lua_onWindowActivate
struct uiAction_s * onScriptLoaded
bool UI_WindowIsModal(uiNode_t const *window)
True if the window is a modal.
void initNode(uiNode_t *node) override
int LUA_EVENT
holds a reference to a lua event handler
Definition: scripts_lua.h:49
struct node_index_s node_index_t
void onLoading(uiNode_t *node) override
Called at the begin of the load from script.
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.
void UI_WindowNode_SetFill(uiNode_t *node, bool value)
LUA_EVENT lua_onWindowClosed
node_index_t * index
void UI_Window_SetBackgroundByName(uiNode_t *node, const char *name)
set background sprite
void deleteNode(uiNode_t *node) override
Actions to do on deleting the node.
void onSizeChanged(uiNode_t *node) override
Callback stub.
struct uiAction_s * onWindowClosed
LUA_EVENT lua_onScriptLoaded
void UI_WindowNodeRegisterKeyBinding(uiNode_t *window, struct uiKeyBinding_s *binding)
Add a key binding to 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.
unsigned int key
Definition: cl_input.cpp:68
LUA_EVENT lua_onWindowOpened
void UI_RegisterWindowNode(uiBehaviour_t *behaviour)
struct uiKeyBinding_s * keyList
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...
bool UI_WindowIsFullScreen(uiNode_t const *window)
Check if a window is fullscreen or not.
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
uiNode_t * node
Definition: ui_input.h:33
void doLayout(uiNode_t *node) override
Call to update the node layout. This common code revalidates the node tree.
struct uiAction_s * onWindowActivate
extradata for the window node
struct node_index_s * next
void UI_Window_SetDragButton(uiNode_t *node, bool value)
Create/remove drag button.
uiSprite_t * background
bool UI_WindowIsDropDown(uiNode_t const *window)
True if the window is a drop down.
void setFill(uiNode_t *node, bool value)
node behaviour, how a node work
Definition: ui_behaviour.h:39
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
#define INDEXEDCHILD_HASH_SIZE
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 vec2_t[2]
Definition: ufotypes.h:38
uiNode_t * UI_WindowNodeGetIndexedChild(uiNode_t *node, const char *childName)
Get a node from child index.
const uiKeyBinding_t * binding
uiNode_t * node
bool UI_WindowNodeAddIndexedNode(uiNode_t *node, uiNode_t *child)
Add a node to the child index.
Atomic element to store UI scripts The parser use this atom to translate script action into many tree...
Definition: ui_actions.h:144
void onLoaded(uiNode_t *node) override
Called at the end of the load from script.
void draw(uiNode_t *node) override
void clone(uiNode_t const *source, uiNode_t *clone) override
void onWindowClosed(uiNode_t *node) override
Called when we close the node on the screen.