27 #include "../ui_nodes.h"
28 #include "../ui_behaviour.h"
29 #include "../ui_parse.h"
30 #include "../ui_timer.h"
31 #include "../ui_actions.h"
32 #include "../ui_input.h"
33 #include "../ui_render.h"
34 #include "../ui_lua.h"
40 #include "../../input/cl_input.h"
41 #include "../../input/cl_keys.h"
43 #include "../../../common/scripts_lua.h"
55 #define EXTRADATA(node) UI_EXTRADATA(node, abstractScrollbarExtraData_t)
63 const int low = cuttableSize * ((float)(
EXTRADATA(node).pos + 0) / (
float)
EXTRADATA(node).fullsize);
64 const int middle = cuttableSize * ((float)(
EXTRADATA(node).viewsize) / (
float)
EXTRADATA(node).fullsize);
65 const int hight = cuttableSize - low - middle;
69 description[3] = hight;
71 assert(description[0] + description[1] + description[2] + description[3] + description[4] == node->
box.
size[1]);
83 for (
int i = 0;
i < 5;
i++) {
84 if (y < description[
i])
117 switch (hoveredElement) {
202 capturedTimer =
nullptr;
227 const int posSize =
EXTRADATA(node).fullsize;
234 const int pos =
oldPos + (((float)y * (
float)posSize) / (
float)graphicSize);
285 int hoveredElement = -1;
290 else if (node->
state)
295 texX = (hoveredElement == 0) ?
TILE_WIDTH : 0;
302 if (description[1]) {
303 texX = (hoveredElement == 1) ?
TILE_WIDTH : 0;
312 texX = (hoveredElement == 2) ?
TILE_WIDTH : 0;
321 if (description[2]) {
337 if (description[3]) {
338 texX = (hoveredElement == 3) ?
TILE_WIDTH : 0;
348 texX = (hoveredElement == 4) ?
TILE_WIDTH : 0;
369 behaviour->
name =
"vscrollbar";
370 behaviour->
extends =
"abstractscrollbar";
#define UI_RegisterNodeProperty(BEHAVIOUR, NAME, TYPE, OBJECTTYPE, ATTRIBUTE)
Initialize a property.
uiTimer_t * UI_AllocTimer(uiNode_t *node, int firstDelay, timerCallback_t callback)
Allocate a new time for a node.
SharedPtr< uiNode > UINodePtr
const struct image_s * UI_LoadImage(const char *name)
Searches for an image in the image array.
const char * UI_GetPath(const uiNode_t *node)
Return a path from a window to a node.
void UI_TimerRelease(uiTimer_t *timer)
Release the timer. It no more exists.
void UI_DrawNormImage(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const image_t *image)
Draw a normalized (to the screen) image.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
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.
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
void UI_TimerStart(uiTimer_t *timer)
Restart a timer.