]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/keybinder.qc
Require semicolon or definition following `METHOD`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / keybinder.qc
index 09fac4f28ac84a6cbba657f888c5f2b959ba5d3e..a510a757c9cec36bafbff07d26476a12891fc1d8 100644 (file)
@@ -1,13 +1,15 @@
-#ifdef INTERFACE
-CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
-       METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
+#ifndef KEYBINDER_H
+#define KEYBINDER_H
+#include "listbox.qc"
+CLASS(XonoticKeyBinder, XonoticListBox)
+       METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity));
        ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
-       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, float))
-       METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticKeyBinder, setSelected, void(entity, float))
-       METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float))
-       METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float))
+       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticKeyBinder, setSelected, void(entity, float));
+       METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float));
+       METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float));
 
        ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
        ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
@@ -22,12 +24,13 @@ CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
        ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
        ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
        ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
-       METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string))
+       METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string));
 ENDCLASS(XonoticKeyBinder)
 entity makeXonoticKeyBinder();
 void KeyBinder_Bind_Change(entity btn, entity me);
 void KeyBinder_Bind_Clear(entity btn, entity me);
 void KeyBinder_Bind_Edit(entity btn, entity me);
+void KeyBinder_Bind_Reset_All(entity btn, entity me);
 #endif
 
 #ifdef IMPLEMENTATION
@@ -65,7 +68,7 @@ void Xonotic_KeyBinds_Read()
 entity makeXonoticKeyBinder()
 {
        entity me;
-       me = spawnXonoticKeyBinder();
+       me = NEW(XonoticKeyBinder);
        me.configureXonoticKeyBinder(me);
        return me;
 }
@@ -299,7 +302,7 @@ float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
        }
        return r;
 }
-void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        int j, n;
@@ -328,8 +331,11 @@ void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isS
                        else
                                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
                }
-               else if(highlightedTime)
-                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+               else if(isFocused)
+               {
+                       me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+               }
 
                theAlpha = SKINALPHA_KEYGRABBER_KEYS;
                theColor = SKINCOLOR_KEYGRABBER_KEYS;