27 #include "../ui_nodes.h"
28 #include "../ui_parse.h"
29 #include "../ui_internal.h"
30 #include "../ui_lua.h"
34 #include "../../input/cl_input.h"
35 #include "../../input/cl_keys.h"
37 #include "../../../common/scripts_lua.h"
39 #define EXTRADATA_TYPE abstractValueExtraData_t
40 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
41 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
48 if (*adress ==
nullptr) {
50 **adress = defaultValue;
57 if (
Q_strstart(*(
const char*
const*)sourceData,
"*cvar:")) {
61 *(
const char**)cloneData = *(
const char*
const*)sourceData;
66 **cloneData = **sourceData;
73 if ((*data !=
nullptr) &&
Q_strstart((
char*)(*data),
"*cvar:")) {
87 EXTRADATA(node).shiftIncreaseFactor = 2.0F;
150 return EXTRADATA(node).shiftIncreaseFactor;
178 else if (value > max)
262 return setValue(node, value + delta);
269 return setValue(node, value - delta);
401 EXTRADATA(node).shiftIncreaseFactor = factor;
406 behaviour->
name =
"abstractvalue";
bool setMax(uiNode_t *node, float max)
float UI_AbstractValue_GetMax(uiNode_t *node)
float getDelta(uiNode_t const *node)
float getShiftIncreaseFactor(uiNode_t *const node)
float UI_AbstractValue_GetLastDiff(uiNode_t *node)
float getMin(uiNode_t const *node)
virtual void initNodeDynamic(uiNode_t *node)
void clone(uiNode_t const *source, uiNode_t *clone) override
Call to update a cloned node.
bool incValue(uiNode_t *node)
struct uiAction_s * onChange
static void UI_InitCvarOrFloat(float **adress, float defaultValue)
Allocates a float and initializes it if the pointer value is not set, else does nothing.
virtual void onLoaded(uiNode_t *node)
float * UI_AllocStaticFloat(int count)
Allocate a float into the UI static memory.
uiBehaviour_t * behaviour
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
Define common thing for GUI controls which allow to edit a value (scroolbar, spinner, and more)
virtual void onLoading(uiNode_t *node)
virtual void clone(uiNode_t const *source, uiNode_t *clone)
float UI_AbstractValue_GetValue(uiNode_t *node)
void deleteNode(uiNode_t *node) override
static void UI_CloneCvarOrFloat(const uiNode_t *source, uiNode_t *clone, const float *const *sourceData, float **cloneData)
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
float getFactorFloat(uiNode_t const *node)
float getMax(uiNode_t const *node)
void UI_AbstractValue_IncValue(uiNode_t *node)
float UI_AbstractValue_GetDelta(uiNode_t *node)
void UI_AbstractValue_SetDelta(uiNode_t *node, float delta)
float getLastDiff(uiNode_t const *node)
float UI_AbstractValue_GetShiftIncreaseFactor(uiNode_t *node)
void UI_AbstractValue_DecValue(uiNode_t *node)
SharedPtr< uiNode > UINodePtr
bool setDelta(uiNode_t *node, float delta)
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
float UI_AbstractValue_GetMin(uiNode_t *node)
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_AbstractValue_SetValue(uiNode_t *node, float value)
#define EXTRADATACONST(node)
float UI_GetReferenceFloat(const uiNode_t *const node, const void *ref)
Returns the value of the reference variable.
void UI_AbstractValue_SetMin(uiNode_t *node, float min)
void UI_AbstractValue_SetRange(uiNode_t *node, float min, float max)
bool Key_IsDown(unsigned int key)
Checks whether a given key is currently pressed.
void UI_AbstractValue_SetRangeCvar(uiNode_t *node, const char *min, const char *max)
void onLoaded(uiNode_t *node) override
virtual void initNode(uiNode_t *node)
bool setMin(uiNode_t *node, float min)
node behaviour, how a node work
static void UI_FreeCvarOrFloat(const uiNode_t *node, void **data)
void UI_RegisterAbstractValueNode(uiBehaviour_t *behaviour)
void UI_AbstractValue_SetMax(uiNode_t *node, float max)
virtual void deleteNode(uiNode_t *node)
bool setValue(uiNode_t *node, float value)
void UI_AbstractValue_SetMinCvar(uiNode_t *node, const char *min)
void onLoading(uiNode_t *node) override
GLsizei const GLvoid * data
#define Mem_PoolAllocType(type, pool)
void initNode(uiNode_t *node) override
float getValue(uiNode_t const *node)
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
void UI_AbstractValue_SetShiftIncreaseFactor(uiNode_t *node, float factor)
void setRange(uiNode_t *node, float min, float max)
bool decValue(uiNode_t *node)
void UI_AbstractValue_SetValueCvar(uiNode_t *node, const char *value)
void initNodeDynamic(uiNode_t *node) override
void UI_AbstractValue_SetMaxCvar(uiNode_t *node, const char *max)