26 #include "../ui_nodes.h"
27 #include "../ui_parse.h"
28 #include "../ui_behaviour.h"
29 #include "../ui_main.h"
30 #include "../ui_input.h"
31 #include "../ui_timer.h"
32 #include "../ui_actions.h"
33 #include "../ui_render.h"
34 #include "../ui_sprite.h"
38 #include "../../input/cl_input.h"
39 #include "../../input/cl_keys.h"
41 #include "../../../common/scripts_lua.h"
43 #define EXTRADATA_TYPE spinnerExtraData_t
44 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
45 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
94 return x > node->
box.
size[0] * 0.5;
95 return y < node->
box.
size[1] * 0.5;
134 capturedTimer =
nullptr;
143 bool down = deltaY > 0;
149 return step(node, down);
164 if (disabled || delta == 0) {
170 const float min =
getMin(node);
171 const float max =
getMax(node);
178 if (node->
state && increaseLocation) {
184 if (node->
state && !increaseLocation) {
242 behaviour->
name =
"spinner";
243 behaviour->
extends =
"abstractvalue";
float getDelta(uiNode_t const *node)
float getMin(uiNode_t const *node)
bool incValue(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)
uiTimer_t * UI_AllocTimer(uiNode_t *node, int firstDelay, timerCallback_t callback)
Allocate a new time for a node.
void UI_RegisterSpinnerNode(uiBehaviour_t *behaviour)
static void UI_SpinnerNodeRepeat(uiNode_t *node, uiTimer_t *timer)
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
float getMax(uiNode_t const *node)
bool step(uiNode_t *node, bool down)
change the value of the spinner of one step
void UI_Spinner_SetBottomIconByName(uiNode_t *node, const char *name)
void draw(uiNode_t *node) override
SharedPtr< uiNode > UINodePtr
void onMouseDown(uiNode_t *node, int x, int y, int button) override
static bool capturedDownButton
void UI_TimerRelease(uiTimer_t *timer)
Release the timer. It no more exists.
void onCapturedMouseLost(uiNode_t *node) override
Called when the node have lost the captured node We clean cached data.
void UI_Spinner_SetTopIconByName(uiNode_t *node, const char *name)
#define UI_EXTRADATA(NODE, TYPE)
void onLoading(uiNode_t *node) override
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 Com_RegisterConstInt(const char *name, int value)
Register mappings between script strings and enum values for values of the type V_INT.
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
void repeat(uiNode_t *node, struct uiTimer_s *timer)
void onMouseUp(uiNode_t *node, int x, int y, int button) override
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
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
bool isPositionIncrease(uiNode_t *node, int x, int y)
Check a position relative to the node to check action is can produce.
static uiTimer_t * capturedTimer
void onLoading(uiNode_t *node) override
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
float getValue(uiNode_t const *node)
void UI_TimerStart(uiTimer_t *timer)
Restart a timer.
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
bool decValue(uiNode_t *node)
void UI_Spinner_SetBackgroundByName(uiNode_t *node, const char *name)