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"
32 #include "../ui_lua.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];
109 while (list && count <
EXTRADATA(node).super.scrollY.viewPos) {
118 const char* text = (
const char*) list->
data;
119 if (currentY > maxHeight)
123 if (count ==
EXTRADATA(node).textLineSelected &&
EXTRADATA(node).textLineSelected >= 0)
130 if (count ==
EXTRADATA(node).textLineSelected &&
EXTRADATA(node).textLineSelected >= 0)
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";
static int UI_TextListNodeGetLine(const uiNode_t *node, int x, int y)
Get the line number under an absolute position.
void onLeftClick(uiNode_t *node, int x, int y) override
Calls the script command for a text node that is clickable.
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
struct uiAction_s * onChange
uiSharedData_t sharedData[UI_MAX_DATAID]
Holds shared data.
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
void Com_Printf(const char *const fmt,...)
void onMouseMove(uiNode_t *node, int x, int y) override
void onLoading(uiNode_t *node) override
struct uiAction_s * onClick
void draw(uiNode_t *node) override
Draw a text node.
#define VectorScale(in, scale, out)
void R_Color(const vec4_t rgba)
Change the color to given value.
align_t
We need this here for checking the boundaries from script values.
LUA_EVENT lua_onRightClick
void UI_ResetData(int dataId)
Reset a shared data. Type became NONE and value became nullptr.
linkedList_t * linkedListText
Holds a linked list for displaying in the UI.
#define Vector4Set(v, r, g, b, a)
void UI_RegisterTextListNode(uiBehaviour_t *behaviour)
SharedPtr< uiNode > UINodePtr
const char * UI_TextNodeGetSelectedText(uiNode_t *node, int num)
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
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.
bool UI_ExecuteLuaEventScript_XY(uiNode_t *node, LUA_EVENT event, int x, int y)
Executes a lua event handler with (x,y) argument.
Atomic structure used to define most of the UI.
#define EXTRADATACONST(node)
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_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
struct uiAction_s * onRightClick
union uiSharedData_s::@18 data
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
void UI_NodeAbsoluteToRelativePos(const uiNode_t *node, int *x, int *y)
Update an absolute position to a relative one.
node behaviour, how a node work
int UI_FontGetHeight(const char *fontID)
void drawText(uiNode_t *node, const linkedList_t *list)
Handles line breaks and drawing for shared data text.