]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/item/radiobutton.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / radiobutton.qc
1 #include "radiobutton.qh"
2
3 void RadioButton_configureRadioButton(entity me, string txt, float sz, string gfx, float theGroup, float doAllowDeselect)
4 {
5         me.configureCheckBox(me, txt, sz, gfx);
6         me.align = 0;
7         me.group = theGroup;
8         me.allowDeselect = doAllowDeselect;
9 }
10 void RadioButton_Click(entity me, entity other)
11 {
12         if (me.checked) {
13                 if (me.allowDeselect) { me.setChecked(me, 0); }
14         } else {
15                 entity e;
16                 for (e = me.parent.firstChild; e; e = e.nextSibling) {
17                         if (e != me) {
18                                 if (e.group == me.group) { e.setChecked(e, 0); } }
19                 }
20                 me.setChecked(me, 1);
21         }
22 }