]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/inputbox.c
Merge remote-tracking branch 'origin/master' into terencehill/clear_button
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / inputbox.c
index 2a9c094b8eb07a74ac6752562b3eecfb87cd200a..56aa9702c67170c82e286d62eed7cec004221999 100644 (file)
@@ -5,9 +5,9 @@ CLASS(XonoticInputBox) EXTENDS(InputBox)
        METHOD(XonoticInputBox, setText, void(entity, string))
        ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
        ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
-       ATTRIB(XonoticInputBox, onChange, void(entity, entity), SUB_Null)
+       ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
        ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), SUB_Null)
+       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
        ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
        ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
        ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
@@ -16,6 +16,13 @@ CLASS(XonoticInputBox) EXTENDS(InputBox)
 
        ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
 
+       // Clear button attributes
+       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
+       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
+       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
+       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
+       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
+
        ATTRIB(XonoticInputBox, cvarName, string, string_null)
        METHOD(XonoticInputBox, loadCvars, void(entity))
        METHOD(XonoticInputBox, saveCvars, void(entity))
@@ -55,7 +62,8 @@ void XonoticInputBox_setText(entity me, string new)
        if(me.text != new)
        {
                SUPER(XonoticInputBox).setText(me, new);
-               me.onChange(me, me.onChangeEntity);
+               if(me.onChange)
+                       me.onChange(me, me.onChangeEntity);
                if(me.saveImmediately)
                        me.saveCvars(me);
        }
@@ -85,7 +93,8 @@ float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
                        me.saveCvars(me);
                        r = 1;
                }
-               me.onEnter(me, me.onEnterEntity);
+               if(me.onEnter)
+                       me.onEnter(me, me.onEnterEntity);
        }
        if(SUPER(XonoticInputBox).keyDown(me, key, ascii, shift))
                r = 1;