48#define EXTRADATA_TYPE abstractOptionExtraData_t
49#define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
83 else if (
EXTRADATA(node).lua_onViewChange != LUA_NOREF) {
129 const float* textColor;
150 currentY = pos[1] + node->
padding;
155 currentDecY = (fontHeight - height) / 2;
168 if (currentY + fontHeight > pos[1] + node->
box.
size[1] - node->
padding) {
182 }
else if (option->
color[3] == 0.0f) {
183 textColor = node->
color;
185 textColor = option->
color;
216 currentY += fontHeight;
280 bool down = deltaY > 0;
289 else if (
EXTRADATA(node).lua_onViewChange != LUA_NOREF) {
336 Com_Printf(
"UI_OptionTree_SelectValue: Option value \"%s\" not found\n", value);
354 updated =
EXTRADATA(node).scrollY.move(pos);
359 else if (
EXTRADATA(node).lua_onViewChange != LUA_NOREF) {
368 Com_Printf(
"UI_OptionTreeSetSelectedValue: Invalide number of param\n");
410 updated =
EXTRADATA(node).scrollY.moveDelta(deltaY);
415 else if (
EXTRADATA(node).lua_onViewChange != LUA_NOREF) {
433 int lineHeight =
EXTRADATA(node).lineHeight;
441 behaviour->
name =
"optiontree";
442 behaviour->
extends =
"abstractoption";
Header file for keyboard handler.
const char * CL_Translate(const char *t)
void R_Color(const vec4_t rgba)
Change the color to given value.
virtual void onMouseMove(uiNode_t *node, int x, int y)
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
Auto scroll the list.
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.
void doLayout(uiNode_t *node) override
Call to update the node layout. This common code revalidates the node tree.
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...
void onLoading(uiNode_t *node) override
Called before loading. Used to set default attribute values.
void onMouseUp(uiNode_t *node, int x, int y, int button) override
void onLeftClick(uiNode_t *node, int x, int y) override
Handles selectboxes clicks.
void onLoaded(uiNode_t *node) override
void draw(uiNode_t *node) override
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
void Com_Printf(const char *const fmt,...)
QGL_EXTERN int GLboolean GLfloat * v
Header for lua script functions.
node behaviour, how a node work
Contain the context of the calling of a function.
Atomic structure used to define most of the UI.
struct uiAction_s * onWheelDown
uiBehaviour_t * behaviour
struct uiAction_s * onWheel
struct uiAction_s * onWheelUp
uiNode_t * depthCache[MAX_DEPTH_OPTIONITERATORCACHE]
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
const char * UI_GetParam(const uiCallContext_t *context, int paramID)
int UI_GetParamNumber(const uiCallContext_t *context)
const struct value_s * UI_RegisterNodeMethod(uiBehaviour_t *behaviour, const char *name, uiNodeMethod_t function)
Register a node method to a behaviour.
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
uiNode_t * UI_InitOptionIteratorAtIndex(int index, uiNode_t *option, uiOptionIterator_t *iterator)
Init an option iterator at an index.
uiNode_t * UI_GetOption(int dataId)
int UI_FindOptionPosition(uiOptionIterator_t *iterator, const uiNode_t *option)
Find an option position from an option iterator.
uiNode_t * UI_OptionIteratorNextOption(uiOptionIterator_t *iterator)
Find the next element from the iterator Iterator skipCollapsed and skipInvisible attribute can contro...
int UI_GetDataVersion(int textId)
uiNode_t * UI_FindOptionByValue(uiOptionIterator_t *iterator, const char *value)
Find an option (and all his parents) by is value.
Data and interface to share data.
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.
Basic lua initialization for 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_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_AbstractOption_GetCurrentValue(uiNode_t *node)
void UI_AbstractOption_SetCurrentValue(uiNode_t *node, const char *value)
const uiBehaviour_t * ui_optionBehaviour
int UI_OptionUpdateCache(uiNode_t *option)
update option cache about child, according to collapse and visible status
#define OPTIONEXTRADATA(node)
static const int DEPTH_WIDTH
static void UI_OptionTreeNodeUpdateScroll(uiNode_t *node)
Update the scroll according to the number of items and the size of the node.
static void UI_OptionTreeNodeUpdateCache(uiNode_t *node)
static uiSprite_t * systemCollapse
static uiSprite_t * systemExpand
static uiNode_t * UI_OptionTreeNodeGetOptionAtPosition(uiNode_t *node, int x, int y, int *depth)
void UI_RegisterOptionTreeNode(uiBehaviour_t *behaviour)
void UI_OptionTree_SelectValue(uiNode_t *node, const char *value)
static const int COLLAPSEBUTTON_WIDTH
static void UI_OptionTreeSetSelectedValue(uiNode_t *node, const uiCallContext_t *context)
static uiNode_t * UI_OptionTreeNodeGetFirstOption(uiNode_t *node)
Return the first option of the node.
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)
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
#define Vector4Set(v, r, g, b, a)