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