25#include "../ui_main.h"
26#include "../ui_internal.h"
27#include "../ui_font.h"
28#include "../ui_actions.h"
29#include "../ui_parse.h"
30#include "../ui_render.h"
31#include "../ui_data.h"
38#include "../../client.h"
39#include "../../../shared/parse.h"
41#include "../../../common/scripts_lua.h"
43#define EXTRADATA(node) UI_EXTRADATA(node, textExtraData_t)
44#define EXTRADATACONST(node) UI_EXTRADATACONST(node, textExtraData_t)
55 if (lineHeight == 0) {
62 return (
int) (y / lineHeight) +
EXTRADATACONST(node).super.scrollY.viewPos;
92 viewSizeY = node->
box.
size[1] / lineHeight;
94 viewSizeY =
EXTRADATA(node).super.scrollY.viewSize;
103 colorHover[3] = node->
color[3];
118 const char* text = (
const char*) list->
data;
119 if (currentY > maxHeight)
139 currentY += lineHeight;
170 Com_Printf(
"UI_TextListNodeDraw: Only linkedlist text supported (dataid %d).\n",
EXTRADATA(node).dataID);
186 if (line < 0 || line >=
EXTRADATA(node).super.scrollY.fullSize)
189 if (line !=
EXTRADATA(node).textLineSelected) {
216 if (line < 0 || line >=
EXTRADATA(node).super.scrollY.fullSize)
219 if (line !=
EXTRADATA(node).textLineSelected) {
249 behaviour->
name =
"textlist";
void R_Color(const vec4_t rgba)
Change the color to given value.
void onLeftClick(uiNode_t *node, int x, int y) override
Calls the script command for a text node that is clickable.
void drawText(uiNode_t *node, const linkedList_t *list)
Handles line breaks and drawing for shared data text.
void onLoading(uiNode_t *node) override
void onRightClick(uiNode_t *node, int x, int y) override
Calls the script command for a text node that is clickable via right mouse button.
void draw(uiNode_t *node) override
Draw a text node.
void onMouseMove(uiNode_t *node, int x, int y) override
void Com_Printf(const char *const fmt,...)
align_t
We need this here for checking the boundaries from script values.
node behaviour, how a node work
uiSharedData_t sharedData[UI_MAX_DATAID]
Holds shared data.
Atomic structure used to define most of the UI.
LUA_EVENT lua_onRightClick
struct uiAction_s * onChange
struct uiAction_s * onClick
struct uiAction_s * onRightClick
linkedList_t * linkedListText
Holds a linked list for displaying in the UI.
union uiSharedData_t::@18 data
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
void UI_ResetData(int dataId)
Reset a shared data. Type became NONE and value became nullptr.
@ UI_SHARED_LINKEDLISTTEXT
int UI_FontGetHeight(const char *fontID)
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
bool UI_ExecuteLuaEventScript_XY(uiNode_t *node, LUA_EVENT event, int x, int y)
Executes a lua event handler with (x,y) argument.
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 UI_NodeAbsoluteToRelativePos(const uiNode_t *node, int *x, int *y)
Update an absolute position to a relative one.
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
SharedPtr< uiNode > UINodePtr
const char * UI_TextNodeGetSelectedText(uiNode_t *node, int num)
static int UI_TextListNodeGetLine(const uiNode_t *node, int x, int y)
Get the line number under an absolute position.
void UI_RegisterTextListNode(uiBehaviour_t *behaviour)
#define EXTRADATACONST(node)
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
#define Vector4Set(v, r, g, b, a)
#define VectorScale(in, scale, out)