#include <intuition/intuition.h>

struct Window *window;
struct Screen *screen;
struct IntuitionBase *IntuitionBase;


struct NewWindow newwindow = {
   0,20,     /* distanza XY dai bordi */
   640,90,   /* larghezza ed altezza */
   3,1,      /* colore dei dettagli e della struttura */
   CLOSEWINDOW,   /* flag IDCMP flag */
   ACTIVATE | WINDOWCLOSE | WINDOWDRAG | WINDOWSIZING,   /* altri flag */
   NULL,    /* primo gadget */
   NULL,    /* immagine custom del CHECKMARK */
   "My Window",    /* titolo della finestra */
   NULL,    /* custom screen */
   NULL,    /* custom bitmap */
   100,25,    /* larghezza ed altezza minima */
   640,120,    /* larghezza ed altezza massima */
   CUSTOMSCREEN     /* destination screen type */
};

struct NewScreen newscreen = {
   0,100,      /* distanza XY dai bordi */
   640,120,2,  /* larghezza altezza e profondita'*/
   2,1,        /* colore dei dettagli e della struttura */
   HIRES,      /* modo grafico */
   CUSTOMSCREEN,   /* tipo di screen*/
   NULL,   /* tipo di font */
   "My Screen",   /* titolo */
   NULL,   /* gadgets */
   NULL    /* custombitmap */
};
   
/*******************************************************/

void main()
{
 void CleanUp_Exit();
 
 IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
    if (IntuitionBase == NULL)  CleanUp_Exit(FALSE);
 
 if ((screen = (struct Screen *)OpenScreen(&newscreen)) == NULL)
    CleanUp_Exit(FALSE);
 
 newwindow.Screen = screen;
 
 if ((window = (struct Window *)OpenWindow(&newwindow)) == NULL)
    CleanUp_Exit(FALSE);

 Wait(1<<window->UserPort->mp_SigBit);
 
 CleanUp_Exit();

} /* end of main */

/*******************************************************/

void CleanUp_Exit()
{
 if (window)
    CloseWindow(window);
 if (screen)
    CloseScreen(screen);
 if (IntuitionBase)
    CloseLibrary(IntuitionBase); 

} 
