43#define EXTRADATA_TYPE barExtraData_t
44#define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
51 const float min =
getMin(node);
52 const float max =
getMax(node);
62 color[3] = node->
color[3];
67 fac = (value - min) / (max - min);
70 if (fac <= 0 || fac > 1)
101 else if (x > node->
box.
size[0])
105 else if (y > node->
box.
size[1])
109 const float min =
getMin(node);
110 const float max =
getMax(node);
117 frac = (float) y / node->
box.
size[1];
120 frac = (float) x / node->
box.
size[0];
127 Com_Printf(
"UI_BarNodeCapturedMouseMove: Orientation %d not supported\n",
EXTRADATA(node).orientation);
131 setValue(node, min + frac * (max - min));
162 behaviour->
name =
"bar";
163 behaviour->
extends =
"abstractvalue";
Header file for keyboard handler.
float getValue(uiNode_t const *node)
bool setValue(uiNode_t *node, float value)
float getMax(uiNode_t const *node)
float getMin(uiNode_t const *node)
void onMouseUp(uiNode_t *node, int x, int y, int button) override
void onMouseDown(uiNode_t *node, int x, int y, int button) override
void draw(uiNode_t *node) override
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
Called when the node is captured by the mouse.
void onLoading(uiNode_t *node) override
Called before loading. Used to set default attribute values.
void Com_Printf(const char *const fmt,...)
Header for lua script functions.
node behaviour, how a node work
Atomic structure used to define most of the UI.
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of 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_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
Define common thing for GUI controls which allow to edit a value (scroolbar, spinner,...
void UI_RegisterBarNode(uiBehaviour_t *behaviour)
static const vec3_t scale
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
#define Vector4Set(v, r, g, b, a)
#define Vector4Copy(src, dest)
#define VectorScale(in, scale, out)