/* PWDevelopper.h */

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif

#ifndef INTUITION_CLASSUSR_H
#include <intuition/classusr.h>
#endif

/*=======================================================*/
/*                     Screen-Checker                    */
/*=======================================================*/



  /* Return-Codes */
  
#define CSR_OK 1
#define CSR_FAIL 0
	
  /* Methods */
  
#define CS_INIT 1
#define CS_EXIT 2
#define CS_CHECK 3
   
  /* Messages */
  
struct csInit
{
	ULONG MethodID;
	BYTE  PWVersion;		/* Version of PowerWindows */
	BYTE	PWRevision;		/* Revision of PowerWindows */
	BYTE	PWSubRevision;	/* SubRevision of PowerWindows */
	BYTE	pad;
/* New in V1.0 */
	STRPTR Parameters;	/* READ ONLY!!! */
};

struct csExit
{
	ULONG MethodID;	
};

struct csCheck
{
	ULONG MethodID;
	struct Screen *Scr;		/* Screen to check */
};




/*=======================================================*/
/*                     Window-Checker                    */
/*=======================================================*/



  /* Return-Codes */
  
#define CWR_OK 1
#define CWR_ICONIFYGAD 2
#define CWR_ICONIFYPOS 4
#define CWR_FAIL 0
	
  /* Methods */
  
#define CW_INIT 1
#define CW_EXIT 2
#define CW_CHECK 3
#define CW_RENDERIG 4

  /* Messages */
  
struct cwInit
{
	ULONG MethodID;
	BYTE  PWVersion;				/* Version of PowerWindows */
	BYTE	PWRevision;				/* Revision of PowerWindows */
	BYTE	PWSubRevision;			/* SubRevision of PowerWindows */
	BYTE	pad;
/* New in V1.0 */
	STRPTR Parameters;			/* READ ONLY!!! */
};

struct cwExit
{
	ULONG MethodID;	
};

struct cwCheck
{
	ULONG MethodID;
	struct Window *Win;			/* Window to check */
	WORD	Gad_LeftEdge;			/* LeftEdge of Iconify-Gadget WRITE ONLY! */
	WORD	Gad_TopEdge;			/* TopEdge of Iconify-Gadget  WRITE ONLY! */
	WORD	Gad_Width;				/* Width of Iconify-Gadget    WRITE ONLY! */
	WORD	Gad_Height;				/* Height of Iconify-Gadget   WRITE ONLY! */
	WORD	Gad_Flags;				/* Flags for Gadget: only GFLG_RELRIGHT and GFLG_RELBOTTOM supported upto now! WRITE ONLY */
	WORD	Gad_Position;			/* Position of Gadget in Window's GagetList WRITE ONLY! */
};

struct cwRenderIG
{
	ULONG MethodID;
	struct Image *GadImage;			/* Pointer to the Image */
	struct impDraw *DrawImageMsg;	/* Pointer to a a IM_DRAW-Message */
};



/*=======================================================*/
/*                     Icon-Renderer                     */
/*=======================================================*/



  /* Return-Codes */
  
#define RIR_OK 1
#define RIR_FAIL 0
	
  /* Methods */
  
#define RI_INIT 1
#define RI_EXIT 2
#define RI_INITICON 3
#define RI_RENDERICON 4
#define RI_EXITICON 5
#define RI_REFRESHIFRAME 6
#define RI_REFRESHITITLE 7

  /* Messages */
  
struct riInit
{
	ULONG MethodID;
	BYTE  PWVersion;				/* Version of PowerWindows */
	BYTE	PWRevision;				/* Revision of PowerWindows */
	BYTE	PWSubRevision;			/* SubRevision of PowerWindows */
	BYTE	pad;
/* New in V1.0 */
	STRPTR Parameters;			/* READ ONLY!!! */
};

struct riExit
{
	ULONG MethodID;	
};

struct riInitIcon
{
	ULONG MethodID;
	struct Window *ParentWin;	/* Window which is being iconified */
	struct Task *WinTask; 		/* Task that opened Window */
	WORD	IconWidth;				/* Don't change this */
	WORD	IconHeight;				/* You can change this */
	APTR	UserData;				/* You can store something "local" to the Icon here */
};

struct riRenderIcon
{
	ULONG MethodID;
	struct Window *ParentWin;	/* Window this Icons belongs to */
	struct Window *Icon;			/* The Icon is a Window! */
	APTR	UserData;				/* Will be set to what you have stored here during RI_INITICON */
};

struct riExitIcon
{
	ULONG MethodID;
	APTR	UserData;				/* Will be set to what you have stored here during RI_INITICON */
};

struct riRefreshIFrame
{
	ULONG MethodID;
	struct Window *Icon;
	APTR	UserData;				/* Will be set to what you have stored here during RI_INITICON */
};

struct riRefreshITitle
{
	ULONG MethodID;
	struct Window *Icon;
	APTR	UserData;
};

/*======================================================*/

/*==== All Messages in one ====*/

union PWMessage
{
	struct csInit pcsInit;
	struct csExit pcsExit;
	struct csCheck pcsCheck;
	
	struct cwInit pcwInit;
	struct cwExit pcwExit;
	struct cwCheck pcwCheck;
	struct cwRenderIG pcwRenderIG;

	struct riInit priInit;
	struct riExit priExit;
	struct riInitIcon priInitIcon;
	struct riRenderIcon priRenderIcon;
	struct riExitIcon priExitIcon;
	struct riRefreshIFrame priRefreshIFrame;
	struct riRefreshITitle priRefreshITitle;
};

/* Macros for easy Type-Casting */

#define CSINIT_Msg			((struct csInit *)msg)
#define CSEXIT_Msg			((struct csExit *)msg)
#define CSCHECK_Msg			((struct csCheck *)msg)

#define CWINIT_Msg			((struct cwInit *)msg)
#define CWEXIT_Msg			((struct cwExit *)msg)
#define CWCHECK_Msg			((struct cwCheck *)msg)
#define CWRENDERIG_Msg		((struct cwRenderIG *)msg)

#define RIINIT_Msg			((struct riInit *)msg)
#define RIEXIT_Msg			((struct riExit *)msg)
#define RIINITICON_Msg		((struct riInitIcon *)msg)
#define RIRENDERICON_Msg	((struct riRenderIcon *)msg)
#define RIEXITICON_Msg		((struct riExitIcon *)msg)
#define RIREFRESHIFRAME_Msg ((struct riRefreshIFrame *)msg)
#define RIREFRESHITITLE_Msg ((struct riRefreshITitle *)msg)

/*==== Prototypes ====*/

LONG CheckScreen(Msg msg);
LONG CheckWindow(Msg msg);
LONG RenderIcon(Msg msg);

