/* Y o u r   D e s c r i p t i o n                       */
/*                            AppBuilder Photon Code Lib */
/*                                         Version 2.03  */

/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <photon/PxImage.h>
/* Local headers */
#include "ablibs.h"
#include "abimport.h"
#include "proto.h"
#include "Globals.h"

int
timer( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

	{
	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;
	//i=rand()%3+1;
	pos.x=pos.x+10;
	pos.y=20;
	//PhArea_t cir_area = { {pos.x, pos.y}, {7, 7} };
	//printf("i= %d\n",i);
	printf("x= %d\n",pos.x);
	printf("y= %d\n",pos.y);
	my_image= PxLoadImage("/home/PSR.jpg",NULL);
	PtSetArg( &argt[0],Pt_ARG_LABEL_TYPE,Pt_IMAGE,0);
	PtSetArg( &argt[1], Pt_ARG_LABEL_IMAGE, my_image, 0 );
	PtSetArg( &argt[2], Pt_ARG_POS, &pos, 0);
	my_label[a]=PtCreateWidget(PtLabel,NULL,3,argt);
	PtRealizeWidget(my_label[a]);
	PtFlush();
	a=a+1;
	if(a>=7)
	{
		PtUnrealizeWidget(my_label[a-7]);
		PtFlush();
	}
	/*	switch (i)
		{case 1:
			my_image= PxLoadImage("/home/PSR.jpg",NULL);
			PtSetArg( &argt[0],Pt_ARG_LABEL_TYPE,Pt_IMAGE,0);
			PtSetArg( &argt[1], Pt_ARG_LABEL_IMAGE, my_image, 0 );
			PtSetArg( &argt[2], Pt_ARG_POS, &pos, 0);
			my_label=PtCreateWidget(PtLabel,NULL,3,argt);
			PtRealizeWidget(my_label);
			PtSetArg (&args[0], Pt_ARG_AREA, &cir_area, 0);
			PtSetArg (&args[1], Pt_ARG_COLOR, Pg_GREEN, 0);
			PtSetArg (&args[2], Pt_ARG_FILL_COLOR, Pg_GREEN, 0);
			my_elipse=PtCreateWidget (PtEllipse, NULL, 3, args);
			PtRealizeWidget(my_elipse);
			PtUnrealizeWidget(my_label);
			PtFlush();
		 break;
		 case 2:
			my_image= PxLoadImage("/home/SSR.jpg",NULL);
			PtSetArg( &argt[0],Pt_ARG_LABEL_TYPE,Pt_IMAGE,0);
			PtSetArg( &argt[1], Pt_ARG_LABEL_IMAGE, my_image, 0 );
			PtSetArg( &argt[2], Pt_ARG_POS, &pos, 0);
			my_label=PtCreateWidget(PtLabel,NULL,3,argt);
			PtRealizeWidget(my_label);
			PtSetArg (&args[0], Pt_ARG_AREA, &cir_area, 0);
			PtSetArg (&args[1], Pt_ARG_COLOR, Pg_RED, 0);
			PtSetArg (&args[2], Pt_ARG_FILL_COLOR, Pg_RED, 0);
			my_elipse=PtCreateWidget (PtEllipse, NULL, 3, args);
			PtRealizeWidget(my_elipse);
			PtUnrealizeWidget(my_label);
			PtFlush();
		break;
		 default:
			 my_image= PxLoadImage("/home/PSRSSR.jpg",NULL);
			 PtSetArg( &argt[0],Pt_ARG_LABEL_TYPE,Pt_IMAGE,0);
			 PtSetArg( &argt[1], Pt_ARG_LABEL_IMAGE, my_image, 0 );
			 PtSetArg( &argt[2], Pt_ARG_POS, &pos, 0);
			 my_label=PtCreateWidget(PtLabel,NULL,3,argt);
			 PtRealizeWidget(my_label);
			 PtSetArg (&args[0], Pt_ARG_AREA, &cir_area, 0);
			 PtSetArg (&args[1], Pt_ARG_COLOR, Pg_BLUE, 0);
			 PtSetArg (&args[2], Pt_ARG_FILL_COLOR, Pg_BLUE, 0);
			 my_elipse=PtCreateWidget (PtEllipse, NULL, 3, args);
			 PtRealizeWidget(my_elipse);
			 PtUnrealizeWidget(my_label);
			 PtFlush();
			 break;
		}*/
	return( Pt_CONTINUE );

}
