26 #include "../ui_main.h"
27 #include "../ui_internal.h"
28 #include "../ui_font.h"
29 #include "../ui_actions.h"
30 #include "../ui_parse.h"
31 #include "../ui_render.h"
32 #include "../ui_sprite.h"
37 #include "../../client.h"
38 #include "../../../shared/parse.h"
40 #include "../../../common/scripts_lua.h"
42 #define EXTRADATA(node) UI_EXTRADATA(node, abstractScrollableExtraData_t)
43 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, abstractScrollableExtraData_t)
55 #define TIMESTAMP_TEXT 24
76 messageStack =
nullptr;
82 messageStack = message;
96 return std::max(lines1, lines2);
109 iconName =
"icons/message_info";
118 int lines1 = *screenLines;
119 int lines2 = *screenLines;
128 UI_DrawString(fontID,
ALIGN_UL, x, y, x, column1,
LINEHEIGHT, message->
timestamp,
EXTRADATACONST(node).scrollY.viewSize, 0, &lines1,
true,
LONGLINES_WRAP);
143 UI_DrawString(fontID,
ALIGN_UL, x, y, x, column2,
LINEHEIGHT, message->
text,
EXTRADATACONST(node).scrollY.viewSize, 0, &lines2,
true,
LONGLINES_WRAP);
145 *screenLines = std::max(lines1, lines2);
189 message = message->
next;
198 message = message->
next;
215 while (message && posY > 0) {
219 message = message->
next;
230 message = message->
next;
236 bool down = deltaY > 0;
240 updated =
scrollY(node, (down ? 1 : -1));
308 behaviour->
name =
"messagelist";
309 behaviour->
extends =
"abstractscrollable";
static const int LINEHEIGHT
bool Q_strnull(const char *string)
struct uiAction_s * onWheelDown
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
struct uiMessageListNodeMessage_s uiMessageListNodeMessage_t
void UI_MessageAddStack(struct uiMessageListNodeMessage_s *message)
char timestamp[TIMESTAMP_TEXT]
static uiMessageListNodeMessage_t * messageStack
void UI_RegisterMessageListNode(uiBehaviour_t *behaviour)
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
static uiSprite_t * UI_MessageGetIcon(const uiMessageListNodeMessage_t *message)
virtual void onMouseMove(uiNode_t *node, int x, int y)
void onLoading(uiNode_t *node) override
void draw(uiNode_t *node) override
Draws the messagesystem node.
void R_Color(const vec4_t rgba)
Change the color to given value.
static int UI_MessageGetLines(const uiNode_t *node, uiMessageListNodeMessage_t *message, const char *fontID, int width)
int getCellHeight(uiNode_t *node) override
Return size of the cell, which is the size (in virtual "pixel") which represent 1 in the scroll value...
struct uiMessageListNodeMessage_s * UI_MessageGetStack(void)
void R_FontTextSize(const char *fontId, const char *text, int maxWidth, longlines_t method, int *width, int *height, int *lines, bool *isTruncated)
Supply information about the size of the text when it is linewrapped and rendered, without actually rendering it. Any of the output parameters may be nullptr.
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
#define Vector4Set(v, r, g, b, a)
struct uiAction_s * onWheelUp
void UI_MessageResetStack(void)
void onMouseDown(uiNode_t *node, int x, int y, int button) override
Track mouse down/up events to implement drag&drop-like scrolling, for touchscreen devices...
SharedPtr< uiNode > UINodePtr
Engine-side time information in the game.
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
Atomic structure used to define most of the UI.
static void UI_MessageDraw(const uiNode_t *node, uiMessageListNodeMessage_t *message, const char *fontID, int x, int y, int width, int *screenLines)
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.
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
#define EXTRADATACONST(node)
void onMouseUp(uiNode_t *node, int x, int y, int button) override
node behaviour, how a node work
struct uiAction_s * onWheel
int UI_DrawString(const char *fontID, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, bool increaseLine, longlines_t method)
static const int DATETIME_COLUUI_SIZE
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
struct uiMessageListNodeMessage_s * next