summaryrefslogtreecommitdiff
path: root/iup/test/idle.c
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-11-04 11:56:41 -0800
committerPixel <pixel@nobis-crew.org>2009-11-04 11:59:33 -0800
commitd577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch)
tree590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /iup/test/idle.c
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'iup/test/idle.c')
-rwxr-xr-xiup/test/idle.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/iup/test/idle.c b/iup/test/idle.c
new file mode 100755
index 0000000..f9681ba
--- /dev/null
+++ b/iup/test/idle.c
@@ -0,0 +1,55 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "iup.h"
+
+static int idle_count = 0;
+
+static int idle(void)
+{
+ printf("IDLE_ACTION(count = %d)\n", idle_count);
+ idle_count++;
+
+// if (idle_count == 10000)
+// return IUP_IGNORE;
+
+ return IUP_DEFAULT;
+}
+
+static int motion_cb(Ihandle* ih)
+{
+ printf("MOTION_CB()\n");
+ if (idle_count > 30000)
+ IupSetFunction ("IDLE_ACTION", NULL);
+ return IUP_DEFAULT;
+}
+
+void IdleTest(void)
+{
+ Ihandle* dlg, *canvas;
+
+ canvas = IupCanvas(NULL);
+ IupSetCallback(canvas, "MOTION_CB", motion_cb);
+
+ dlg = IupDialog(canvas);
+ IupSetAttribute(dlg, "TITLE", "Idle Test");
+ IupSetAttribute(dlg, "RASTERSIZE", "500x500");
+
+ IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
+
+ IupSetFunction ("IDLE_ACTION", (Icallback)idle);
+}
+
+#ifndef BIG_TEST
+int main(int argc, char* argv[])
+{
+ IupOpen(&argc, &argv);
+
+ IdleTest();
+
+ IupMainLoop();
+
+ IupClose();
+
+ return EXIT_SUCCESS;
+}
+#endif