/***************************************
 *                                     *
 * Program: Window GIMMEZEROZERO.C Test*
 * =================================== *
 *                                     *
 * Author:  Date:      Comments:       *
 * ------  ----------  ----------      *
 * Wgb     10/16//1987  close with     *
 * JLD     01/09/1989  a Gadget        *
 *                                     *
 ***************************************/


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


struct IntuitionBase *IntuitionBase;
struct Window        *FirstWindow;
struct IntuiMessage  *message;


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


main()
   {
   ULONG  MessageClass;
   USHORT code;
   
   struct Message *GetMsg();
   
   Open_All();
   
   FOREVER
      {
      if (message = (struct IntuiMessage *)
          GetMsg(FirstWindow->UserPort))
         {
         MessageClass = message->Class;
         code = message->Code;
         ReplyMsg(message);
         switch (MessageClass)
            {
            case CLOSEWINDOW : Close_All();
                               exit(TRUE);
                               break;
            }
         }
      }
   }


/***************************************
 *                                     *
 * Function: Library and Window open   *
 * =================================== *
 *                                     *
 * Author:  Date:      Comments:       *
 * ------  ----------  ----------      *
 * Wgb     10/16//1989                 *
 *                                     *
 *                                     *
 ***************************************/

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);
      }
   }


/***************************************
 *                                     *
 * Funktion: Close everthing opened    *
 * =================================== *
 *                                     *
 * Author:  Date:      Comments:       *
 * ------  ----------  ----------      *
 * Wgb     10/16/1987  for Intuition   *
 *                     and Window      *
 *                                     *
 ***************************************/

Close_All()

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

