/***************************************
 *                                     *
 * Program: Superscreen.c              *
 * =================================== *
 *                                     *
 * Author:  Date:      Comments:       *
 * ------  ----------  ----------      *
 * Wgb     10/16/87   one Screen       *
 *                                     *
 *                                     *
 ***************************************/


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


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


struct NewScreen SuperScreen =
   {
   0, 0,                /* LeftEdge, TopEdge   */
   640, 400,            /* Width, Height       */
   1,                   /* Depth               */
   0, 1,                /* DetailPen, BlockPen */
   HIRES |              /* ViewModes           */
   LACE,
   CUSTOMSCREEN |       /* Type                */
   SCREENQUIET,
   NULL,                /* Font                */
   NULL,
   NULL,                /* Gadgets             */
   NULL,                /* CustomBitMap        */
   };


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


main()
   {
   Open_All();
   
   Delay(180L);
   
   Close_All();
   exit(TRUE);
   }


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

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


/***************************************
 *                                     *
 * Function: Close everything opened   *
 * =================================== *
 *                                     *
 ***************************************/

Close_All()
   {
   if (FirstWindow)     CloseWindow(FirstWindow);
   if (FirstScreen)     CloseScreen(FirstScreen);
   if (IntuitionBase)   CloseLibrary(IntuitionBase);
   }

