#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_text.h"
#include "ui_node_abstractnode.h"
#include "../../client.h"
#include "../../../shared/parse.h"
Go to the source code of this file.
Defines | |
#define | EXTRADATA_TYPE textExtraData_t |
#define | EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE) |
#define | EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE) |
#define | UI_TEXTNODE_BUFFERSIZE 32768 |
Functions | |
static void | UI_TextUpdateCache (uiNode_t *node) |
static void | UI_TextValidateCache (uiNode_t *node) |
void | UI_TextNodeSelectLine (uiNode_t *node, int num) |
Change the selected line. | |
void | UI_TextScrollEnd (const char *nodePath) |
Scroll to the bottom. | |
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 char *text, const linkedList_t *list, qboolean noDraw) |
Handles line breaks and drawing for shared data id. | |
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_RegisterTextNode (uiBehaviour_t *behaviour) |
Variables | |
static const value_t | properties [] |
Definition in file ui_node_text.c.
#define EXTRADATA | ( | node | ) | UI_EXTRADATA(node, EXTRADATA_TYPE) |
Definition at line 39 of file ui_node_text.c.
#define EXTRADATA_TYPE textExtraData_t |
Definition at line 38 of file ui_node_text.c.
#define EXTRADATACONST | ( | node | ) | UI_EXTRADATACONST(node, EXTRADATA_TYPE) |
Definition at line 40 of file ui_node_text.c.
#define UI_TEXTNODE_BUFFERSIZE 32768 |
Definition at line 132 of file ui_node_text.c.
Referenced by UI_TextNodeDrawText().
void UI_RegisterTextNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 533 of file ui_node_text.c.
References Com_RegisterConstInt(), uiBehaviour_s::draw, uiBehaviour_s::extends, EXTRADATA_TYPE, uiBehaviour_s::extraDataSize, uiBehaviour_s::leftClick, uiBehaviour_s::loaded, uiBehaviour_s::loading, LONGLINES_CHOP, LONGLINES_PRETTYCHOP, LONGLINES_WRAP, uiBehaviour_s::mouseMove, uiBehaviour_s::mouseWheel, uiBehaviour_s::name, uiBehaviour_s::properties, uiBehaviour_s::rightClick, UI_TextNodeClick(), UI_TextNodeDraw(), UI_TextNodeLoaded(), UI_TextNodeLoading(), UI_TextNodeMouseMove(), UI_TextNodeMouseWheel(), and UI_TextNodeRightClick().
static void UI_TextNodeClick | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Calls the script command for a text node that is clickable.
Definition at line 404 of file ui_node_text.c.
References EXTRADATA, uiNode_s::onClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().
Referenced by UI_RegisterTextNode().
static void UI_TextNodeDraw | ( | uiNode_t * | node | ) | [static] |
Draw a text node.
Definition at line 367 of file ui_node_text.c.
References _, uiSharedData_s::data, EXTRADATA, uiSharedData_s::linkedListText, qfalse, uiGlobal_s::sharedData, uiSharedData_s::text, uiNode_s::text, TEXT_NULL, uiSharedData_s::type, UI_GetReferenceString(), ui_global, UI_SHARED_LINKEDLISTTEXT, UI_SHARED_TEXT, UI_TextNodeDrawText(), and uiSharedData_s::versionId.
Referenced by UI_RegisterTextNode().
static void UI_TextNodeDrawText | ( | uiNode_t * | node, | |
const char * | text, | |||
const linkedList_t * | list, | |||
qboolean | noDraw | |||
) | [static] |
Handles line breaks and drawing for shared data id.
[in] | node | The context node |
[in] | text | The test to draw else NULL |
[in] | list | The test to draw else NULL |
[in] | noDraw | If true, calling of this function only update the cache (real number of lines) |
< Nothing to draw
Definition at line 142 of file ui_node_text.c.
References uiNode_s::color, Com_sprintf(), linkedList_s::data, EXTRADATA, LONGLINES_PRETTYCHOP, MAX_VAR, linkedList_s::next, uiNode_s::padding, pos, Q_strncpyz(), qfalse, qtrue, R_Color(), R_FontTextSize(), uiNode_s::selectedColor, uiNode_s::size, uiNode_s::state, uiNode_s::textalign, UI_AbstractScrollableNodeIsSizeChange(), UI_AbstractScrollableNodeSetY(), UI_DrawString(), UI_FontGetHeight(), UI_GetFontFromNode(), UI_GetNodeAbsPos(), UI_TEXTNODE_BUFFERSIZE, and VectorScale.
Referenced by UI_TextNodeDraw(), and UI_TextUpdateCache().
static int UI_TextNodeGetLine | ( | const uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Get the line number under an absolute position.
[in] | node | a text node |
[in] | x | position x on the screen |
[in] | y | position y on the screen |
Definition at line 100 of file ui_node_text.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] |
Definition at line 454 of file ui_node_text.c.
References Com_Error(), Com_Printf(), ERR_DROP, EXTRADATA, uiNode_s::size, uiNode_s::text, TEXT_NULL, UI_FontGetHeight(), UI_GetFontFromNode(), UI_GetPath(), and UI_MAX_DATAID.
Referenced by UI_RegisterTextNode().
static void UI_TextNodeLoading | ( | uiNode_t * | node | ) | [static] |
< Invalid/no line selected per default.
Definition at line 447 of file ui_node_text.c.
References uiNode_s::color, EXTRADATA, uiNode_s::selectedColor, and Vector4Set.
Referenced by UI_RegisterTextNode().
static void UI_TextNodeMouseMove | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Definition at line 127 of file ui_node_text.c.
References EXTRADATA, and UI_TextNodeGetLine().
Referenced by UI_RegisterTextNode().
Definition at line 436 of file ui_node_text.c.
References uiNode_s::onWheel, uiNode_s::onWheelDown, uiNode_s::onWheelUp, UI_AbstractScrollableNodeScrollY(), and UI_ExecuteEventActions().
Referenced by UI_RegisterTextNode().
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.
Definition at line 421 of file ui_node_text.c.
References EXTRADATA, uiNode_s::onRightClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().
Referenced by UI_RegisterTextNode().
void UI_TextNodeSelectLine | ( | uiNode_t * | node, | |
int | num | |||
) |
Change the selected line.
Definition at line 59 of file ui_node_text.c.
References EXTRADATA, uiNode_s::onChange, and UI_ExecuteEventActions().
Referenced by CL_DisplayHomebasePopup(), GAME_CP_CampaignListClick_f(), HUD_PopupFiremodeReservation(), HUD_ShotReserve_f(), UI_TextNodeClick(), and UI_TextNodeRightClick().
void UI_TextScrollEnd | ( | const char * | nodePath | ) |
Scroll to the bottom.
[in] | nodePath | absolute path |
Definition at line 72 of file ui_node_text.c.
References Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, EXTRADATA, UI_ExecuteEventActions(), UI_GetNodeByPath(), UI_NodeInstanceOf(), and UI_TextValidateCache().
Referenced by Irc_AppendToBuffer().
static void UI_TextUpdateCache | ( | uiNode_t * | node | ) | [static] |
Definition at line 336 of file ui_node_text.c.
References _, uiSharedData_s::data, EXTRADATA, uiSharedData_s::linkedListText, qtrue, uiGlobal_s::sharedData, uiSharedData_s::text, uiNode_s::text, TEXT_NULL, uiSharedData_s::type, ui_global, UI_SHARED_LINKEDLISTTEXT, UI_SHARED_TEXT, UI_TextNodeDrawText(), and uiSharedData_s::versionId.
Referenced by UI_TextValidateCache().
static void UI_TextValidateCache | ( | uiNode_t * | node | ) | [static] |
Definition at line 44 of file ui_node_text.c.
References EXTRADATA, uiNode_s::text, TEXT_NULL, UI_GetDataVersion(), and UI_TextUpdateCache().
Referenced by UI_TextScrollEnd().
const value_t properties[] [static] |
{ {"lineselected", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, textLineSelected), MEMBER_SIZEOF(textExtraData_t, textLineSelected)}, {"dataid", V_UI_DATAID, UI_EXTRADATA_OFFSETOF(textExtraData_t, dataID), MEMBER_SIZEOF(textExtraData_t, dataID)}, {"lineheight", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, lineHeight), MEMBER_SIZEOF(textExtraData_t, lineHeight)}, {"tabwidth", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, tabWidth), MEMBER_SIZEOF(textExtraData_t, tabWidth)}, {"longlines", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, longlines), MEMBER_SIZEOF(textExtraData_t, longlines)}, {"rows", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, super.scrollY.viewSize), MEMBER_SIZEOF(textExtraData_t, super.scrollY.viewSize)}, {"lines", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, super.scrollY.fullSize), MEMBER_SIZEOF(textExtraData_t, super.scrollY.fullSize)}, {"mousefx", V_BOOL, UI_EXTRADATA_OFFSETOF(textExtraData_t, mousefx), MEMBER_SIZEOF(textExtraData_t, mousefx)}, {NULL, V_NULL, 0, 0} }
Definition at line 495 of file ui_node_text.c.