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 METHOD(NexuizRadioButton, loadCvars, void(entity))
16 METHOD(NexuizRadioButton, saveCvars, void(entity))
18 ATTRIB(NexuizRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
19 ENDCLASS(NexuizRadioButton)
20 entity makeNexuizRadioButton(float, string, string, string);
24 entity makeNexuizRadioButton(float theGroup, string theCvar, string theValue, string theText)
27 me = spawnNexuizRadioButton();
28 me.configureNexuizRadioButton(me, theGroup, theCvar, theValue, theText);
31 void configureNexuizRadioButtonNexuizRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText)
35 me.cvarName = theCvar;
36 me.cvarValue = theValue;
39 me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
41 void setCheckedNexuizRadioButton(entity me, float val)
49 void loadCvarsNexuizRadioButton(entity me)
52 me.checked = (cvar_string(me.cvarName) == me.cvarValue);
57 me.checked = !!cvar(me.cvarName);
62 // this is the "generic" selection... but at this time, not
63 // everything is constructed yet.
64 // we need to set this later in draw()
69 void drawNexuizRadioButton(entity me)
74 // this is the "other" option
75 // always select this if none other is
79 for(e = me.parent.firstChild; e; e = e.nextSibling)
80 if(e.group == me.group)
88 void saveCvarsNexuizRadioButton(entity me)
93 cvar_set(me.cvarName, me.cvarValue);
99 cvar_set(me.cvarName, ftos(me.checked));