UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_window.cpp File Reference
#include "../ui_main.h"
#include "../ui_parse.h"
#include "../ui_font.h"
#include "../ui_nodes.h"
#include "../ui_internal.h"
#include "../ui_render.h"
#include "../ui_sprite.h"
#include "../ui_lua.h"
#include "ui_node_window.h"
#include "ui_node_panel.h"
#include "ui_node_abstractnode.h"
#include "../../client.h"
#include "../../../common/scripts_lua.h"
Include dependency graph for ui_node_window.cpp:

Go to the source code of this file.

Macros

#define EXTRADATA_TYPE   windowExtraData_t
#define EXTRADATA(node)
#define EXTRADATACONST(node)
#define TOP_HEIGHT   30

Functions

void UI_Window_SetBackgroundByName (uiNode_t *node, const char *name)
 set background sprite
uiNode_t * UI_WindowNodeGetIndexedChild (uiNode_t *const node, const char *childName)
 Get a node from child index.
bool UI_WindowNodeAddIndexedNode (uiNode_t *const node, uiNode_t *const child)
 Add a node to the child index.
bool UI_WindowNodeRemoveIndexedNode (uiNode_t *const node, uiNode_t *const child)
 Remove a node from the child index.
bool UI_WindowIsFullScreen (const uiNode_t *const node)
 Check if a window is fullscreen or not.
void UI_Window_SetCloseButton (uiNode_t *node, bool value)
 Create/remove close button on window.
void UI_Window_SetDragButton (uiNode_t *node, bool value)
 Create/remove drag button.
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 properly.
vec_t * UI_WindowNodeGetNoticePosition (uiNode_t *node)
 Get the noticePosition from a window node.
bool UI_WindowIsDropDown (uiNode_t const *const node)
 True if the window is a drop down.
bool UI_WindowIsModal (uiNode_t const *const node)
 True if the window is a modal.
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.
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_RegisterWindowNode (uiBehaviour_t *behaviour)

Variables

static const int CONTROLS_IMAGE_DIMENSIONS = 16
static const int CONTROLS_PADDING = 8
static const vec4_t modalBackground = {0, 0, 0, 0.6}
static const vec4_t anamorphicBorder = {0, 0, 0, 1}
static const char * WINDOW_FONT_BIG = "f_big"
static const char * WINDOW_CLOSE_BUTTON_NAME = "close_window_button"
static const char * WINDOW_DRAG_BUTTON_NAME = "move_window_button"
const uiKeyBinding_t * binding

Detailed Description

Todo
move it as an inheritance of panel behaviour?

Definition in file ui_node_window.cpp.

Macro Definition Documentation

◆ EXTRADATA

#define EXTRADATA ( node)
Value:
#define EXTRADATA_TYPE
#define UI_EXTRADATA(NODE, TYPE)
Definition ui_nodes.h:185

Definition at line 42 of file ui_node_window.cpp.

◆ EXTRADATA_TYPE

#define EXTRADATA_TYPE   windowExtraData_t

Definition at line 41 of file ui_node_window.cpp.

◆ EXTRADATACONST

#define EXTRADATACONST ( node)
Value:
#define UI_EXTRADATACONST(NODE, TYPE)
Definition ui_nodes.h:187

Definition at line 43 of file ui_node_window.cpp.

◆ TOP_HEIGHT

#define TOP_HEIGHT   30

Definition at line 45 of file ui_node_window.cpp.

Referenced by uiWindowNode::draw(), and UI_Window_SetDragButton().

Function Documentation

◆ UI_RegisterWindowNode()

◆ UI_Window_FlagFullscreen()

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 properly.

Definition at line 391 of file ui_node_window.cpp.

References uiNode_t::box, EXTRADATA, uiBox_t::size, UI_Window_FlagFullscreen(), VID_NORM_HEIGHT, and VID_NORM_WIDTH.

Referenced by uiWindowNode::onLoaded(), uiWindowNode::onSizeChanged(), UI_Window_FlagFullscreen(), and UI_WindowNodeRegisterKeyBinding().

◆ UI_Window_SetBackgroundByName()

void UI_Window_SetBackgroundByName ( uiNode_t * node,
const char * name )

◆ UI_Window_SetCloseButton()

◆ UI_Window_SetDragButton()

◆ UI_WindowIsDropDown()

bool UI_WindowIsDropDown ( uiNode_t const *const node)

True if the window is a drop down.

Parameters
nodeA window node
Returns
True if the window is a drop down.

Definition at line 420 of file ui_node_window.cpp.

References EXTRADATACONST, and UI_WindowIsDropDown().

Referenced by UI_GetNodeAtPosition(), UI_LeftClick(), and UI_WindowIsDropDown().

◆ UI_WindowIsFullScreen()

bool UI_WindowIsFullScreen ( const uiNode_t *const node)

◆ UI_WindowIsModal()

bool UI_WindowIsModal ( uiNode_t const *const node)

True if the window is a modal.

Parameters
nodeA window node
Returns
True if the window is a modal.

Definition at line 430 of file ui_node_window.cpp.

References EXTRADATACONST, and UI_WindowIsModal().

Referenced by UI_GetNodeAtPosition(), UI_KeyPressed(), and UI_WindowIsModal().

◆ UI_WindowNodeAddIndexedNode()

bool UI_WindowNodeAddIndexedNode ( uiNode_t *const node,
uiNode_t *const child )

◆ UI_WindowNodeGetIndexedChild()

uiNode_t * UI_WindowNodeGetIndexedChild ( uiNode_t *const node,
const char * childName )

Get a node from child index.

Returns
A child node by his name, else nullptr

Definition at line 70 of file ui_node_window.cpp.

References Com_HashKey(), EXTRADATA, INDEXEDCHILD_HASH_SIZE, Q_streq, and UI_WindowNodeGetIndexedChild().

Referenced by UI_ReadNodePath(), UI_WindowNodeGetIndexedChild(), and UI_WindowNodeRegisterKeyBinding().

◆ UI_WindowNodeGetKeyBinding()

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.

Parameters
nodeA window node
keyA key code, either K_ value or lowercase ascii

Definition at line 457 of file ui_node_window.cpp.

References binding, EXTRADATACONST, uiKeyBinding_t::key, uiKeyBinding_t::next, UI_NodeInstanceOf(), and UI_WindowNodeGetKeyBinding().

Referenced by UI_KeyPressedInWindow(), UI_WindowNodeGetKeyBinding(), and UI_WindowNodeRegisterKeyBinding().

◆ UI_WindowNodeGetNoticePosition()

vec_t * UI_WindowNodeGetNoticePosition ( uiNode_t * node)

Get the noticePosition from a window node.

Parameters
nodeA window node
Returns
A position, else nullptr if no notice position

Definition at line 408 of file ui_node_window.cpp.

References EXTRADATA, UI_WindowNodeGetNoticePosition(), and Vector2Empty.

Referenced by UI_DrawNotice(), UI_WindowNodeGetNoticePosition(), and UI_WindowNodeRegisterKeyBinding().

◆ UI_WindowNodeRegisterKeyBinding()

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.

Parameters
nodeA window node
bindingKey binding to link with the window (structure should not be already linked somewhere)
Todo
Rework that function to remove possible wrong use of that function

Definition at line 442 of file ui_node_window.cpp.

References binding, EXTRADATA, uiKeyBinding_t::next, UI_NodeInstanceOf(), and UI_WindowNodeRegisterKeyBinding().

Referenced by UI_SetKeyBindingEx(), UI_WindowNodeRegisterKeyBinding(), and UI_WindowNodeRegisterKeyBinding().

◆ UI_WindowNodeRemoveIndexedNode()

bool UI_WindowNodeRemoveIndexedNode ( uiNode_t *const node,
uiNode_t *const child )

Remove a node from the child index.

Todo
FIXME implement it

Definition at line 109 of file ui_node_window.cpp.

References UI_WindowNodeRemoveIndexedNode().

Referenced by UI_RemoveNode(), UI_WindowNodeRegisterKeyBinding(), and UI_WindowNodeRemoveIndexedNode().

Variable Documentation

◆ anamorphicBorder

const vec4_t anamorphicBorder = {0, 0, 0, 1}
static

Definition at line 51 of file ui_node_window.cpp.

Referenced by uiWindowNode::draw().

◆ binding

◆ CONTROLS_IMAGE_DIMENSIONS

const int CONTROLS_IMAGE_DIMENSIONS = 16
static

Definition at line 47 of file ui_node_window.cpp.

Referenced by UI_Window_SetCloseButton().

◆ CONTROLS_PADDING

const int CONTROLS_PADDING = 8
static

Definition at line 48 of file ui_node_window.cpp.

Referenced by uiWindowNode::doLayout(), and UI_Window_SetCloseButton().

◆ modalBackground

const vec4_t modalBackground = {0, 0, 0, 0.6}
static

Definition at line 50 of file ui_node_window.cpp.

Referenced by uiWindowNode::draw().

◆ WINDOW_CLOSE_BUTTON_NAME

const char* WINDOW_CLOSE_BUTTON_NAME = "close_window_button"
static

◆ WINDOW_DRAG_BUTTON_NAME

const char* WINDOW_DRAG_BUTTON_NAME = "move_window_button"
static

Definition at line 56 of file ui_node_window.cpp.

Referenced by uiWindowNode::doLayout(), and UI_Window_SetDragButton().

◆ WINDOW_FONT_BIG

const char* WINDOW_FONT_BIG = "f_big"
static

Definition at line 53 of file ui_node_window.cpp.

Referenced by uiWindowNode::onLoading().