/***************************************
 *                                     *
 * Programm: Window lokale Definition  *
 * =================================== *
 *                                     *
 * Autor:  Datum:      Kommentar:      *
 * ------  ----------  ----------      *
 * Wgb     16.10.1987  erstes Test-    *
 *                     Window          *
 *                                     *
 ***************************************/


#include <exec/types.h>
#include <intuition/intuition.h>


struct IntuitionBase *IntuitionBase;
struct Window        *FirstWindow;


struct NewWindow FirstNewWindow =
   {
   160, 50,             /* LeftEdge, TopEdge   */
   320, 150,            /* Width, Height       */
   0, 1,                /* DetailPen, BlockPen */
   NULL,                /* IDCMP Flags         */
   WINDOWDEPTH |        /* Flags               */
   WINDOWSIZING |
   WINDOWDRAG |
   WINDOWCLOSE |
   SMART_REFRESH,
   NULL,                /* First Gadget        */
   NULL,                /* CheckMark           */
   (UBYTE *)"System programimg test",
   NULL,                /* Screen              */
   NULL,                /* BitMap              */
   100, 50,             /* Min Width, Height   */
   640, 200,            /* Max Width, Height   */
   WBENCHSCREEN,        /* Typ                 */
   };

struct IntuiText FirstText =
   {
   1, 0,                /* FrontPen, BackPen   */
   JAM2,                /* DrawMode            */
   15, 0,               /* LeftEdge, TopEdge   */
   NULL,                /* Font (Standard)     */
   (UBYTE *) "System programing on the Amiga!",
   NULL                 /* NextText            */
   };



main()
   {
   struct RastPort *MyWindowsRastPort;

   Open_All();
   
   MyWindowsRastPort = FirstWindow->RPort;

   PrintIText(MyWindowsRastPort, &FirstText, 10L, 20L);

   Delay(180L);
   
   Close_All();
   }


/***************************************
 *                                     *
 * Function: Library and Window open   *
 * =================================== *
 *                                     *
 ***************************************/

Open_All()

   {
   void          *OpenLibrary();
   struct Window *OpenWindow();
   
   if (!(IntuitionBase = (struct IntuitionBase *)
       OpenLibrary("intuition.library", 0L)))
      {
      printf("Intuition Library not found!\n");
      Close_All();
      exit(FALSE);
      }
   
   if (!(FirstWindow = (struct Window *)
       OpenWindow(&FirstNewWindow)))
      {
      printf("Window will not open!\n");
      Close_All();
      exit(FALSE);
      }
   }


/***************************************
 *                                     *
 * Function: Close All                 *
 * =================================== *
 *                                     *
 ***************************************/

Close_All()

   {
   if (FirstWindow)     CloseWindow(FirstWindow);
   if (IntuitionBase)   CloseLibrary(IntuitionBase);
   }

