From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- iup/test/idle.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 iup/test/idle.c (limited to 'iup/test/idle.c') 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 +#include +#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 -- cgit v1.2.3