home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Milan_1991 / Devcon91.4 / AppShell / include / libraries / prefs.h < prev   
Encoding:
C/C++ Source or Header  |  1992-09-01  |  3.7 KB  |  120 lines

  1. /* prefs_lib.h
  2.  * preference library header
  3.  *
  4.  */
  5.  
  6. #include <exec/types.h>
  7. #include <dos/dos.h>
  8. #include <dos/notify.h>
  9. #include <intuition/intuition.h>
  10. #include <intuition/screens.h>
  11. #include <graphics/gfx.h>
  12. #include <graphics/displayinfo.h>
  13. #include <dos/dos.h>
  14. #include <dos/dosextens.h>
  15. #include <iff/ilbm.h>
  16.  
  17. /* GetPrefsDrawer() flags */
  18. #define    PREFS_GLOBAL_GPDF    (1L<<0)
  19. #define    PREFS_READONLY_GPDF    (1L<<1)
  20. #define    PREFS_FALLBACK_GPDF    (1L<<2)
  21.  
  22. /* GetPref() tags */
  23. /* fix these ... */
  24. #define    PREFS_DEFAULT_A        (TAG_USER + 1L)
  25. #define    PREFS_QUICKFAIL_A    (TAG_USER + 2L)
  26. #define    PREFS_NAME_A        (TAG_USER + 3L)
  27. #define    PREFS_NOTIFY_A        (TAG_USER + 4L)
  28. #define    PREFS_CALLBACK_A    (TAG_USER + 5L)
  29. #define    PREFS_FRESHEN_A        (TAG_USER + 6L)
  30. #define    PREFS_LIST_A        (TAG_USER + 7L)
  31. #define    PREFS_PRIVATE_1        (TAG_USER + 8L)
  32. #define    PREFS_DEPTH        (TAG_USER + 9L)
  33.  
  34. /* Preference kinds */
  35. #define PREFS_SCREENMODE    0
  36. #define PREFS_PALETTE        1
  37. #define PREFS_POINTER        2
  38. #define PREFS_BUSYPOINTER    3
  39. #define PREFS_WBCONFIG        4
  40. #define PREFS_FONT        5
  41. #define    PREFS_KINDS        6
  42.  
  43. /* Common header for each preference file */
  44. struct Prefs
  45. {
  46.     struct Node p_Node;        /* Node in the list of preferences */
  47.     LONG p_Kind;        /* Kind of preference file */
  48.     ULONG p_Flags;        /* Flags */
  49.     struct NotifyRequest *p_NR;    /* Notification request to use for file */
  50.     VOID (*p_Func)(VOID *, ...);/* Function to call when notification occurs */
  51. };
  52.  
  53. /* Prefs flags */
  54. #define    PREFS_INTERNAL_F    (1L<<0)
  55. #define    PREFS_CLOSEALL_F    (1L<<1)
  56. #define    PREFS_GLOBAL_F        (1L<<2)    /* Pref record came from global dir */
  57. #define    PREFS_SYSTEM_F        (1L<<3)    /* Pref record came from system dir */
  58. #define    PREFS_DEFAULT_F        (1L<<4)    /* Pref record is the default */
  59. #define    PREFS_WHERE_F        (PREFS_GLOBAL_F | PREFS_SYSTEM_F | PREFS_DEFAULT_F)
  60.  
  61. /* Screen mode preference record */
  62. struct ScreenModePref
  63. {
  64.     struct Prefs smp_Header;    /* Header */
  65.     ULONG smp_Reserved[4];
  66.     ULONG smp_ModeID;        /* Display mode ID */
  67.     UWORD smp_Width;        /* Width of screen, 65535 indicates DEFAULT */
  68.     UWORD smp_Height;        /* Height of screen, 65535 indicates DEFAULT */
  69.     UWORD smp_Depth;        /* Depth of screen */
  70.     UWORD smp_AutoScroll;    /* Use autoscroll? */
  71. };
  72.  
  73. #define    MAXCOLORS    32
  74. #define    MAXPENS        12
  75.  
  76. /* Palette preference record */
  77. struct PalettePref
  78. {
  79.     struct Prefs pp_Header;    /* Header */
  80.     WORD pp_CRegs[MAXCOLORS];    /* Color table used by LoadRGB4() */
  81.     SHORT pp_NumColors;        /* Number of entries in the table */
  82.     UWORD pp_Pens[MAXPENS];    /* Pen spec to use with this color palette */
  83. };
  84.  
  85. /* Pointer preference record */
  86. struct PointerPref
  87. {
  88.     struct Prefs pp_Header;    /* Preference header */
  89.     UWORD *pp_PData;        /* Pointer data */
  90.     WORD pp_Height;        /* Height of pointer */
  91.     WORD pp_Width;        /* Width of pointer */
  92.     WORD pp_XOffset;        /* X offset of hotspot */
  93.     WORD pp_YOffset;        /* Y offset of hotspot */
  94.     WORD pp_CRegs[3];        /* Color spec */
  95.     LONG pp_DSize;        /* Size of data */
  96. };
  97.  
  98. /* Work structure */
  99. typedef struct ILBMRec
  100. {
  101.     ULONG ir_ModeID;        /* Display mode id */
  102.     UWORD ir_Width;        /* Width of image */
  103.     UWORD ir_Height;        /* Height of image */
  104.     UWORD ir_Depth;        /* Depth of image */
  105.     struct BitMap ir_BMap;    /* Bitmap */
  106.     struct RastPort ir_RPort;    /* RastPort */
  107.     struct Point2D ir_Grab;    /* Grab coordinates */
  108.     WORD ir_CRegs[MAXCOLORS];    /* Color table used by LoadRGB4() */
  109.     WORD ir_NumColors;        /* Number of colors in color table */
  110. } ILBM;
  111.  
  112. #ifndef PREFS_INTERNAL
  113. BPTR GetPrefsDrawer (STRPTR basename, ULONG flags);
  114. VOID *GetPref (LONG kind, BPTR drawer, struct TagItem * attrs);
  115. BOOL SetPref (LONG kind, BPTR drawer, VOID *pref, struct TagItem * attrs);
  116. VOID FreePref (VOID *pref);
  117. VOID FreePrefList (struct List *list);
  118. VOID *GetPrefRecord (struct List *list, LONG kind);
  119. #endif /* ifndef PREFS_INTERNAL */
  120.