ui_node_text2.c File Reference

#include "../ui_main.h"
#include "../ui_internal.h"
#include "../ui_font.h"
#include "../ui_actions.h"
#include "../ui_parse.h"
#include "../ui_render.h"
#include "ui_node_text2.h"
#include "ui_node_abstractnode.h"
#include "../../client.h"
#include "../../../shared/parse.h"
Include dependency graph for ui_node_text2.c:

Go to the source code of this file.

Defines

#define EXTRADATA_TYPE   text2ExtraData_t
#define EXTRADATA(node)   UI_EXTRADATA(node, EXTRADATA_TYPE)
#define EXTRADATACONST(node)   UI_EXTRADATACONST(node, EXTRADATA_TYPE)

Functions

static void UI_TextUpdateCache (uiNode_t *node)
static void UI_TextNodeGenerateLineSplit (uiNode_t *node)
static void UI_TextValidateCache (uiNode_t *node)
static int UI_TextNodeGetLine (const uiNode_t *node, int x, int y)
 Get the line number under an absolute position.
static void UI_TextNodeMouseMove (uiNode_t *node, int x, int y)
static void UI_TextNodeDrawText (uiNode_t *node, const linkedList_t *list, qboolean noDraw)
 Handles linked list of text. Each element of the list must be a line of text without line break. A line break is betwwen 2 element of the list. Text line is wrapped/truncated... according to a node property.
static void UI_TextNodeDraw (uiNode_t *node)
 Draw a text node.
static void UI_TextNodeClick (uiNode_t *node, int x, int y)
 Calls the script command for a text node that is clickable.
static void UI_TextNodeRightClick (uiNode_t *node, int x, int y)
 Calls the script command for a text node that is clickable via right mouse button.
static void UI_TextNodeMouseWheel (uiNode_t *node, qboolean down, int x, int y)
static void UI_TextNodeLoading (uiNode_t *node)
static void UI_TextNodeLoaded (uiNode_t *node)
void UI_RegisterText2Node (uiBehaviour_t *behaviour)

Variables

static const value_t properties []

Detailed Description

Todo:
add getter/setter to cleanup access to extradata from cl_*.c files (check "u.text2.")

Definition in file ui_node_text2.c.


Define Documentation

#define EXTRADATA ( node   )     UI_EXTRADATA(node, EXTRADATA_TYPE)

Definition at line 39 of file ui_node_text2.c.

#define EXTRADATA_TYPE   text2ExtraData_t

Definition at line 38 of file ui_node_text2.c.

#define EXTRADATACONST ( node   )     UI_EXTRADATACONST(node, EXTRADATA_TYPE)

Definition at line 40 of file ui_node_text2.c.


Function Documentation

void UI_RegisterText2Node ( uiBehaviour_t behaviour  ) 
static void UI_TextNodeClick ( uiNode_t node,
int  x,
int  y 
) [static]

Calls the script command for a text node that is clickable.

See also:
UI_TextNodeRightClick

Definition at line 309 of file ui_node_text2.c.

References EXTRADATA, uiNode_s::onClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().

Referenced by UI_RegisterText2Node().

static void UI_TextNodeDraw ( uiNode_t node  )  [static]
static void UI_TextNodeDrawText ( uiNode_t node,
const linkedList_t list,
qboolean  noDraw 
) [static]

Handles linked list of text. Each element of the list must be a line of text without line break. A line break is betwwen 2 element of the list. Text line is wrapped/truncated... according to a node property.

Parameters:
[in] node The context node
[in] list The test to draw else NULL
[in] noDraw If true, calling of this function only update the cache (real number of lines)

Definition at line 156 of file ui_node_text2.c.

References uiNode_s::color, Com_sprintf(), linkedList_s::data, EXTRADATA, MAX_VAR, linkedList_s::next, uiNode_s::padding, pos, qtrue, R_Color(), R_FontTextSize(), uiNode_s::selectedColor, uiNode_s::size, uiNode_s::textalign, UI_AbstractScrollableNodeIsSizeChange(), UI_AbstractScrollableNodeSetY(), UI_DrawString(), UI_FontGetHeight(), UI_GetFontFromNode(), UI_GetNodeAbsPos(), and VectorScale.

Referenced by UI_TextNodeDraw(), and UI_TextUpdateCache().

static void UI_TextNodeGenerateLineSplit ( uiNode_t node  )  [static]
static int UI_TextNodeGetLine ( const uiNode_t node,
int  x,
int  y 
) [static]

Get the line number under an absolute position.

Parameters:
[in] node a text node
[in] x position x on the screen
[in] y position y on the screen
Returns:
The line number under the position (0 = first line)

Definition at line 116 of file ui_node_text2.c.

References EXTRADATACONST, int(), uiNode_s::padding, UI_FontGetHeight(), UI_GetFontFromNode(), UI_NodeAbsoluteToRelativePos(), and UI_NodeInstanceOf().

Referenced by UI_TextNodeClick(), UI_TextNodeMouseMove(), and UI_TextNodeRightClick().

static void UI_TextNodeLoaded ( uiNode_t node  )  [static]
static void UI_TextNodeLoading ( uiNode_t node  )  [static]

< Invalid/no line selected per default.

Definition at line 350 of file ui_node_text2.c.

References uiNode_s::color, EXTRADATA, uiNode_s::selectedColor, and Vector4Set.

Referenced by UI_RegisterText2Node().

static void UI_TextNodeMouseMove ( uiNode_t node,
int  x,
int  y 
) [static]

Definition at line 143 of file ui_node_text2.c.

References EXTRADATA, and UI_TextNodeGetLine().

Referenced by UI_RegisterText2Node().

static void UI_TextNodeMouseWheel ( uiNode_t node,
qboolean  down,
int  x,
int  y 
) [static]
static void UI_TextNodeRightClick ( uiNode_t node,
int  x,
int  y 
) [static]

Calls the script command for a text node that is clickable via right mouse button.

See also:
UI_TextNodeClick

Definition at line 326 of file ui_node_text2.c.

References EXTRADATA, uiNode_s::onRightClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().

Referenced by UI_RegisterText2Node().

static void UI_TextUpdateCache ( uiNode_t node  )  [static]
static void UI_TextValidateCache ( uiNode_t node  )  [static]

Definition at line 97 of file ui_node_text2.c.

References EXTRADATA, uiNode_s::text, TEXT_NULL, UI_GetDataVersion(), and UI_TextUpdateCache().

Referenced by UI_TextNodeDraw().


Variable Documentation

const value_t properties[] [static]
Initial value:
 {
    {NULL, V_NULL, 0, 0}
}

Definition at line 398 of file ui_node_text2.c.


Generated by  doxygen 1.6.2