home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Includes_and_Autodocs_3.5 / include / libraries / gadtools.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-20  |  16.7 KB  |  457 lines

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