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"
38 #include "../../client.h"
39 #include "../../../common/scripts_lua.h"
41 #define EXTRADATA_TYPE windowExtraData_t
42 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
43 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
74 if (
Q_streq(childName, a->node->name)) {
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;
238 if (
EXTRADATA(node).lua_onWindowOpened != LUA_NOREF) {
256 if (
EXTRADATA(node).lua_onWindowClosed != LUA_NOREF) {
272 if (
EXTRADATA(node).lua_onWindowActivate != LUA_NOREF) {
312 static const char* closeCommand =
"ui_close <path:root>;";
314 control->
root = node;
321 control->
tooltip =
_(
"Close the window");
342 control->
root = node;
347 control->
tooltip =
_(
"Drag to move window");
353 if (close !=
nullptr) {
462 if (binding->
key == key)
464 binding = binding->
next;
476 behaviour->
name =
"window";
uiNode_t * windowStack[UI_MAX_WINDOWSTACK]
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
virtual void onWindowActivate(uiNode_t *node)
bool UI_NodeSetProperty(uiNode_t *node, const value_t *property, const char *value)
Set node property.
struct node_index_s * hash_next
bool UI_NodeInstanceOf(const uiNode_t *node, const char *behaviourName)
Check the node inheritance.
void onWindowActivate(uiNode_t *node) override
Called when a windows gets active again after some other window was popped from the stack...
void UI_Invalidate(uiNode_t *node)
Invalidate a node and all his parent to request a layout update.
bool UI_WindowIsFullScreen(const uiNode_t *const node)
Check if a window is fullscreen or not.
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...
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.
uiBehaviour_t * behaviour
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)
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
static const vec4_t anamorphicBorder
uiAction_t * UI_AllocStaticCommandAction(const char *command)
Allocate and initialize a command action.
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
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.
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
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.
struct uiKeyBinding_s * next
uiNode_t * UI_RemoveNode(uiNode_t *const node, uiNode_t *child)
Remove a node from a parent node.
uiNode_t * UI_AllocNode(const char *name, const char *type, bool isDynamic)
Allocate a node into the UI memory.
void UI_Window_SetCloseButton(uiNode_t *node, bool value)
Create/remove close button on window.
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...
void UI_ExecuteEventActionsEx(uiNode_t *source, const uiAction_t *firstAction, linkedList_t *params)
static const vec4_t modalBackground
static wrapCache_t * hash[MAX_WRAP_HASH]
uiNode_t * UI_FindNode(const uiNode_t *node, const char *name)
Recursive searches for a child node by name in the entire subtree.
SharedPtr< uiNode > UINodePtr
static const int CONTROLS_PADDING
uiNode_t * UI_WindowNodeGetIndexedChild(uiNode_t *const node, const char *childName)
Get a node from child index.
#define UI_EXTRADATA(NODE, TYPE)
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
uiNode_t * UI_GetPrevNode(const uiNode_t *node)
Returns the previous node based on the order of nodes in the parent.
void UI_Window_SetDragButton(uiNode_t *node, bool value)
Create/remove drag button.
Atomic structure used to define most of the UI.
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.
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
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.
virtual void initNode(uiNode_t *node)
bool UI_WindowIsModal(uiNode_t const *const node)
True if the window is a modal.
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.
node behaviour, how a node work
virtual void onWindowClosed(uiNode_t *node)
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void UI_RemoveWindow(uiNode_t *window)
Removes a window from the list of all windows.
#define INDEXEDCHILD_HASH_SIZE
unsigned int Com_HashKey(const char *name, int hashsize)
returns hash key for a string
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
bool UI_WindowNodeAddIndexedNode(uiNode_t *const node, uiNode_t *const child)
Add a node to the child index.
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
static const char * WINDOW_DRAG_BUTTON_NAME
#define Mem_PoolAllocType(type, pool)
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
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.
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.