]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/item/checkbox.qc
c7f51a63ad74307b044c76bf8b92fbda30ad9d52
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / checkbox.qc
1 #include "checkbox.qh"
2
3 void CheckBox_setChecked(entity me, float val)
4 {
5         me.checked = val;
6 }
7 void CheckBox_Click(entity me, entity other)
8 {
9         me.setChecked(me, !me.checked);
10 }
11 string CheckBox_toString(entity me)
12 {
13         return strcat(SUPER(CheckBox).toString(me), ", ", me.checked ? "checked" : "unchecked");
14 }
15 void CheckBox_configureCheckBox(entity me, string txt, float sz, string gfx)
16 {
17         me.configureButton(me, txt, sz, gfx);
18         me.align = 0;
19 }
20 void CheckBox_draw(entity me)
21 {
22         float s;
23         s = me.pressed;
24         if (me.useDownAsChecked) {
25                 me.srcSuffix = string_null;
26                 me.forcePressed = me.checked;
27         } else {
28                 me.srcSuffix = (me.checked ? "1" : "0");
29         }
30         me.pressed = s;
31         SUPER(CheckBox).draw(me);
32 }
33 void CheckBox_playClickSound(entity me)
34 {
35         m_play_click_sound(MENU_SOUND_SELECT);
36 }