
#ifndef INTUITION_SCREENS_H
#define INTUITION_SCREENS_H TRUE

/*** screens.h ****************************************************************
 *
 *  screens.h main include for c programmers
 *
 *  $Header: /home/amiga/V36/src/kickstart/intuition/RCS/screens.h,v 36.21 90/02/20 00:27:04 jimm Exp $
 *
 *  Confidential Information: Commodore-Amiga Computer, Inc.
 *  Copyright (c) Commodore-Amiga Computer, Inc.
 *
 ****************************************************************************
 * CONFIDENTIAL and PROPRIETARY
 * Copyright (C) 1985, COMMODORE-AMIGA, INC.
 * All Rights Reserved
 ****************************************************************************/

#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif

#ifndef GRAPHICS_GFX_H
#include "graphics/gfx.h"
#endif

#ifndef GRAPHICS_CLIP_H
#include "graphics/clip.h"
#endif

#ifndef GRAPHICS_VIEW_H
#include "graphics/view.h"
#endif

#ifndef GRAPHICS_RASTPORT_H
#include "graphics/rastport.h"
#endif

#ifndef GRAPHICS_LAYERS_H
#include "graphics/layers.h"
#endif

#ifndef UTILITY_TAGITEM_H
#include "utility/tagitem.h"
#endif

/* ======================================================================== */
/* === DrawInfo ========================================================= */
/* ======================================================================== */

/* This is a packet of information for graphics rendering.  It originates
 * with a Screen, and is gotten using GetScreenDrawInfo( screen );
 */

/* If you find dri_Version >= RT_VERSION, you know this structure
 * has at least the fields defined in this version of the include file
 */
#define RI_VERSION	(1)	/* obsolete, will be removed		*/
#define DRI_VERSION	(1)

struct DrawInfo
{
    UWORD	dri_Version;	/* will be  DRI_VERSION			*/
    UWORD	dri_NumPens;	/* guaranteed to be >= numDrIPens	*/
    UWORD	*dri_Pens;	/* pointer to pen array			*/

    struct TextFont	*dri_Font;	/* screen default font		*/
    UWORD	dri_Depth;	/* (initial) depth of screen bitmap	*/

    struct {      /* from DisplayInfo database for initial display mode	*/
	UWORD	X;
	UWORD	Y;
    }		dri_Resolution;

    ULONG	dri_Reserved[8];	/* avoid recompilation ;^)	*/
};

/* rendering pen number indexes into DrawInfo.dri_Pens[]	*/
enum {
    detailPen,		/* compatible Intuition rendering pens	*/
    blockPen,

    textPen,		/* text on background 			*/
    shinePen,		/* bright edge on bas-relief		*/
    shadowPen,		/* dark edge				*/
    hifillPen,		/* active window fill			*/
    hifilltextPen,	/* text over hifillPen			*/

    backgroundPen,	/* always color 0?			*/
    hilighttextPen,	/* highlighted text, against backgroundPen */

    numDrIPens
};


/* ======================================================================== */
/* === Screen ============================================================= */
/* ======================================================================== */
struct Screen
{
    struct Screen *NextScreen;		/* linked list of screens */
    struct Window *FirstWindow;		/* linked list Screen's Windows */

    SHORT LeftEdge, TopEdge;		/* parameters of the screen */
    SHORT Width, Height;		/* parameters of the screen */

    SHORT MouseY, MouseX;		/* position relative to upper-left */

    USHORT Flags;			/* see definitions below */

    UBYTE *Title;			/* null-terminated Title text */
    UBYTE *DefaultTitle;		/* for Windows without ScreenTitle */

    /* Bar sizes for this Screen and all Window's in this Screen */
    BYTE BarHeight, BarVBorder, BarHBorder, MenuVBorder, MenuHBorder;
    BYTE WBorTop, WBorLeft, WBorRight, WBorBottom;

    struct TextAttr *Font;		/* this screen's default font	   */

    /* the display data structures for this Screen */
    struct ViewPort ViewPort;		/* describing the Screen's display */
    struct RastPort RastPort;		/* describing Screen rendering     */
    struct BitMap BitMap;		/* extra copy of RastPort BitMap   */
    struct Layer_Info LayerInfo;	/* each screen gets a LayerInfo    */

    /* Only system gadgets may be attached to a screen.
     *  You get the standard system Screen Gadgets automatically
     */
    struct Gadget *FirstGadget;

    UBYTE DetailPen, BlockPen;		/* for bar/border/gadget rendering */

    /* the following variable(s) are maintained by Intuition to support the
     * DisplayBeep() color flashing technique
     */
    USHORT SaveColor0;

    /* This layer is for the Screen and Menu bars */
    struct Layer *BarLayer;

    UBYTE *ExtData;

    UBYTE *UserData;	/* general-purpose pointer to User data extension */

    /**** Data below this point are SYSTEM PRIVATE ****/
};


/* --- FLAGS SET BY INTUITION --------------------------------------------- */
/* The SCREENTYPE bits are reserved for describing various Screen types
 * available under Intuition.  
 */
#define SCREENTYPE	0x000F	/* all the screens types available	*/
/* --- the definitions for the Screen Type ------------------------------- */
#define WBENCHSCREEN	0x0001	/* identifies the Workbench screen	*/
#define PUBLICSCREEN	0x0002	/* public shared (custom) screen	*/
#define CUSTOMSCREEN	0x000F	/* original custom screens		*/

#define SHOWTITLE	0x0010	/* this gets set by a call to ShowTitle() */

#define BEEPING		0x0020	/* set when Screen is beeping (private)	*/

#define CUSTOMBITMAP	0x0040	/* if you are supplying your own BitMap */

#define SCREENBEHIND 	0x0080	/* if you want your screen to open behind
				 * already open screens
				 */
#define SCREENQUIET	0x0100	/* if you do not want Intuition to render
				 * into your screen (gadgets, title)
				 */
#define SCREENHIRES	0x0200  /* do not use lowres gadgets  (private)	*/

#define NS_EXTENDED     0x1000 	/* ExtNewScreen.Extension is valid	*/
/* We recommend using OpenScreenTagList() instead of NS_EXTENDED	*/

#define AUTOSCROLL	0x4000	/* screen is to autoscoll		*/

#define STDSCREENHEIGHT -1	/* supply in NewScreen.Height		*/
#define STDSCREENWIDTH -1	/* supply in NewScreen.Width		*/

/*
 * Screen attribute tag ID's.  These are used in the ti_Tag field of
 * TagItem arrays passed to OpenScreenTagList() (or in the outmoded
 * ExtNewScreen.Extension field).
 */

/* these are the modernized versions of the screen attribute tags.
 * Please use these from now on, and before Beta 2 we'll remove the
 * older constant definitions.
 */
enum { SA_Dummy = TAG_USER+32,
    /* 
     * these items specify items equivalent to fields in NewScreen
     */
    SA_Left,		/* traditional screen positions	and dimensions	*/
    SA_Top,
    SA_Width,
    SA_Height,
    SA_Depth,		/* screen bitmap depth				*/
    SA_DetailPen,	/* serves as default for windows, too		*/
    SA_BlockPen,
    SA_Title,		/* default screen title				*/

    SA_Colors,		/* ti_Data is an array of struct ColorSpec, 
			 * terminated by ColorIndex = -1.  Specifies 
			 * initial screen palette colors.
			 */
    SA_ErrorCode,	/* ti_Data points to LONG error code (values below)*/
    SA_Font,		/* equiv. to NewScreen.Font			*/
    SA_SysFont,		/* Selects one of the preferences system fonts:
			 *	0 - old DefaultFont, fixed-width
			 *	1 - WB Screen preferred font
			 */

    SA_Type,		/* equiv. to NewScreen.Type			*/
    SA_BitMap,		/* ti_Data is pointer to custom BitMap.  This
			 * implies type of CUSTOMBITMAP	
			 */
    SA_PubName,		/* presence of this tag means that the screen
			 * is to be a public screen.  Please specify
			 * BEFORE the two tags below
			 */
    SA_PubSig,
    SA_PubTask,		/* Task ID and signal for being notified that
			 * the last window has closed on a public screen.
			 */

    SA_DisplayID,	/* ti_Data is new extended display ID from 
			 * <graphics/displayinfo.h>.
			 */
    SA_DClip,		/* ti_Data points to a rectangle which defines
			 * screen display clip region
			 */
    SA_Overscan,	/* was S_STDDCLIP.  Set to one of the OSCAN_
			 * specifiers below to get a system standard
			 * overscan region for your display clip,
			 * screen dimensions (unless otherwise specified),
			 * and automatically centered position (partial
			 * support only so far).
			 */
    SA_Obsolete1,	/* obsolete S_MONITORNAME			*/

    /** booleans **/
    SA_ShowTitle,	/* boolean equivalent to flag SHOWTITLE		*/
    SA_Behind,		/* boolean equivalent to flag SCREENBEHIND	*/
    SA_Quiet,		/* boolean equivalent to flag SCREENQUIET	*/
    SA_AutoScroll,	/* boolean equivalent to flag AUTOSCROLL	*/
};

/* this is an obsolete tag included only for compatibility with V35 
 * interim release for the A2024 and Viking monitors
 */
#ifndef NSTAG_EXT_VPMODE
#define NSTAG_EXT_VPMODE (TAG_USER | 1)
#endif


/*
 * These are older versions of the same screen attribute tag id's.
 * We hope to remove them, so please do not use ...
 */
enum { S_DUMMY = TAG_USER + 32,
    S_LEFT,
    S_TOP,
    S_WIDTH,
    S_HEIGHT,
    S_DEPTH,
    S_DETAILPEN,
    S_BLOCKPEN,
    S_TITLE,
    S_COLORS,
    S_ERRORCODE,

    S_FONT,
    S_SYSFONT,

    S_TYPE,
    S_BITMAP,
    S_PUBNAME,
    S_PUBSIG,
    S_PUBTASK,

    S_DISPLAYID,
    S_DCLIP,
    S_STDDCLIP,		/* call this S_OSCAN? */
    S_MONITORNAME,

    /** booleans **/
    S_SHOWTITLE,
    S_BEHIND,
    S_QUIET,
    S_AUTOSCROLL,

};


/* OpenScreen error codes, which are returned in the (optional) LONG
 * pointed to by ti_Data for the SA_ErrorCode tag item
 */
#define OSERR_NOMONITOR	(1)	/* named monitor spec not available	*/
#define OSERR_NOCHIPS	(2)	/* you need newer custom chips		*/
#define OSERR_NOMEM	(3)	/* couldn't get normal memory		*/
#define OSERR_NOCHIPMEM	(4)	/* couldn't get chipmem			*/
#define OSERR_PUBNOTUNIQUE (5)	/* public screen name already used	*/
#define OSERR_UNKNOWNMODE (6)	/* don't recognize mode asked for	*/

/* ======================================================================== */
/* === NewScreen ========================================================== */
/* ======================================================================== */
/* note: to use the Extended field, you must use the
 * new ExtNewScreen structure, below
 */
struct NewScreen
{
    SHORT LeftEdge, TopEdge, Width, Height, Depth;  /* screen dimensions */

    UBYTE DetailPen, BlockPen;	/* for bar/border/gadget rendering	*/

    USHORT ViewModes;		/* the Modes for the ViewPort (and View) */

    USHORT Type;		/* the Screen type (see defines above)	*/
    
    struct TextAttr *Font;	/* this Screen's default text attributes */
    
    UBYTE *DefaultTitle;	/* the default title for this Screen	*/
    
    struct Gadget *Gadgets;	/* your own Gadgets for this Screen	*/
    
    /* if you are opening a CUSTOMSCREEN and already have a BitMap 
     * that you want used for your Screen, you set the flags CUSTOMBITMAP in
     * the Type field and you set this variable to point to your BitMap
     * structure.  The structure will be copied into your Screen structure,
     * after which you may discard your own BitMap if you want
     */
    struct BitMap *CustomBitMap;
};

/*
 * For compatibility reasons, we need a new structure for extending
 * NewScreen.  Use this structure is you need to use the new Extension
 * field.
 *
 * NOTE: Don't use this.  Use the OpenScreenTagList( newscreen, tags )
 * version of OpenScreen().
 */
struct ExtNewScreen
{
    SHORT LeftEdge, TopEdge, Width, Height, Depth; 
    UBYTE DetailPen, BlockPen;
    USHORT ViewModes;
    USHORT Type;
    struct TextAttr *Font;
    UBYTE *DefaultTitle;
    struct Gadget *Gadgets;
    struct BitMap *CustomBitMap;

    struct TagItem	*Extension;
				/* more specification data, scanned if
				 * NS_EXTENDED is set in NewScreen.Type
				 */
};

/* === Overscan Types ===	*/
#define OSCAN_TEXT	(1)	/* entirely visible	*/
#define OSCAN_STANDARD	(2)	/* just past edges	*/
#define OSCAN_MAX	(3)	/* as much as possible	*/
#define OSCAN_VIDEO	(4)	/* even more than is possible	*/


/* === Public Shared Screen Node ===	*/

/* This is the representative of a public shared screen.
 * This is an internal data structure, but some functions may
 * present a copy of it to the calling application.  In that case,
 * be aware that the screen pointer of the structure can NOT be
 * used safely, since there is no guarantee that the referenced
 * screen will remain open and a valid data structure.
 */

struct PubScreenNode	{
    struct Node		psn_Node;	/* ln_Name is screen name */
    struct Screen	*psn_Screen;
    UWORD		psn_Flags;	/* below		*/
    WORD		psn_Size;	/* includes name buffer	*/
    WORD		psn_VisitorCount; /* how many visitor windows */
    struct Task		*psn_SigTask;	/* who to signal when visitors gone */
    UBYTE		psn_SigBit;	/* which signal	*/
};

#define PSNF_PRIVATE	(0x0001)

#define MAXPUBSCREENNAME	(139)	/* names no longer, please	*/

/* pub screen modes	*/
#define SHANGHAI	0x0001	/* put workbench windows on pub screen */
#define POPPUBSCREEN	0x0002	/* pop pub screen to front when visitor opens */

#endif
