/* ************************************************************************ */
/* AK_GEN0_H V35.106                                                        */
/* ************************************************************************ */
/* (c) 1989-92 by Andreas Ralph Kleinert. All rights reserved.              */
/* COMMERCIAL USE IS NOT ALLOWED WITHOUT SPECIAL PERMISSION BY THE AUTHOR ! */
/* ************************************************************************ */
/* Version          : V35.106                                               */
/* Last updated     : 03.07.1992                                            */
/* Compiler         : SAS/C V5.10a/b                                        */
/* Compiler-Options : (MakeFile)                                            */
/* ************************************************************************ */
/* Address          : Andreas Ralph Kleinert                                */
/*                    Grube Hohe Grethe 23                                  */
/*                    W-5900 Siegen 1                                       */
/*                    Germany                                               */
/* ************************************************************************ */

#ifndef AK_GEN0_H
#define AK_GEN0_H

#define AK_GEN0_VERSION (35)
#define AK_GEN0_REVISION (106)

#include <intuition/intuitionbase.h>
#include <exec/memory.h>
#include <graphics/gfxbase.h>
#include <stdio.h>
#include <libraries/dos.h>

/* Defines */

#define N (NULL)
#define FIRST_SCREEN   ( (struct Screen *) IntuitionBase->FirstScreen )
#define CURRENT_WINDOW ( (struct Window *) IntuitionBase->ActiveWindow )
#define CURRENT_SCREEN ( (struct Screen *) IntuitionBase->ActiveScreen )
#define CURRENT_MOUSEX ( CURRENT_WINDOW->MouseX )
#define CURRENT_MOUSEY ( CURRENT_WINDOW->MouseY )
#define NEWWINDOW (sizeof(struct NewWindow))
#define WINDOW (sizeof(struct Window))
#define BORDER (sizeof(struct Border))
#define MENU (sizeof(struct Menu))
#define GADGET (sizeof(struct Gadget))
#define ITEXT (sizeof(struct IntuiText))
#define ITEM (sizeof(struct MenuItem))
#define SUBITEM ITEM
#define STRINGINFO (sizeof(struct StringInfo))
#define REQUESTER (sizeof(struct Requester))
#define PROPINFO (sizeof(struct PropInfo))
#define ALERT (sizeof(struct AlertData))
#define NEWSCREEN (sizeof(struct NewScreen))

/* Constants */

#define AK_FILEREQ_STRING_LEN (256) /* this will not change and can be used */
                                    /* as a parameter to "FreeMem()"        */

/* Defines for "direntry[]" of AK_ReadDir() */

#define AKF_IS_FILE (FALSE) /* compatibility  */
#define AKF_IS_DIR  (TRUE)  /* compatibility  */
#define AKF_IS_VOL  (1<<2)  /* NEW in V35.99, only FileRequester PRIVATE */

/* Official defines sine V35.102 :

   These defines had changed since V35.98, but they were no longer compatible.
   This bug is now fixed, but also for compatibility, entries in "direntry[]"
   are limited to the values TRUE or FALSE, which means "Dir" or "Not Dir"
   (== "File").
   The use of the new define "AKF_IS_VOL" is only thought for PRIVATE use
   with the FileRequester's "Assigns"-Gadget.
   Do not use it.
*/   


/* Library-Bases (to be declared as externals) */

#ifndef AKG_NOBASES

struct IntuitionBase *IntuitionBase = N;
struct GfxBase       *GfxBase       = N;
struct AKBase        *AKBase        = N;
struct LayersBase    *LayersBase    = N;

#endif AKG_NOBASES

/* MACROs */

#define SET_MAX (WindowLimits(CURRENT_WINDOW, 0, 0, 640, 256))

 /* SET_MAX is only included for compatibility.
    Use SIZE_PAL/SIZE_NTSC instead.
 */

#define SIZE_PAL(window)  (WindowLimits(window, 0, 0, 640, 256))
#define SIZE_NTSC(window) (WindowLimits(window, 0, 0, 640, 200))

#define MEN MENUNUM(im->Code)     /* better use xMEN,xITN,xSTN */
#define ITN ITEMNUM(im->Code)
#define STN SUBNUM(im->Code)

#define MEN_2 MENUNUM(im_2->Code) /* better use xMEN,xITN,xSTN */
#define ITN_2 ITEMNUM(im_2->Code)
#define STN_2 SUBNUM(im_2->Code)

#define xMEN(x) MENUNUM(x->Code)  /* use this, when possible */
#define xITN(x) ITEMNUM(x->Code)  /* or use the originals    */
#define xSTN(x) SUBNUM(x->Code)

/* Standard-Values */

 /* If you want to use the above Macros, you have to use the following */
 /* variables :                                                        */

#ifndef AKG_NOVARS

struct IntuiMessage *im             = N; /* First Window  */
struct Window       *w              = N;

struct IntuiMessage *im_2           = N; /* Second Window */
struct Window       *w_2            = N;

#endif AKG_NOVARS

/* Declarations */

extern struct Screen * __saveds AK_Screen(long l, long t, long w, long h, long d,
                                  long dp, long bp, long vm, long ty,
                                  struct TextAttr *f, char *title, 
                                  struct BitMap *cbm);

extern struct Window * __saveds AK_Window(long l, long t, long w, long h, long d,
                                  long b, long idcmp, long flags,
                                  struct Gadget *fg, struct Image *cm,
                                  char *title, struct Screen *screen,
                                  struct BitMap *bm, long minw, long minh,
                                  long maxw, long maxh, long type);

extern struct Menu * __saveds AK_Menu(struct Menu *next, long l, long w, long flags,
                              char *name, struct MenuItem *item);

extern struct MenuItem * __saveds AK_MenuItem(struct MenuItem *next, long t, long w,
                                      long flags, long me, APTR itfi, 
                                      APTR sefi, long scut,
                                      struct MenuItem * subi);

extern struct MenuItem * __saveds AK_SubItem(struct MenuItem *next, long l, long t,
                                     long w, long flags, long me, APTR itfi,
                                     APTR sefi, long scut,
                                     struct MenuItem *subi);

extern struct Gadget * __saveds AK_Gadget(struct Gadget *next, long l, long t, long w,
                                  long h, long flags, long act, long type,
                                  APTR gadr, APTR selr, struct IntuiText *text,
                                  APTR sp, long id);

extern struct StringInfo * __saveds AK_StringInfo(long groesse, long maximum, 
                                          struct KeyMap *km);

extern struct Border * __saveds AK_Border(long l, long t, long f, long b, long d,
                                   long c, SHORT *xy, struct Border *next);

extern struct IntuiText * __saveds AK_IText(long f, long b, long d, long l, long t,
                                     struct TextAttr *font, char *text,
                                     struct IntuiText *next);

extern void   __saveds AK_GfxPrint(struct Window *w, char *text, long x, long y);

extern void   __saveds AK_IntuiPrint(struct Window *w, char *text, long x, long y);

extern void   __saveds AK_RefreshDisp(struct Screen *sc, struct Window *w);

extern long   __saveds AK_AutoRequester(struct Window *w, char *obertext, char *jatext,
                              char *neintext);

extern long   __saveds AK_Alert(char *text, long height);

extern char * __saveds AK_FileRequest(long xpos, long ypos, struct Screen *fscreen,
                                      struct Window *fwindow, long ftype);

extern long   __saveds AK_ReadDir(char *pathname, char **direntry, long *dirtype);

extern void   __saveds AK_WaitKey(long rawcode);

extern void   __saveds AK_WaitLeft(void);

extern long   __saveds AK_GetNum(long min, long max);

#endif AK_GEN0_H
