2 CLASS(NexuizRadioButton) EXTENDS(RadioButton)
3 METHOD(NexuizRadioButton, configureNexuizRadioButton, void(entity, float, string, string, string))
4 METHOD(NexuizRadioButton, draw, void(entity))
5 METHOD(NexuizRadioButton, setChecked, void(entity, float))
6 ATTRIB(NexuizRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
7 ATTRIB(NexuizRadioButton, image, string, SKINGFX_RADIOBUTTON)
8 ATTRIB(NexuizRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
9 ATTRIB(NexuizRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
10 ATTRIB(NexuizRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
11 ATTRIB(NexuizRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
13 ATTRIB(NexuizRadioButton, cvarName, string, string_null)
14 ATTRIB(NexuizRadioButton, cvarValue, string, string_null)
15 ATTRIB(NexuizRadioButton, cvarOffValue, string, string_null)
16 METHOD(NexuizRadioButton, loadCvars, void(entity))
17 METHOD(NexuizRadioButton, saveCvars, void(entity))
19 ATTRIB(NexuizRadioButton, alpha, float, SKINALPHA_TEXT)
20 ATTRIB(NexuizRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
21 ENDCLASS(NexuizRadioButton)
22 entity makeNexuizRadioButton(float, string, string, string);
26 entity makeNexuizRadioButton(float theGroup, string theCvar, string theValue, string theText)
29 me = spawnNexuizRadioButton();
30 me.configureNexuizRadioButton(me, theGroup, theCvar, theValue, theText);
33 void configureNexuizRadioButtonNexuizRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText)
37 me.cvarName = theCvar;
38 me.cvarValue = theValue;
39 me.tooltip = getZonedTooltipForIdentifier(theCvar);
42 me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
44 void setCheckedNexuizRadioButton(entity me, float val)
52 void loadCvarsNexuizRadioButton(entity me)
57 me.checked = (cvar_string(me.cvarName) == me.cvarValue);
63 me.checked = !!cvar(me.cvarName);
68 // this is the "generic" selection... but at this time, not
69 // everything is constructed yet.
70 // we need to set this later in draw()
75 void drawNexuizRadioButton(entity me)
80 // this is the "other" option
81 // always select this if none other is
85 for(e = me.parent.firstChild; e; e = e.nextSibling)
86 if(e.group == me.group)
94 void saveCvarsNexuizRadioButton(entity me)
101 cvar_set(me.cvarName, me.cvarValue);
102 else if(me.cvarOffValue)
103 cvar_set(me.cvarName, me.cvarOffValue);
110 cvar_set(me.cvarName, ftos(me.checked));