]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/soundlist.qc
Merge branch 'master' into terencehill/hud_cleanups
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / soundlist.qc
index 21fd2e66313a16574ba756fe3d966ea8a433b4db..159cd76c53d60a2bfe8c3b3c73c9fea6a74b9679 100644 (file)
@@ -1,15 +1,17 @@
-#ifdef INTERFACE
-CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
-       METHOD(XonoticSoundList, configureXonoticSoundList, void(entity))
+#ifndef SOUNDLIST_H
+#define SOUNDLIST_H
+#include "listbox.qc"
+CLASS(XonoticSoundList, XonoticListBox)
+       METHOD(XonoticSoundList, configureXonoticSoundList, void(entity));
        ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
-       METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticSoundList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticSoundList, getSounds, void(entity))
-       METHOD(XonoticSoundList, soundName, string(entity, float))
-       METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticSoundList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticSoundList, destroy, void(entity))
-       METHOD(XonoticSoundList, showNotify, void(entity))
+       METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticSoundList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticSoundList, getSounds, void(entity));
+       METHOD(XonoticSoundList, soundName, string(entity, float));
+       METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticSoundList, keyDown, float(entity, float, float, float));
+       METHOD(XonoticSoundList, destroy, void(entity));
+       METHOD(XonoticSoundList, showNotify, void(entity));
 
        ATTRIB(XonoticSoundList, listSound, float, -1)
        ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
@@ -22,7 +24,7 @@ CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
 
        ATTRIB(XonoticSoundList, filterString, string, string_null)
-       ATTRIB(XonoticSoundList, playlist, entity, world)
+       ATTRIB(XonoticSoundList, playlist, entity, NULL)
 ENDCLASS(XonoticSoundList)
 
 entity makeXonoticSoundList();
@@ -38,7 +40,7 @@ void SoundList_Menu_Track_Reset(entity box, entity me);
 entity makeXonoticSoundList()
 {
        entity me;
-       me = spawnXonoticSoundList();
+       me = NEW(XonoticSoundList);
        me.configureXonoticSoundList(me);
        return me;
 }
@@ -71,7 +73,7 @@ void XonoticSoundList_getSounds(entity me)
        if(me.listSound >= 0)
                search_end(me.listSound);
 
-       me.listSound = search_begin(s, FALSE, TRUE);
+       me.listSound = search_begin(s, false, true);
 
        if(me.listSound < 0)
                me.nItems=0;
@@ -101,11 +103,16 @@ void XonoticSoundList_resizeNotify(entity me, vector relOrigin, vector relSize,
        me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
 }
 
-void XonoticSoundList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticSoundList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       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);
+       }
 
        s = me.soundName(me,i);
        if(s == cvar_string("menu_cdtrack")) // current menu track