/*
**  $Filename: VisualArts.h $
**  $Includes, V2.0 $
**  $Date: 94/08/24 $
**
**
**  (C) 1994 Danny Y. Wong  			
**  All Rights Reserved
**
**  DO NOT MODIFY
*/

#include <exec/types.h>
#include <exec/memory.h>
#include <exec/lists.h>
#include <exec/nodes.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <intuition/gadgetclass.h>
#include <intuition/imageclass.h>
#include <intuition/classes.h>
#include <intuition/icclass.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <graphics/gfxmacros.h>
#include <libraries/gadtools.h>
#include <libraries/dos.h>
#include <workbench/workbench.h>
#include <workbench/startup.h>

#include <clib/wb_protos.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/utility_protos.h>
#include <clib/alib_protos.h>
#include <clib/dos_protos.h>

#include "string.h" 
#include "stdio.h"
#include "stdlib.h"
#include "ctype.h"

#include "PopUpMenuClass.h" 

/* context sensitive */

#define VA_Static       0x0001
#define VA_ExpandX      0x0002
#define VA_MoveX        0x0004
#define VA_ExpandY      0x0008
#define VA_MoveY        0x0010

/* defines for scroller window with super bitmap */

#define  MAX_LEVEL     (0xFFFFL)
#define LAYERXOFFSET(win)  (win->RPort->Layer->Scroll_X)  
#define LAYERYOFFSET(win)  (win->RPort->Layer->Scroll_Y)  

/* define for Image */

#ifndef IM
#define IM(o)	((struct Image *) o)
#endif

/* define for determining the max value */

#ifndef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#endif


/* for new menus in V38  */

#ifndef WA_NewLookMenus
  #define WA_NewLookMenus         (WA_Dummy + 0x30)
#endif

/* macros for easy access to Gadget data */

#define GetString(gad)	        (((struct StringInfo *)gad->SpecialInfo)->Buffer)
#define GetUndoString(gad)	(((struct StringInfo *)gad->SpecialInfo)->UndoBuffer)
#define GetNumber(gad)	        (((struct StringInfo *)gad->SpecialInfo)->LongInt)

/* List node name.  Each node have the following */
  
struct NameNode
{
  struct Node nn_Node;  //linked list node to previous or next node
  UBYTE nn_Data[255];   //name of the node, this is the same as
                        //nn_Node.ln_Name
};

/* Visual Arts message object.  Every GADGETUP event, the object is
   sent to the attached function.  For Menus, the va_Gadget field is
   always NULL.
*/

struct VAobject {
  struct Window *va_Window;             //window the object originated
  struct Gadget *va_Gadget;             //the gadget that sent this object
  struct IntuiMessage *va_IntuiMsg;     //the IntuiMessage
  ULONG va_Flags;                       //user flags 
  APTR va_UserData;                     //user data, function pointer etc..
};

/* Every AREXX command have the following */

struct rexxCommandList
{
  char *name;       //name of the AREXX command, note its case sensitive
  APTR userdata;    //user data, in this case it's a function pointer    
};

/* Structure for Multi-Processing windows.  This structure is a linked
   List for every window opened as Multi-Processing
*/

struct WindowNode
{
	struct Node nn_Node;            //linked list to prev or next window
	UBYTE nn_Data[80];              //window name
	struct Window *nn_Window;       //window pointer
	struct AppWindow *nn_AppWindow; //AppWindow pointer if window is a AppWindow
	struct MsgPort *nn_AppWindPort; //AppWindow Port
	short ID;                       //WindowNode ID
	APTR UserData;                  //window Handler for this window
};

/*  Visual Arts function prototypes. All are in the VisualArts.lib 
*/

extern void DrawBox(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern );
extern void DrawFBox(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern, UBYTE Outline, short Fill );
extern void DrawLine(struct Window *Wind, int Left, int Top, int Wid, int Hi, UBYTE APen, short Pattern );
extern void DrawNCircle(struct Window *Wind, int Left, int Top, int Right, int Bottom, UBYTE APen);
extern void DrawFCircle(struct Window *Wind, int Left, int Top, int Right, int Bottom, UBYTE APen, short Pattern, UBYTE Outline, short Fill );
extern void SetRPortFill(struct Window *Wind, short Type);
extern void ButtonSelected(struct Window *wind, struct Gadget *gad);
extern int AddNewNode(struct List *list, char name[255]);
extern int DeleteNewNode(struct List *list, char name[255]);
extern struct List *GetNewList(void);
extern struct NameNode *FindNodeName(struct List *list, char name[255]);
extern void FreeList(struct List *list);
extern APTR   VisualInfo;
extern struct Screen *Scr;
extern struct WindowNode *AddWindowNode(struct List *list, char name[80], APTR handler);
extern int DelWindowNode(struct List *list, char name[80]);
extern struct WindowNode *FindWindowNode(struct List *list, char name[80]);
extern void FreeWindowList(struct List *list);
extern void ReMakeWindowID(struct List *list);
extern void closeRexxPort(void);
extern void handlerRexxPort(void);
extern struct RexxMsg *asyncRexxCmd(char *s);
extern void replyRexxCmd(register struct RexxMsg *msg, register long primary,
                  register long secondary, register char *string);
extern long InitRexxPort(char *s, struct rexxCommandList *rcl,
                  char *exten, int (*uf)());
extern int dispatchRexx(register struct RexxMsg *msg, register struct rexxCommandList *dat, char *p);
extern Object *NewImageObject(ULONG which);
extern struct Gadget *NewPropObject(ULONG freedom, Tag tag1, ...);
extern struct Gadget *NewButtonObject(Object *image, Tag tag1, ...);
extern int SysISize(void);
extern int VA_GadLayout(struct Window *window, struct Gadget *glist,
                  struct Gadget *projgadgets[],
                  ULONG fsgads[], WORD gadtypes[],
                  struct NewGadget *gadgets, ULONG tags[],
                  struct List *lists[], UBYTE *projvars[]);
void InitLayoutVars(ULONG types[], UBYTE *vars[]);
