/* Dimostrativo uso requesters */

#include <intuition/intuition.h>

#ifdef LATTICE 
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/exec.h>
#include <proto/dos.h>
#else
#include <functions.h>
#endif

#define INAM "intuition.library"
#define GNAM "graphics.library"
#define RP wind->RPort

struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Window *wind;

struct IntuiText reqtext = {
 0, 1, JAM2, 22, 5, NULL, (UBYTE *) "Ti piaccio ?", NULL };

struct IntuiText sitext = {
 3, 1, JAM2, 5, 3, NULL, (UBYTE *) "Si", NULL };

struct IntuiText notext = {
 3, 1, JAM2, 5, 3, NULL, (UBYTE *) "No", NULL };

struct NewWindow NewWindowStructure = {
 15, 10, 300, 26, 1, 2, NULL, WINDOWDRAG + NOCAREREFRESH,
 NULL, NULL, (UBYTE *) "MoniqueWindow", NULL, NULL,
 0, 0, 0, 0, WBENCHSCREEN };

void die( n )
LONG n;
{
 if ( wind ) CloseWindow( wind );
 if ( GfxBase ) CloseLibrary( GfxBase );
 if ( IntuitionBase ) CloseLibrary( IntuitionBase );
 _exit( n );
}

void _main()
{
 register COUNT i;
 BOOL risp;

 GfxBase = (struct GfxBase *) OpenLibrary( GNAM, 33L );
 if ( GfxBase == NULL ) die( 10 );

 IntuitionBase=(struct IntuitionBase *)OpenLibrary(INAM,33L);
 if ( IntuitionBase == NULL ) die( 11 );

 wind = OpenWindow( &NewWindowStructure );
 if ( wind == NULL ) die ( 12 );

 Move( RP, 30L, 18L );
 Text( RP, "Questa finestra e' fittizia !", 29L );

 for ( i = 0 ; i < 14 ; i++ ) MoveWindow( wind, 4L, 4L );

 Delay( 50L );             /* Attende un secondo */
 risp = AutoRequest( wind, &reqtext, &sitext, &notext, \
                     NULL, NULL, 180L, 54L );
            
 RectFill( RP, 3, 10, 296, 24 ); Move( RP, 104L, 19L );
 
 if ( risp == TRUE )
   Text( RP, "Risposta: SI", 12 );
 else
   Text( RP, "Risposta: NO", 12 );
 Delay( 400L ); die( 0L );
}
