/*************************************************************************/
/*                                                                       */
/* C-Beispielprogramm für die Get-It ( Diskettenmagazin der AIT-UG )     */
/*                                                                       */
/* Kurs 2 : Verschiedene Fenster und Refresh-Methoden                    */
/* Datum : 9.1.89                                                        */
/*                                                                       */
/* Keine Copyrights irgendwelcher Art auf die folgenden Zeilen.          */
/*                                                                       */
/*************************************************************************/

#include <intuition/intuition.h>
#include <graphics/gfx.h>

char Nachricht[][50] =
{ "intuition.library läßt sich nicht öffnen !\n",
  "graphics.library läßt sich nicht öffnen !\n",
  "Fenster läßt sich nicht öffnen !\n"
};

struct IntuitionBase *IntuitionBase = NULL;
struct GfxBase *GfxBase = NULL;

struct NewWindow Neu1 =
{ 0,0,
  640,30,
  0,1,
  NULL,
  WINDOWSIZING | SIZEBRIGHT,
  NULL,
  NULL,
  " 1) normales Fenster",
  NULL,
  NULL,
  10,10,
  200,50,
  WBENCHSCREEN
};

struct NewWindow Neu2 =
{ 0,30,
  600,50,
  1,0,
  NULL,
  WINDOWSIZING | SIZEBBOTTOM | WINDOWDEPTH | BORDERLESS,
  NULL,
  NULL,
  " 2) Randloses Fenster",
  NULL,
  NULL,
  10,90,
  600,100,
  WBENCHSCREEN
};

struct NewWindow Neu3 =
{ 10,100,
  600,50,
  1,0,
  CLOSEWINDOW,
  WINDOWCLOSE | ACTIVATE | WINDOWDEPTH |
                WINDOWDRAG | RMBTRAP | GIMMEZEROZERO,
  NULL,
  NULL,
  " 3) Gimmezerozero-Fenster",
  NULL,
  NULL,
  0,0,
  0,0,
  WBENCHSCREEN
};

struct Window
  *Fenster1 = NULL,
  *Fenster2 = NULL,
  *Fenster3 = NULL;

main()
{ IntuitionBase = OpenLibrary ( "intuition.library",0 );
  if ( IntuitionBase == NULL )
    notaus ( Nachricht[0] );

  GfxBase = OpenLibrary ( "graphics.library",0 );
  if ( GfxBase == NULL )
    notaus ( Nachricht[1] );

  Fenster1 = OpenWindow( &Neu1 );
  if ( Fenster1 == NULL )
    notaus ( Nachricht[2] );
  Delay ( 50 );

  Fenster2 = OpenWindow( &Neu2 );
  if ( Fenster2 == NULL )
    notaus ( Nachricht[2] );
  Delay ( 50 );

  Fenster3 = OpenWindow( &Neu3 );
  if ( Fenster3 == NULL )
    notaus ( Nachricht[2] );
  Delay ( 100 );
  SetRast ( Fenster2->RPort,2 );
  SetRast ( Fenster3->RPort,3 );
  Delay ( 50 );

  Wait ( 1 << Fenster3->UserPort->mp_SigBit );
  notaus( NULL );
}

notaus ( txt )
char *txt;
{ if ( txt != NULL )
    printf ( txt );
  if ( Fenster1 != NULL )
    CloseWindow ( Fenster1 );
  if ( Fenster2 != NULL )
    CloseWindow ( Fenster2 );
  if ( Fenster3 != NULL )
    CloseWindow ( Fenster3 );
  if ( IntuitionBase != NULL )
    CloseLibrary ( IntuitionBase );
  if ( txt != NULL )
    exit ( 100 );
  exit ( 0 );
}



