home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / os-include.lha / os-include / libraries / gadtools.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  17KB  |  453 lines

  1. #ifndef LIBRARIES_GADTOOLS_H
  2. #define LIBRARIES_GADTOOLS_H
  3. /*
  4. **    $VER: gadtools.h 39.9 (19.8.92)
  5. **    Includes Release 40.15
  6. **
  7. **    gadtools.library definitions
  8. **
  9. **    (C) Copyright 1989-1993 Commodore-Amiga, Inc.
  10. **    All Rights Reserved
  11. */
  12.  
  13. /*------------------------------------------------------------------------*/
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef UTILITY_TAGITEM_H
  20. #include <utility/tagitem.h>
  21. #endif
  22.  
  23. #ifndef INTUITION_INTUITION_H
  24. #include <intuition/intuition.h>
  25. #endif
  26.  
  27. /*------------------------------------------------------------------------*/
  28.  
  29. /* The kinds (almost classes) of gadgets that GadTools supports.
  30.  * Use these identifiers when calling CreateGadgetA()
  31.  */
  32.  
  33. #define GENERIC_KIND    0
  34. #define BUTTON_KIND    1
  35. #define CHECKBOX_KIND    2
  36. #define INTEGER_KIND    3
  37. #define LISTVIEW_KIND    4
  38. #define MX_KIND        5
  39. #define NUMBER_KIND    6
  40. #define CYCLE_KIND    7
  41. #define PALETTE_KIND    8
  42. #define SCROLLER_KIND    9
  43. /* Kind number 10 is reserved */
  44. #define SLIDER_KIND    11
  45. #define STRING_KIND    12
  46. #define TEXT_KIND    13
  47.  
  48. #define NUM_KINDS    14
  49.  
  50. /*------------------------------------------------------------------------*/
  51.  
  52. /* 'Or' the appropriate set together for your Window IDCMPFlags: */
  53.  
  54. #define ARROWIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN |\
  55.     IDCMP_INTUITICKS | IDCMP_MOUSEBUTTONS)
  56.  
  57. #define BUTTONIDCMP    (IDCMP_GADGETUP)
  58. #define CHECKBOXIDCMP    (IDCMP_GADGETUP)
  59. #define INTEGERIDCMP    (IDCMP_GADGETUP)
  60. #define LISTVIEWIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN |\
  61.     IDCMP_MOUSEMOVE | ARROWIDCMP)
  62.  
  63. #define MXIDCMP        (IDCMP_GADGETDOWN)
  64. #define NUMBERIDCMP    (0L)
  65. #define CYCLEIDCMP    (IDCMP_GADGETUP)
  66. #define PALETTEIDCMP    (IDCMP_GADGETUP)
  67.  
  68. /* Use ARROWIDCMP|SCROLLERIDCMP if your scrollers have arrows: */
  69. #define SCROLLERIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE)
  70. #define SLIDERIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE)
  71. #define STRINGIDCMP    (IDCMP_GADGETUP)
  72.  
  73. #define TEXTIDCMP    (0L)
  74.  
  75. /*------------------------------------------------------------------------*/
  76.  
  77. /* Generic NewGadget used by several of the gadget classes: */
  78.  
  79. struct NewGadget
  80. {
  81.     WORD ng_LeftEdge, ng_TopEdge;    /* gadget position */
  82.     WORD ng_Width, ng_Height;        /* gadget size */
  83.     UBYTE *ng_GadgetText;        /* gadget label */
  84.     struct TextAttr *ng_TextAttr;    /* desired font for gadget label */
  85.     UWORD ng_GadgetID;            /* gadget ID */
  86.     ULONG ng_Flags;            /* see below */
  87.     APTR ng_VisualInfo;            /* Set to retval of GetVisualInfo() */
  88.     APTR ng_UserData;            /* gadget UserData */
  89. };
  90.  
  91.  
  92. /* ng_Flags control certain aspects of the gadget.  The first five control
  93.  * the placement of the descriptive text.  Each gadget kind has its default,
  94.  * which is usually PLACETEXT_LEFT.  Consult the autodocs for details.
  95.  */
  96.  
  97. #define PLACETEXT_LEFT    0x0001    /* Right-align text on left side */
  98. #define PLACETEXT_RIGHT    0x0002    /* Left-align text on right side */
  99. #define PLACETEXT_ABOVE    0x0004    /* Center text above */
  100. #define PLACETEXT_BELOW    0x0008    /* Center text below */
  101. #define PLACETEXT_IN    0x0010    /* Center text on */
  102.  
  103. #define NG_HIGHLABEL    0x0020    /* Highlight the label */
  104.  
  105.  
  106. /*------------------------------------------------------------------------*/
  107.  
  108. /* Fill out an array of these and pass that to CreateMenus(): */
  109.  
  110. struct NewMenu
  111. {
  112.     UBYTE nm_Type;        /* See below */
  113.     /* Compiler inserts a PAD byte here */
  114.     STRPTR nm_Label;        /* Menu's label */
  115.     STRPTR nm_CommKey;        /* MenuItem Command Key Equiv */
  116.     UWORD nm_Flags;        /* Menu or MenuItem flags (see note) */
  117.     LONG nm_MutualExclude;    /* MenuItem MutualExclude word */
  118.     APTR nm_UserData;        /* For your own use, see note */
  119. };
  120.  
  121. /* Needed only by inside IM_ definitions below */
  122. #define MENU_IMAGE    128
  123.  
  124. /* nm_Type determines what each NewMenu structure corresponds to.
  125.  * for the NM_TITLE, NM_ITEM, and NM_SUB values, nm_Label should
  126.  * be a text string to use for that menu title, item, or sub-item.
  127.  * For IM_ITEM or IM_SUB, set nm_Label to point at the Image structure
  128.  * you wish to use for this item or sub-item.
  129.  * NOTE: At present, you may only use conventional images.
  130.  * Custom images created from Intuition image-classes do not work.
  131.  */
  132. #define NM_TITLE    1    /* Menu header */
  133. #define NM_ITEM        2    /* Textual menu item */
  134. #define NM_SUB        3    /* Textual menu sub-item */
  135.  
  136. #define IM_ITEM        (NM_ITEM|MENU_IMAGE)    /* Graphical menu item */
  137. #define IM_SUB        (NM_SUB|MENU_IMAGE)    /* Graphical menu sub-item */
  138.  
  139. /* The NewMenu array should be terminated with a NewMenu whose
  140.  * nm_Type equals NM_END.
  141.  */
  142. #define NM_END        0    /* End of NewMenu array */
  143.  
  144. /* Starting with V39, GadTools will skip any NewMenu entries whose
  145.  * nm_Type field has the NM_IGNORE bit set.
  146.  */
  147. #define NM_IGNORE    64
  148.  
  149.  
  150. /* nm_Label should be a text string for textual items, a pointer
  151.  * to an Image structure for graphical menu items, or the special
  152.  * constant NM_BARLABEL, to get a separator bar.
  153.  */
  154. #define NM_BARLABEL    ((STRPTR)-1)
  155.  
  156. /* The nm_Flags field is used to fill out either the Menu->Flags or
  157.  * MenuItem->Flags field.  Note that the sense of the MENUENABLED or
  158.  * ITEMENABLED bit is inverted between this use and Intuition's use,
  159.  * in other words, NewMenus are enabled by default.  The following
  160.  * labels are provided to disable them:
  161.  */
  162. #define NM_MENUDISABLED    MENUENABLED
  163. #define NM_ITEMDISABLED    ITEMENABLED
  164.  
  165. /* New for V39:  NM_COMMANDSTRING.  For a textual MenuItem or SubItem,
  166.  * point nm_CommKey at an arbitrary string, and set the NM_COMMANDSTRING
  167.  * flag.
  168.  */
  169. #define NM_COMMANDSTRING COMMSEQ
  170.  
  171. /* The following are pre-cleared (COMMSEQ, ITEMTEXT, and HIGHxxx are set
  172.  * later as appropriate):
  173.  * Under V39, the COMMSEQ flag bit is not cleared, since it now has
  174.  * meaning.
  175.  */
  176. #define NM_FLAGMASK    (~(COMMSEQ | ITEMTEXT | HIGHFLAGS))
  177. #define NM_FLAGMASK_V39    (~(ITEMTEXT | HIGHFLAGS))
  178.  
  179. /* You may choose among CHECKIT, MENUTOGGLE, and CHECKED.
  180.  * Toggle-select menuitems are of type CHECKIT|MENUTOGGLE, along
  181.  * with CHECKED if currently selected.    Mutually exclusive ones
  182.  * are of type CHECKIT, and possibly CHECKED too.  The nm_MutualExclude
  183.  * is a bit-wise representation of the items excluded by this one,
  184.  * so in the simplest case (choose 1 among n), these flags would be
  185.  * ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter.
  186.  */
  187.  
  188. /* A UserData pointer can be associated with each Menu and MenuItem structure.
  189.  * The CreateMenus() call allocates space for a UserData after each
  190.  * Menu or MenuItem (header, item or sub-item).  You should use the
  191.  * GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
  192.  */
  193.  
  194. #define GTMENU_USERDATA(menu) (* ( (APTR *)(((struct Menu *)menu)+1) ) )
  195. #define GTMENUITEM_USERDATA(menuitem) (* ( (APTR *)(((struct MenuItem *)menuitem)+1) ) )
  196.  
  197. /* Here is an old one for compatibility.  Do not use in new code! */
  198. #define MENU_USERDATA(menuitem) (* ( (APTR *)(menuitem+1) ) )
  199.  
  200. /* These return codes can be obtained through the GTMN_SecondaryError tag */
  201. #define GTMENU_TRIMMED    0x00000001    /* Too many menus, items, or subitems,
  202.                      * menu has been trimmed down
  203.                      */
  204. #define GTMENU_INVALID    0x00000002    /* Invalid NewMenu array */
  205. #define GTMENU_NOMEM    0x00000003    /* Out of memory */
  206.  
  207. /*------------------------------------------------------------------------*/
  208.  
  209. /* Starting with V39, checkboxes and mx gadgets can be scaled to your
  210.  * specified gadget width/height.  Use the new GTCB_Scaled or GTMX_Scaled
  211.  * tags, respectively.    Under V37, and by default in V39, the imagery
  212.  * is of the following fixed size:
  213.  */
  214.  
  215. /* MX gadget default dimensions: */
  216. #define MX_WIDTH    17
  217. #define MX_HEIGHT    9
  218.  
  219. /* Checkbox default dimensions: */
  220. #define CHECKBOX_WIDTH    26
  221. #define CHECKBOX_HEIGHT    11
  222.  
  223. /*------------------------------------------------------------------------*/
  224.  
  225. /* Tags for GadTools functions: */
  226.  
  227. #define GT_TagBase         TAG_USER + 0x80000
  228.  
  229. #define GTVI_NewWindow         GT_TagBase+1  /* Unused */
  230. #define GTVI_NWTags         GT_TagBase+2  /* Unused */
  231.  
  232. #define GT_Private0         GT_TagBase+3  /* (private) */
  233.  
  234. #define GTCB_Checked         GT_TagBase+4  /* State of checkbox */
  235.  
  236. #define GTLV_Top         GT_TagBase+5  /* Top visible one in listview */
  237. #define GTLV_Labels         GT_TagBase+6  /* List to display in listview */
  238. #define GTLV_ReadOnly         GT_TagBase+7  /* TRUE if listview is to be
  239.                         * read-only
  240.                         */
  241. #define GTLV_ScrollWidth     GT_TagBase+8  /* Width of scrollbar */
  242.  
  243. #define GTMX_Labels         GT_TagBase+9  /* NULL-terminated array of labels */
  244. #define GTMX_Active         GT_TagBase+10 /* Active one in mx gadget */
  245.  
  246. #define GTTX_Text         GT_TagBase+11 /* Text to display */
  247. #define GTTX_CopyText         GT_TagBase+12 /* Copy text label instead of
  248.                         * referencing it
  249.                         */
  250.  
  251. #define GTNM_Number         GT_TagBase+13 /* Number to display */
  252.  
  253. #define GTCY_Labels         GT_TagBase+14 /* NULL-terminated array of labels */
  254. #define GTCY_Active         GT_TagBase+15 /* The active one in the cycle gad */
  255.  
  256. #define GTPA_Depth         GT_TagBase+16 /* Number of bitplanes in palette */
  257. #define GTPA_Color         GT_TagBase+17 /* Palette color */
  258. #define GTPA_ColorOffset     GT_TagBase+18 /* First color to use in palette */
  259. #define GTPA_IndicatorWidth  GT_TagBase+19 /* Width of current-color indicator */
  260. #define GTPA_IndicatorHeight GT_TagBase+20 /* Height of current-color indicator */
  261.  
  262. #define GTSC_Top         GT_TagBase+21 /* Top visible in scroller */
  263. #define GTSC_Total         GT_TagBase+22 /* Total in scroller area */
  264. #define GTSC_Visible         GT_TagBase+23 /* Number visible in scroller */
  265. #define GTSC_Overlap         GT_TagBase+24 /* Unused */
  266.  
  267. /*  GT_TagBase+25 through GT_TagBase+37 are reserved */
  268.  
  269. #define GTSL_Min         GT_TagBase+38 /* Slider min value */
  270. #define GTSL_Max         GT_TagBase+39 /* Slider max value */
  271. #define GTSL_Level         GT_TagBase+40 /* Slider level */
  272. #define GTSL_MaxLevelLen     GT_TagBase+41 /* Max length of printed level */
  273. #define GTSL_LevelFormat     GT_TagBase+42 /* Format string for level */
  274. #define GTSL_LevelPlace      GT_TagBase+43 /* Where level should be placed */
  275. #define GTSL_DispFunc         GT_TagBase+44 /* Callback for number calculation
  276.                         * before display
  277.                         */
  278.  
  279. #define GTST_String         GT_TagBase+45 /* String gadget's displayed string */
  280. #define GTST_MaxChars         GT_TagBase+46 /* Max length of string */
  281.  
  282. #define GTIN_Number         GT_TagBase+47 /* Number in integer gadget */
  283. #define GTIN_MaxChars         GT_TagBase+48 /* Max number of digits */
  284.  
  285. #define GTMN_TextAttr         GT_TagBase+49 /* MenuItem font TextAttr */
  286. #define GTMN_FrontPen         GT_TagBase+50 /* MenuItem text pen color */
  287.  
  288. #define GTBB_Recessed         GT_TagBase+51 /* Make BevelBox recessed */
  289.  
  290. #define GT_VisualInfo         GT_TagBase+52 /* result of VisualInfo call */
  291.  
  292. #define GTLV_ShowSelected    GT_TagBase+53 /* show selected entry beneath
  293.         * listview, set tag data = NULL for display-only, or pointer
  294.         * to a string gadget you've created
  295.         */
  296. #define GTLV_Selected         GT_TagBase+54 /* Set ordinal number of selected
  297.                         * entry in the list
  298.                         */
  299. #define GT_Reserved1         GT_TagBase+56 /* Reserved for future use */
  300.  
  301. #define GTTX_Border         GT_TagBase+57 /* Put a border around
  302.                         * Text-display gadgets
  303.                         */
  304. #define GTNM_Border         GT_TagBase+58 /* Put a border around
  305.                         * Number-display gadgets
  306.                         */
  307.  
  308. #define GTSC_Arrows         GT_TagBase+59 /* Specify size of arrows for
  309.                         * scroller
  310.                         */
  311.  
  312. #define GTMN_Menu         GT_TagBase+60 /* Pointer to Menu for use by
  313.                         * LayoutMenuItems()
  314.                         */
  315. #define GTMX_Spacing         GT_TagBase+61 /* Added to font height to
  316.         * figure spacing between mx choices.  Use this instead
  317.         * of LAYOUTA_SPACING for mx gadgets.
  318.         */
  319.  
  320. /* New to V37 GadTools.  Ignored by GadTools V36 */
  321. #define GTMN_FullMenu         GT_TagBase+62 /* Asks CreateMenus() to
  322.         * validate that this is a complete menu structure
  323.         */
  324. #define GTMN_SecondaryError  GT_TagBase+63 /* ti_Data is a pointer
  325.         * to a ULONG to receive error reports from CreateMenus()
  326.         */
  327. #define GT_Underscore         GT_TagBase+64 /* ti_Data points to the symbol
  328.         * that preceeds the character you'd like to underline in a
  329.         * gadget label
  330.         */
  331. #define GTST_EditHook         GT_TagBase+55 /* String EditHook */
  332. #define GTIN_EditHook         GTST_EditHook /* Same thing, different name,
  333.         * just to round out INTEGER_KIND gadgets
  334.         */
  335.  
  336. /* New to V39 GadTools.  Ignored by GadTools V36 and V37 */
  337. #define GTMN_Checkmark         GT_TagBase+65 /* ti_Data is checkmark img to use */
  338. #define GTMN_AmigaKey         GT_TagBase+66 /* ti_Data is Amiga-key img to use */
  339. #define GTMN_NewLookMenus    GT_TagBase+67 /* ti_Data is boolean */
  340.  
  341. /* New to V39 GadTools.  Ignored by GadTools V36 and V37.
  342.  * Set to TRUE if you want the checkbox or mx image scaled to
  343.  * the gadget width/height you specify.  Defaults to FALSE,
  344.  * for compatibility.
  345.  */
  346. #define GTCB_Scaled         GT_TagBase+68 /* ti_Data is boolean */
  347. #define GTMX_Scaled         GT_TagBase+69 /* ti_Data is boolean */
  348.  
  349. #define GTPA_NumColors         GT_TagBase+70 /* Number of colors in palette */
  350.  
  351. #define GTMX_TitlePlace      GT_TagBase+71 /* Where to put the title */
  352.  
  353. #define GTTX_FrontPen         GT_TagBase+72 /* Text color in TEXT_KIND gad */
  354. #define GTTX_BackPen         GT_TagBase+73 /* Bgrnd color in TEXT_KIND gad */
  355. #define GTTX_Justification   GT_TagBase+74 /* See GTJ_#? constants */
  356.  
  357. #define GTNM_FrontPen         GT_TagBase+72 /* Text color in NUMBER_KIND gad */
  358. #define GTNM_BackPen         GT_TagBase+73 /* Bgrnd color in NUMBER_KIND gad */
  359. #define GTNM_Justification   GT_TagBase+74 /* See GTJ_#? constants */
  360. #define GTNM_Format         GT_TagBase+75 /* Formatting string for number */
  361. #define GTNM_MaxNumberLen    GT_TagBase+76 /* Maximum length of number */
  362.  
  363. #define GTBB_FrameType         GT_TagBase+77 /* defines what kind of boxes
  364.                         * DrawBevelBox() renders. See
  365.                         * the BBFT_#? constants for
  366.                         * possible values
  367.                         */
  368.  
  369. #define GTLV_MakeVisible     GT_TagBase+78 /* Make this item visible */
  370. #define GTLV_ItemHeight      GT_TagBase+79 /* Height of an individual item */
  371.  
  372. #define GTSL_MaxPixelLen     GT_TagBase+80 /* Max pixel size of level display */
  373. #define GTSL_Justification   GT_TagBase+81 /* how should the level be displayed */
  374.  
  375. #define GTPA_ColorTable      GT_TagBase+82 /* colors to use in palette */
  376.  
  377. #define GTLV_CallBack         GT_TagBase+83 /* general-purpose listview call back */
  378. #define GTLV_MaxPen         GT_TagBase+84 /* maximum pen number used by call back */
  379.  
  380. #define GTTX_Clipped         GT_TagBase+85 /* make a TEXT_KIND clip text */
  381. #define GTNM_Clipped         GT_TagBase+85 /* make a NUMBER_KIND clip text */
  382.  
  383. /* Old definition, now obsolete: */
  384. #define GT_Reserved0         GTST_EditHook
  385.  
  386. /*------------------------------------------------------------------------*/
  387.  
  388. /* Justification types for GTTX_Justification and GTNM_Justification tags */
  389. #define GTJ_LEFT   0
  390. #define GTJ_RIGHT  1
  391. #define GTJ_CENTER 2
  392.  
  393. /*------------------------------------------------------------------------*/
  394.  
  395. /* Bevel box frame types for GTBB_FrameType tag */
  396. #define BBFT_BUTTON     1  /* Standard button gadget box */
  397. #define BBFT_RIDGE     2  /* Standard string gadget box */
  398. #define BBFT_ICONDROPBOX 3  /* Standard icon drop box      */
  399.  
  400. /*------------------------------------------------------------------------*/
  401.  
  402. /* Typical suggested spacing between "elements": */
  403. #define INTERWIDTH    8
  404. #define INTERHEIGHT    4
  405.  
  406. /*------------------------------------------------------------------------*/
  407.  
  408. /* "NWay" is an old synonym for cycle gadgets */
  409. #define NWAY_KIND    CYCLE_KIND
  410. #define NWAYIDCMP    CYCLEIDCMP
  411. #define GTNW_Labels    GTCY_Labels
  412. #define GTNW_Active    GTCY_Active
  413.  
  414. /*------------------------------------------------------------------------*/
  415.  
  416. /* These two definitions are obsolete, but are here for backwards
  417.  * compatibility.  You never need to worry about these:
  418.  */
  419. #define GADTOOLBIT    (0x8000)
  420. /* Use this mask to isolate the user part: */
  421. #define GADTOOLMASK    (~GADTOOLBIT)
  422.  
  423. /*------------------------------------------------------------------------*/
  424.  
  425. /* These definitions are for the GTLV_CallBack tag */
  426.  
  427. /* The different types of messages that a listview callback hook can see */
  428. #define LV_DRAW       0x202L    /* draw yourself, with state */
  429.  
  430. /* Possible return values from a callback hook */
  431. #define LVCB_OK       0        /* callback understands this message type    */
  432. #define LVCB_UNKNOWN  1        /* callback does not understand this message */
  433.  
  434. /* states for LVDrawMsg.lvdm_State */
  435. #define LVR_NORMAL          0    /* the usual             */
  436. #define LVR_SELECTED          1    /* for selected gadgets         */
  437. #define LVR_NORMALDISABLED    2        /* for disabled gadgets         */
  438. #define    LVR_SELECTEDDISABLED  8        /* disabled and selected     */
  439.  
  440. /* structure of LV_DRAW messages, object is a (struct Node *) */
  441. struct LVDrawMsg
  442. {
  443.     ULONG          lvdm_MethodID;   /* LV_DRAW            */
  444.     struct RastPort  *lvdm_RastPort;   /* where to render to        */
  445.     struct DrawInfo  *lvdm_DrawInfo;   /* useful to have around     */
  446.     struct Rectangle  lvdm_Bounds;     /* limits of where to render */
  447.     ULONG          lvdm_State;      /* how to render        */
  448. };
  449.  
  450. /*------------------------------------------------------------------------*/
  451.  
  452. #endif /* LIBRARIES_GADTOOLS_H */
  453.