home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d8xx / d854 / drafu.lha / DRAFU / ak_gen0-Library / Programmers / ak_gen0.h < prev    next >
C/C++ Source or Header  |  1993-02-27  |  12KB  |  301 lines

  1. /* ************************************************************************ */
  2. /* AK_GEN0_H (Headerfile for use with the "ak_gen0.library")                */
  3. /* ************************************************************************ */
  4. /* (c) 1989-93 by Andreas Ralph Kleinert. All rights reserved.              */
  5. /* COMMERCIAL USE IS NOT ALLOWED WITHOUT SPECIAL PERMISSION BY THE AUTHOR ! */
  6. /* ************************************************************************ */
  7. /* Version          : V36.52                                                */
  8. /* Last updated     : 08.01.1993                                            */
  9. /* Compiler         : SAS/C V5.10a/b                                        */
  10. /* Compiler-Options : (MakeFile)                                            */
  11. /* ************************************************************************ */
  12. /* Address          : Andreas Ralph Kleinert                                */
  13. /*                    Grube Hohe Grethe 23                                  */
  14. /*                    W-5900 Siegen 1                                       */
  15. /*                    Germany                                               */
  16. /* ************************************************************************ */
  17.  
  18. #ifndef AK_GEN0_H
  19. #define AK_GEN0_H
  20.  
  21. #define AK_GEN0_VERSION  (36)
  22. #define AK_GEN0_REVISION (52)
  23.  
  24. #define AK_GEN0_MINIMUM (35)
  25.  
  26. /* You should only use versions greater than V34, because of various reasons.
  27.    Your specific "minimum" may be higher, if you make use of new functions.
  28. */
  29.  
  30. #include <intuition/intuitionbase.h>
  31. #include <exec/memory.h>
  32. #include <graphics/gfxbase.h>
  33. #include <stdio.h>
  34. #include <libraries/dos.h>
  35.  
  36. /* Defines */
  37.  
  38. #define N (NULL)
  39. #define FIRST_SCREEN   ( (struct Screen *) IntuitionBase->FirstScreen )
  40. #define CURRENT_WINDOW ( (struct Window *) IntuitionBase->ActiveWindow )
  41. #define CURRENT_SCREEN ( (struct Screen *) IntuitionBase->ActiveScreen )
  42. #define CURRENT_MOUSEX ( CURRENT_WINDOW->MouseX )
  43. #define CURRENT_MOUSEY ( CURRENT_WINDOW->MouseY )
  44. #define NEWWINDOW (sizeof(struct NewWindow))
  45. #define WINDOW (sizeof(struct Window))
  46. #define BORDER (sizeof(struct Border))
  47. #define MENU (sizeof(struct Menu))
  48. #define GADGET (sizeof(struct Gadget))
  49. #define ITEXT (sizeof(struct IntuiText))
  50. #define ITEM (sizeof(struct MenuItem))
  51. #define SUBITEM ITEM
  52. #define STRINGINFO (sizeof(struct StringInfo))
  53. #define REQUESTER (sizeof(struct Requester))
  54. #define PROPINFO (sizeof(struct PropInfo))
  55. #define ALERT (sizeof(struct AlertData))
  56. #define NEWSCREEN (sizeof(struct NewScreen))
  57.  
  58. /* Constants */
  59.  
  60. #define AK_FILEREQ_STRING_LEN (256) /* The Filerequester creates a string   */
  61.                                     /* of this length.                      */
  62.                                     /* This will not change (because of the */
  63.                                     /* nice BCPL-like DOS) and can be used  */
  64.                                     /* as a parameter to "FreeMem()".       */
  65.  
  66. /* Defines for "direntry[]" of AK_ReadDir() */
  67.  
  68. #define AKF_IS_FILE (FALSE) /* compatibility  (same as NULL)             */
  69. #define AKF_IS_DIR  (TRUE)  /* compatibility  (same as 1<<1)             */
  70. #define AKF_IS_VOL  (1<<2)  /* NEW in V35.99, only FileRequester PRIVATE */
  71.  
  72. /* Official defines sine V35.102 :
  73.  
  74.    These defines had changed since V35.98, but they were no longer compatible.
  75.    This bug is now fixed, but also for compatibility, entries in "direntry[]"
  76.    are limited to the values TRUE or FALSE, which means "Dir" or "Not Dir"
  77.    (== "File").
  78.    The use of the new define "AKF_IS_VOL" is only thought for PRIVATE use
  79.    with the FileRequester's "Assigns"-Gadget.
  80.    Do not use it.
  81. */   
  82.  
  83.  
  84. /* Library-Bases (to be declared as externals)                      */
  85. /* Define AKG_NOBASES if you use your own declarations/definitions. */
  86.  
  87. #ifndef AKG_NOBASES
  88.  
  89. struct IntuitionBase *IntuitionBase = N;
  90. struct GfxBase       *GfxBase       = N;
  91. struct AKBase        *AKBase        = N;
  92. struct LayersBase    *LayersBase    = N; /* perhaps you'll seldom use it. */
  93.  
  94. #endif AKG_NOBASES
  95.  
  96. /* MACROs */
  97.  
  98. #define SIZE_PAL(window)  (WindowLimits(window, 0, 0, 640, 256))
  99. #define SIZE_NTSC(window) (WindowLimits(window, 0, 0, 640, 200))
  100.  
  101. #define SET_MAX (SIZE_PAL(CURRENT_WINDOW)) /* OBSOLETE */
  102.  
  103.  /* SET_MAX is only included for compatibility.
  104.     Use SIZE_PAL/SIZE_NTSC instead.
  105.     V36.9 : Redefined as Sub-Macro of SIZE_PAL.
  106.  */
  107.  
  108. #define xMEN(x) MENUNUM(x->Code)  /* NOTE : Use these, if possible         */
  109. #define xITN(x) ITEMNUM(x->Code)  /*        or use the originals !!!       */
  110. #define xSTN(x) SUBNUM(x->Code)
  111.  
  112. #define MEN xMEN(im)              /* OBSOLETE.                             */
  113. #define ITN xITN(im)              /* NOTE : Use xMEN,xITN,xSTN instead !!! */
  114. #define STN xSTN(im)
  115.  
  116. #define MEN_2 xMEN(im2)           /* OBSOLETE.                             */
  117. #define ITN_2 xITN(im2)           /* NOTE : Use xMEN,xITN,xSTN instead !!! */
  118. #define STN_2 xSTN(im2)
  119.  
  120.  /* MEN, ITN, STN (and MEN_2, ITN_2, STN_2) are only included for
  121.     compatibility.
  122.     Use xMEN, xITN, xSTN instead (or use the originals).
  123.     V36.9 : Redefined as Sub-Macros of xMEN, xITN, xSTN.
  124.  */
  125.  
  126.  
  127. /* Standard-Values */
  128.  
  129.  /* If you make use of the obsolete ones of the above Macros, you also have
  130.     to use the following variables (define AKG_NOVARS if you don't need
  131.     them) :
  132.  */
  133.  
  134. #ifndef AKG_NOVARS
  135.  
  136. struct IntuiMessage *im             = N; /* First Window  */
  137. struct Window       *w              = N;
  138.  
  139. struct IntuiMessage *im_2           = N; /* Second Window */
  140. struct Window       *w_2            = N;
  141.  
  142. #endif AKG_NOVARS
  143.  
  144.  
  145. /* Structures, used or returned by functions of this library */
  146.  
  147.  /* Note : Up to V36.10 there is only one kind of Requester implemented :
  148.            The FileRequester. It is possible, that the development of
  149.            structures for other kinds of requesters will result in new
  150.            (and different) structures for both : The FileRequester and the
  151.            other Requesters.
  152.            Nevertheless any new FileRequester-Structure WILL be compatible
  153.            to this "old" (yet "new") one !
  154.  */
  155.  
  156. struct AK_Requester /* structure for use with ak_gen0-requesters */
  157. {
  158.  APTR  akr_APTR;       /* RESERVED. ONLY FOR PRIVATE USE.                   */
  159.  
  160.  ULONG akr_Type;       /* Which type ? See flags below. DO NOT CHANGE !!!   */
  161.  
  162.  ULONG akr_Flags;      /* PRIVATE. (up to now)                              */
  163.  ULONG akr_Reserved1;  /* PRIVATE. (up to now)                              */
  164.  
  165.  /* ENTRIES TO BE MODIFIED BY THE USER (BEGIN) */
  166.  
  167.  APTR  akr_Window;     /* Pointer to User-Window or NULL (CURRENT_WINDOW).  */
  168.  
  169.  LONG  akr_LeftEdge;   /* Distance to the left border of your Screen.       */
  170.  LONG  akr_TopEdge;    /* Distance to the top border of your Screen.        */
  171.  
  172.  BYTE *akr_Title;      /* Pointer to title text for Window.  May be NULL.   */
  173.  BYTE *akr_OKText;     /* Pointer to text for OK-Gadget.     May be NULL.   */
  174.  BYTE *akr_CancelText; /* Pointer to text for Cancel-Gadget. May be NULL.   */
  175.  
  176.  LONG  akr_FGColor;    /* Foreground color (window). Default is -1.         */
  177.  LONG  akr_BGColor;    /* Background color (window). Default is -1.         */
  178.                        /* With ak_gen0-Requester only used for OK/Cancel    */
  179.                        /* gadgets.                                          */
  180.  
  181.  ULONG akr_Default1;   /* These are values, which have different meanings   */
  182.  ULONG akr_Default2;   /* for different requester types. OPTIONAL.          */
  183.  ULONG akr_Default3;   /* See explanations below. Default is always NULL.   */
  184.  
  185.  /* ENTRIES TO BE MODIFIED BY THE USER (END) */
  186.  
  187.  APTR  akr_Tags;       /* RESERVED for future expansions. Always NULL.      */
  188.  
  189.  /* ======================================================================= */
  190.  /* SIZE MAY GROW IN FUTURE VERSIONS. ONLY ALLOC WITH AK_AllocRequester() ! */
  191.  /* FREE WITH AK_FreeRequester().                                           */
  192.  /* ======================================================================= */
  193. };
  194.  
  195. /* Alloc this structure with : AK_AllocRequester(AK_REQTYPE_FILE)
  196.    Use this structure with   : - AK_NewFileRequester(structure)
  197.                                - ... [ future ]
  198.    Free this structure with  : AK_FreeRequester(structure)
  199. */
  200.  
  201.  
  202. /* Flags for akr_Type AND AK_AllocRequester() */
  203.  
  204. #define AK_REQTYPE_FILE     (1<<1)
  205. #define AK_REQTYPE_RESERVED (~(AK_REQTYPE_FILE))
  206.  
  207.  
  208. /* Flags for akr_Flags : */
  209.  
  210. #define AK_REQFLAG_RESERVED (~(NULL)) /* PRIVATE. (up to now) */
  211.  
  212.  
  213. /* Meaning of the akr_Default fields :
  214.  
  215.    - FileRequester (AK_REQTYPE_FILE) :
  216.  
  217.      - akr_Default1  : May contain the name of a Default-Directory or NULL.
  218.      - akr_Default2  : May contain the name of a Default-File      or NULL.
  219.      - akr_Default3  : Not supported yet.
  220.  
  221.    - Other Requesters :
  222.  
  223.      SORRY ! Not yet implemented !
  224.  
  225. */
  226.  
  227.  
  228. /* Declarations of the Library-Functions */
  229.  
  230. extern struct Screen * __saveds AK_Screen(long l, long t, long w, long h, long d,
  231.                                   long dp, long bp, long vm, long ty,
  232.                                   struct TextAttr *f, char *title, 
  233.                                   struct BitMap *cbm);
  234.  
  235. extern struct Window * __saveds AK_Window(long l, long t, long w, long h, long d,
  236.                                   long b, long idcmp, long flags,
  237.                                   struct Gadget *fg, struct Image *cm,
  238.                                   char *title, struct Screen *screen,
  239.                                   struct BitMap *bm, long minw, long minh,
  240.                                   long maxw, long maxh, long type);
  241.  
  242. extern struct Menu * __saveds AK_Menu(struct Menu *next, long l, long w, long flags,
  243.                               char *name, struct MenuItem *item);
  244.  
  245. extern struct MenuItem * __saveds AK_MenuItem(struct MenuItem *next, long t, long w,
  246.                                       long flags, long me, APTR itfi, 
  247.                                       APTR sefi, long scut,
  248.                                       struct MenuItem * subi);
  249.  
  250. extern struct MenuItem * __saveds AK_SubItem(struct MenuItem *next, long l, long t,
  251.                                      long w, long flags, long me, APTR itfi,
  252.                                      APTR sefi, long scut,
  253.                                      struct MenuItem *subi);
  254.  
  255. extern struct Gadget * __saveds AK_Gadget(struct Gadget *next, long l, long t, long w,
  256.                                   long h, long flags, long act, long type,
  257.                                   APTR gadr, APTR selr, struct IntuiText *text,
  258.                                   APTR sp, long id);
  259.  
  260. extern struct StringInfo * __saveds AK_StringInfo(long groesse, long maximum, 
  261.                                           struct KeyMap *km);
  262.  
  263. extern struct Border * __saveds AK_Border(long l, long t, long f, long b, long d,
  264.                                    long c, SHORT *xy, struct Border *next);
  265.  
  266. extern struct IntuiText * __saveds AK_IText(long f, long b, long d, long l, long t,
  267.                                      struct TextAttr *font, char *text,
  268.                                      struct IntuiText *next);
  269.  
  270. extern void   __saveds AK_GfxPrint(struct Window *w, char *text, long x, long y);
  271.  
  272. extern void   __saveds AK_IntuiPrint(struct Window *w, char *text, long x, long y);
  273.  
  274. extern void   __saveds AK_RefreshDisp(struct Screen *sc, struct Window *w);
  275.  
  276. extern long   __saveds AK_AutoRequester(struct Window *w, char *obertext, char *jatext,
  277.                               char *neintext);
  278.  
  279. extern long   __saveds AK_Alert(char *text, long height);
  280.  
  281. extern char * __saveds AK_FileRequest(long xpos, long ypos, struct Screen *fscreen,
  282.                                       struct Window *fwindow, long ftype);
  283.  
  284. extern long   __saveds AK_ReadDir(char *pathname, char **direntry, long *dirtype);
  285.  
  286. extern void   __saveds AK_WaitKey(long rawcode);
  287.  
  288. extern void   __saveds AK_WaitLeft(void);
  289.  
  290. extern long   __saveds AK_GetNum(long min, long max);
  291.  
  292.  /* NEW in V36 */
  293.  
  294. extern APTR   __saveds AK_AllocRequester(long type);
  295.  
  296. extern void   __saveds AK_FreeRequester(struct AK_Requester *ak_req);
  297.  
  298. extern char * __saveds AK_ExtFileRequest(struct AK_Requester *ak_req);
  299.  
  300. #endif AK_GEN0_H
  301.