X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Fcheckbox.qc;h=79cfe7a9961ca34c49e4f139a4f0864169dcd4bb;hb=0186db45dc96a0dd45058b259e2f38f5468d3ce6;hp=94f67ba709ef7422b1d0b3a76e488b1b9f8f5acf;hpb=244e5081c5c503c307e557c98ac864f6c9731475;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/item/checkbox.qc b/qcsrc/menu/item/checkbox.qc index 94f67ba70..79cfe7a99 100644 --- a/qcsrc/menu/item/checkbox.qc +++ b/qcsrc/menu/item/checkbox.qc @@ -1,48 +1,39 @@ -#ifdef INTERFACE -void CheckBox_Click(entity me, entity other); -CLASS(CheckBox) EXTENDS(Button) - METHOD(CheckBox, configureCheckBox, void(entity, string, float, string)) - METHOD(CheckBox, draw, void(entity)) - METHOD(CheckBox, toString, string(entity)) - METHOD(CheckBox, setChecked, void(entity, float)) - ATTRIB(CheckBox, useDownAsChecked, float, 0) - ATTRIB(CheckBox, checked, float, 0) - ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click) - ATTRIB(CheckBox, srcMulti, float, 0) - ATTRIB(CheckBox, disabled, float, 0) -ENDCLASS(CheckBox) -#endif +#include "checkbox.qh" -#ifdef IMPLEMENTATION -void CheckBox_setChecked(entity me, float val) -{ - me.checked = val; -} -void CheckBox_Click(entity me, entity other) -{ - me.setChecked(me, !me.checked); -} -string CheckBox_toString(entity me) -{ - return strcat(SUPER(CheckBox).toString(me), ", ", me.checked ? "checked" : "unchecked"); -} -void CheckBox_configureCheckBox(entity me, string txt, float sz, string gfx) -{ - me.configureButton(me, txt, sz, gfx); - me.align = 0; -} -void CheckBox_draw(entity me) -{ - float s; - s = me.pressed; - if(me.useDownAsChecked) + void CheckBox_setChecked(entity me, float val) { - me.srcSuffix = string_null; - me.forcePressed = me.checked; + me.checked = val; + } + void CheckBox_Click(entity me, entity other) + { + me.setChecked(me, !me.checked); + } + string CheckBox_toString(entity me) + { + return strcat(SUPER(CheckBox).toString(me), ", ", me.checked ? "checked" : "unchecked"); + } + void CheckBox_configureCheckBox(entity me, string txt, float sz, string gfx) + { + me.configureButton(me, txt, sz, gfx); + me.align = 0; + } + void CheckBox_draw(entity me) + { + float s; + s = me.pressed; + if (me.useDownAsChecked) + { + me.srcSuffix = string_null; + me.forcePressed = me.checked; + } + else + { + me.srcSuffix = (me.checked ? "1" : "0"); + } + me.pressed = s; + SUPER(CheckBox).draw(me); + } + void CheckBox_playClickSound(entity me) + { + m_play_click_sound(MENU_SOUND_SELECT); } - else - me.srcSuffix = (me.checked ? "1" : "0"); - me.pressed = s; - SUPER(CheckBox).draw(me); -} -#endif