2 CLASS(VoretCheckBox) EXTENDS(CheckBox)
\r
3 METHOD(VoretCheckBox, configureVoretCheckBox, void(entity, float, float, string, string))
\r
4 METHOD(VoretCheckBox, setChecked, void(entity, float))
\r
5 ATTRIB(VoretCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
\r
6 ATTRIB(VoretCheckBox, image, string, SKINGFX_CHECKBOX)
\r
7 ATTRIB(VoretCheckBox, yesValue, float, 1)
\r
8 ATTRIB(VoretCheckBox, noValue, float, 0)
\r
10 ATTRIB(VoretCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
\r
11 ATTRIB(VoretCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
\r
12 ATTRIB(VoretCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
\r
13 ATTRIB(VoretCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
\r
15 ATTRIB(VoretCheckBox, cvarName, string, string_null)
\r
16 METHOD(VoretCheckBox, loadCvars, void(entity))
\r
17 METHOD(VoretCheckBox, saveCvars, void(entity))
\r
19 ATTRIB(VoretCheckBox, alpha, float, SKINALPHA_TEXT)
\r
20 ATTRIB(VoretCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
\r
21 ENDCLASS(VoretCheckBox)
\r
22 entity makeVoretCheckBox(float, string, string);
\r
23 entity makeVoretCheckBoxEx(float, float, string, string);
\r
26 #ifdef IMPLEMENTATION
\r
27 entity makeVoretCheckBox(float isInverted, string theCvar, string theText)
\r
35 else if(isInverted < -1)
\r
40 else if(isInverted == 1)
\r
50 return makeVoretCheckBoxEx(y, n, theCvar, theText);
\r
52 entity makeVoretCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
\r
55 me = spawnVoretCheckBox();
\r
56 me.configureVoretCheckBox(me, theYesValue, theNoValue, theCvar, theText);
\r
59 void configureVoretCheckBoxVoretCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
\r
61 me.yesValue = theYesValue;
\r
62 me.noValue = theNoValue;
\r
66 me.cvarName = theCvar;
\r
67 me.tooltip = getZonedTooltipForIdentifier(theCvar);
\r
70 me.configureCheckBox(me, theText, me.fontSize, me.image);
\r
72 void setCheckedVoretCheckBox(entity me, float val)
\r
74 if(val != me.checked)
\r
80 void loadCvarsVoretCheckBox(entity me)
\r
87 m = (me.yesValue + me.noValue) * 0.5;
\r
88 d = (cvar(me.cvarName) - m) / (me.yesValue - m);
\r
89 me.checked = (d > 0);
\r
91 void saveCvarsVoretCheckBox(entity me)
\r
97 cvar_set(me.cvarName, ftos(me.yesValue));
\r
99 cvar_set(me.cvarName, ftos(me.noValue));
\r