UFO: Alien Invasion
ui_node_radiobutton.cpp File Reference

The radiobutton is a clickable widget. Commonly, with use it in a group of radiobuttons; the user is allowed to choose only one button from this set. The current implementation share the value of the group with a cvar, and each button use is own value. When the cvar equals to a button value, this button is selected. More...

#include "../ui_main.h"
#include "../ui_actions.h"
#include "../ui_sprite.h"
#include "../ui_parse.h"
#include "../ui_behaviour.h"
#include "../ui_input.h"
#include "../ui_render.h"
#include "../ui_lua.h"
#include "ui_node_radiobutton.h"
#include "ui_node_abstractnode.h"
#include "../../../common/scripts_lua.h"
Include dependency graph for ui_node_radiobutton.cpp:

Go to the source code of this file.

Macros

#define EXTRADATA_TYPE   radioButtonExtraData_t
 
#define EXTRADATA(node)   UI_EXTRADATA(node, EXTRADATA_TYPE)
 
#define EXTRADATACONST(node)   UI_EXTRADATACONST(node, EXTRADATA_TYPE)
 
#define EPSILON   0.001f
 
#define UI_4STATUS_TEX_HEIGHT   64
 

Functions

static bool UI_RadioButtonNodeIsSelected (uiNode_t *node)
 
const char * UI_RadioButton_GetCvar (uiNode_t *node)
 
void UI_RadioButton_SetCvar (uiNode_t *node, const char *name)
 
void UI_RadioButton_SetValue (uiNode_t *node, const char *value)
 
void UI_RadioButton_SetValue (uiNode_t *node, float value)
 
void UI_RadioButton_SetBackgroundByName (uiNode_t *node, const char *name)
 
void UI_RadioButton_SetIconByName (uiNode_t *node, const char *name)
 
void UI_RegisterRadioButtonNode (uiBehaviour_t *behaviour)
 

Detailed Description

The radiobutton is a clickable widget. Commonly, with use it in a group of radiobuttons; the user is allowed to choose only one button from this set. The current implementation share the value of the group with a cvar, and each button use is own value. When the cvar equals to a button value, this button is selected.

radiobutton foo {
cvar "*cvar:foobar"
value 4
icon boo
}

Definition in file ui_node_radiobutton.cpp.

Macro Definition Documentation

◆ EPSILON

#define EPSILON   0.001f

Definition at line 55 of file ui_node_radiobutton.cpp.

◆ EXTRADATA

#define EXTRADATA (   node)    UI_EXTRADATA(node, EXTRADATA_TYPE)

Definition at line 52 of file ui_node_radiobutton.cpp.

◆ EXTRADATA_TYPE

#define EXTRADATA_TYPE   radioButtonExtraData_t

Definition at line 51 of file ui_node_radiobutton.cpp.

◆ EXTRADATACONST

#define EXTRADATACONST (   node)    UI_EXTRADATACONST(node, EXTRADATA_TYPE)

Definition at line 53 of file ui_node_radiobutton.cpp.

◆ UI_4STATUS_TEX_HEIGHT

#define UI_4STATUS_TEX_HEIGHT   64

Height of a status in a 4 status 256*256 texture

Definition at line 58 of file ui_node_radiobutton.cpp.

Function Documentation

◆ UI_RadioButton_GetCvar()

const char * UI_RadioButton_GetCvar ( uiNode_t node)

Definition at line 166 of file ui_node_radiobutton.cpp.

References EXTRADATA.

Referenced by uiRadioButtonNode_t_cvar().

◆ UI_RadioButton_SetBackgroundByName()

void UI_RadioButton_SetBackgroundByName ( uiNode_t node,
const char *  name 
)

Definition at line 193 of file ui_node_radiobutton.cpp.

References EXTRADATA, name, and UI_GetSpriteByName().

Referenced by uiRadioButtonNode_t_set_background().

◆ UI_RadioButton_SetCvar()

void UI_RadioButton_SetCvar ( uiNode_t node,
const char *  name 
)

Definition at line 170 of file ui_node_radiobutton.cpp.

References Cvar_Get(), EXTRADATA, name, and cvar_t::name.

Referenced by uiRadioButtonNode_t_set_cvar().

◆ UI_RadioButton_SetIconByName()

void UI_RadioButton_SetIconByName ( uiNode_t node,
const char *  name 
)

Definition at line 198 of file ui_node_radiobutton.cpp.

References EXTRADATA, name, and UI_GetSpriteByName().

Referenced by uiRadioButtonNode_t_set_icon().

◆ UI_RadioButton_SetValue() [1/2]

◆ UI_RadioButton_SetValue() [2/2]

void UI_RadioButton_SetValue ( uiNode_t node,
float  value 
)

◆ UI_RadioButtonNodeIsSelected()

static bool UI_RadioButtonNodeIsSelected ( uiNode_t node)
static

◆ UI_RegisterRadioButtonNode()