26 #include "../ui_main.h"
27 #include "../ui_behaviour.h"
28 #include "../ui_parse.h"
29 #include "../ui_actions.h"
30 #include "../ui_font.h"
31 #include "../ui_input.h"
32 #include "../ui_sound.h"
33 #include "../ui_sprite.h"
34 #include "../ui_render.h"
35 #include "../ui_tooltip.h"
40 #include "../../cl_language.h"
41 #include "../../input/cl_input.h"
43 #include "../../../common/scripts_lua.h"
45 #define EXTRADATA_TYPE abstractOptionExtraData_t
46 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
47 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
76 if (x < 0 || y < 0 || x >= node->
box.
size[0] || y >= node->
box.
size[1])
100 if (tabWidth > allowedWidth) {
101 if (allowedWidth > 0)
102 tabWidth = allowedWidth;
110 allowedWidth -= tabWidth;
130 if (option ==
nullptr)
151 uiNode_t* overMouseOption =
nullptr;
158 int currentX = pos[0];
169 bool drawIcon =
false;
175 option = option->
next;
184 }
else if (option == overMouseOption) {
193 tabWidth = fontWidth;
198 if (tabWidth > allowedWidth) {
199 if (allowedWidth > 0)
200 tabWidth = allowedWidth;
216 OPTIONEXTRADATA(option).truncated = tabWidth < fontWidth || tabWidth == 0;
219 currentX += tabWidth;
220 allowedWidth -= tabWidth;
223 option = option->
next;
235 const int tooltipWidth = 250;
238 if (option ==
nullptr)
278 behaviour->
name =
"tab";
279 behaviour->
extends =
"abstractoption";
void draw(uiNode_t *node) override
static const int TILE_WIDTH
const char * UI_AbstractOption_GetCurrentValue(uiNode_t *node)
uiBehaviour_t * behaviour
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
void UI_PlaySound(const char *soundFile)
Plays a ui sound.
void Com_Printf(const char *const fmt,...)
void onLeftClick(uiNode_t *node, int x, int y) override
Handles tab clicks.
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.
#define OPTIONEXTRADATA(node)
SharedPtr< uiNode > UINodePtr
const char * UI_GetPath(const uiNode_t *node)
Return a path from a window to a node.
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
void onWindowOpened(uiNode_t *node, linkedList_t *params) override
#define EXTRADATACONST(node)
void UI_AbstractOption_SetCurrentValue(uiNode_t *node, const char *value)
Atomic structure used to define most of the UI.
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.
static const int TILE_HEIGHT
void drawTooltip(const uiNode_t *node, int x, int y) const override
Custom tooltip of tab node.
const char * CL_Translate(const char *t)
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
static uiNode_t * UI_TabNodeTabAtPosition(const uiNode_t *node, int x, int y)
Return a tab located at a screen position.
void UI_RegisterTabNode(uiBehaviour_t *behaviour)
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)
cvar_t * Cvar_ForceSet(const char *varName, const char *value)
Will set the variable even if NOSET or LATCH.
const uiBehaviour_t * ui_optionBehaviour
cvar_t * Cvar_FindVar(const char *varName)
Searches for a cvar given by parameter.