#include "radiobutton.qh"
-#ifndef RADIOBUTTON_H
-#define RADIOBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticRadioButton, RadioButton)
- METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string, string));
- METHOD(XonoticRadioButton, draw, void(entity));
- METHOD(XonoticRadioButton, setChecked, void(entity, float));
- ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
- ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
- ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
- ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
- ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
- ATTRIB(XonoticRadioButton, cvarName, string, string_null)
- ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
- ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
- ATTRIB(XonoticRadioButton, cvarValueIsAnotherCvar, float, 0)
- METHOD(XonoticRadioButton, loadCvars, void(entity));
- METHOD(XonoticRadioButton, saveCvars, void(entity));
-
- ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticRadioButton)
-entity makeXonoticRadioButton_T(float, string, string, string, string theTooltip);
-entity makeXonoticRadioButton(float, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticRadioButton_T(float theGroup, string theCvar, string theValue, string theText, string theTooltip)
{
entity me;
}
void XonoticRadioButton_configureXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText, string theTooltip)
{
- me.cvarName = (theCvar) ? theCvar : string_null;
+ me.controlledCvar = (theCvar) ? theCvar : string_null;
me.cvarValue = theValue;
me.loadCvars(me);
setZonedTooltip(me, theTooltip, theCvar);
{
if(me.cvarValue)
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
if(me.cvarValueIsAnotherCvar)
- me.checked = (cvar_string(me.cvarName) == cvar_string(me.cvarValue));
+ me.checked = (cvar_string(me.controlledCvar) == cvar_string(me.cvarValue));
else
- me.checked = (cvar_string(me.cvarName) == me.cvarValue);
+ me.checked = (cvar_string(me.controlledCvar) == me.cvarValue);
}
}
else
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
- me.checked = boolean(cvar(me.cvarName));
+ me.checked = boolean(cvar(me.controlledCvar));
}
else
{
void XonoticRadioButton_draw(entity me)
{
if (!me.cvarValue)
- if (!me.cvarName)
+ if (!me.controlledCvar)
{
// this is the "other" option
// always select this if none other is
{
if(me.cvarValue)
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
if(me.checked)
{
if(me.cvarValueIsAnotherCvar)
- cvar_set(me.cvarName, cvar_string(me.cvarValue));
+ cvar_set(me.controlledCvar, cvar_string(me.cvarValue));
else
- cvar_set(me.cvarName, me.cvarValue);
+ cvar_set(me.controlledCvar, me.cvarValue);
}
else if(me.cvarOffValue)
- cvar_set(me.cvarName, me.cvarOffValue);
+ cvar_set(me.controlledCvar, me.cvarOffValue);
}
}
else
{
- if(me.cvarName)
+ if(me.controlledCvar)
{
- cvar_set(me.cvarName, ftos(me.checked));
+ cvar_set(me.controlledCvar, ftos(me.checked));
}
}
}
-#endif