]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Filter the list after 0.5 seconds the filter string has been changed
authorterencehill <piuntn@gmail.com>
Mon, 16 Aug 2010 17:29:35 +0000 (19:29 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 16 Aug 2010 17:29:35 +0000 (19:29 +0200)
qcsrc/menu/xonotic/dialog_multiplayer_screenshot.c
qcsrc/menu/xonotic/screenshotlist.c

index b0eebeda1a864128be72041c1abe6b7725c6b5ef..432c988e725141b6cc855c1b5faba34cec0c2e9a 100644 (file)
@@ -41,10 +41,9 @@ void XonoticScreenshotBrowserTab_fill(entity me)
                me.TD(me, 1, 0.5, btn = makeXonoticButton("Clear", '0 0 0'));
                        btn.onClick = InputBox_Clear_Click;
                me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
-                       e.onChange = ScreenshotList_Filter_Change;
+                       e.onChange = ScreenshotList_Filter_Would_Change;
                        e.onChangeEntity = slist;
                        btn.onClickEntity = e;
-                       slist.controlledTextbox = e;
                        slist.screenshotViewerDialog = main.screenshotViewerDialog;
                        main.screenshotViewerDialog.scrList = slist;
                me.TD(me, 1, 0.5, e = makeXonoticButton("Refresh", '0 0 0'));
index 1fa901d9a3d5470d09e489b3196fbddced9ce9f9..0a8575dc0496dc575dca996c35af8989e8a8ddb1 100644 (file)
@@ -4,6 +4,7 @@ CLASS(XonoticScreenshotList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
        METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticScreenshotList, setSelected, void(entity, float))
+       METHOD(XonoticScreenshotList, draw, void(entity))
        METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, float, vector, float))
        METHOD(XonoticScreenshotList, getScreenshots, void(entity))
        METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
@@ -23,6 +24,8 @@ CLASS(XonoticScreenshotList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticScreenshotList, lastClickedScreenshot, float, -1)
        ATTRIB(XonoticScreenshotList, lastClickedTime, float, 0)
        ATTRIB(XonoticScreenshotList, filterString, string, string_null)
+       ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
+       ATTRIB(XonoticScreenshotList, filterTime, float, 0)
 
        ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
        ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
@@ -33,6 +36,7 @@ ENDCLASS(XonoticScreenshotList)
 entity makeXonoticScreenshotList();
 void StartScreenshot_Click(entity btn, entity me);
 void ScreenshotList_Refresh_Click(entity btn, entity me);
+void ScreenshotList_Filter_Would_Change(entity box, entity me);
 void ScreenshotList_Filter_Change(entity box, entity me);
 #endif
 
@@ -169,6 +173,22 @@ void ScreenshotList_Filter_Change(entity box, entity me)
        ScreenshotList_Refresh_Click(world, me);
 }
 
+void ScreenshotList_Filter_Would_Change(entity box, entity me)
+{
+       me.filterBox = box;
+       me.filterTime = time + 0.5;
+}
+
+void XonoticScreenshotList_draw(entity me)
+{
+       if (me.filterTime && time > me.filterTime)
+       {
+               ScreenshotList_Filter_Change(me.filterBox, me);
+               me.filterTime = 0;
+       }
+       SUPER(XonoticScreenshotList).draw(me);
+}
+
 void XonoticScreenshotList_goScreenshot(entity me, float d)
 {
        if(!me.screenshotViewerDialog)