home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D3.DMS / in.adf / Interfaces / GadTools.mod < prev    next >
Encoding:
Text File  |  1993-10-23  |  23.6 KB  |  560 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*   updated for V39 by hartmut Goebel                                     *)
  7. (*                                                                         *)
  8. (*-------------------------------------------------------------------------*)
  9.  
  10. MODULE GadTools;
  11.  
  12. IMPORT e   * := Exec,
  13.        u   * := Utility,
  14.        I   * := Intuition,
  15.        g   * := Graphics,
  16.        sys * := SYSTEM;
  17.  
  18. CONST
  19.   gadtoolsName * = "gadtools.library";
  20.  
  21.  
  22. (*------------------------------------------------------------------------*)
  23. CONST
  24.  
  25. (* The kinds (almost classes) of gadgets that GadTools supports.
  26.  * Use these identifiers when calling CreateGadgetA()
  27.  *)
  28.  
  29.   genericKind    * = 0;
  30.   buttonKind     * = 1;
  31.   checkBoxKind   * = 2;
  32.   integerKind    * = 3;
  33.   listViewKind   * = 4;
  34.   mxKind         * = 5;
  35.   numberKind     * = 6;
  36.   cycleKind      * = 7;
  37.   paletteKind    * = 8;
  38.   scrollerKind   * = 9;
  39. (* Kind number 10 is reserved *)
  40.   sliderKind     * = 11;
  41.   stringKind     * = 12;
  42.   textKind       * = 13;
  43.  
  44.   numKinds       * = 14;
  45.  
  46. (*------------------------------------------------------------------------*)
  47.  
  48. (*  'Or' the appropriate set together for your Window IDCMPFlags: *)
  49.  
  50.   arrowIDCMP      * = LONGSET{I.gadgetUp,I.gadgetDown,I.intuiTicks,I.mouseButtons};
  51.  
  52.   buttonIDCMP     * = LONGSET{I.gadgetUp};
  53.   checkBoxIDCMP   * = LONGSET{I.gadgetUp};
  54.   integerIDCMP    * = LONGSET{I.gadgetUp};
  55.   listViewIDCMP   * = LONGSET{I.gadgetUp,I.gadgetDown,I.mouseMove} + arrowIDCMP;
  56.  
  57.   mxIDCMP         * = LONGSET{I.gadgetDown};
  58.   numberIDCMP     * = LONGSET{};
  59.   cycleIDCMP      * = LONGSET{I.gadgetUp};
  60.   paletteIDCMP    * = LONGSET{I.gadgetUp};
  61.  
  62. (*  Use arrowIDCMP + scrollerIDCMP if your scrollers have arrows: *)
  63.   scrollerIDCMP   * = LONGSET{I.gadgetUp,I.gadgetDown,I.mouseMove};
  64.   sliderIDCMP     * = LONGSET{I.gadgetUp,I.gadgetDown,I.mouseMove};
  65.   stringIDCMP     * = LONGSET{I.gadgetUp};
  66.  
  67.   textIDCMP       * = LONGSET{};
  68.  
  69. (*------------------------------------------------------------------------*)
  70.  
  71. TYPE
  72.  
  73.   VisualInfo * = UNTRACED POINTER TO STRUCT END;   (* returned by GetVisualInfo() *)
  74.  
  75. (*  Generic NewGadget used by several of the gadget classes: *)
  76.  
  77.   NewGadgetPtr * = UNTRACED POINTER TO NewGadget;
  78.   NewGadget * = STRUCT
  79.     leftEdge * , topEdge * : INTEGER;       (*  gadget position *)
  80.     width * , height * : INTEGER;           (*  gadget size *)
  81.     gadgetText * : e.STRPTR;                (*  gadget label *)
  82.     textAttr * : g.TextAttrPtr;             (*  desired font for gadget label *)
  83.     gadgetID * : INTEGER;                   (*  gadget ID *)
  84.     flags * : LONGSET;                      (*  see below *)
  85.     visualInfo * : VisualInfo;              (*  Set to retval of GetVisualInfo() *)
  86.     userData * : e.APTR;                    (*  gadget UserData *)
  87.   END;
  88.  
  89. CONST
  90.  
  91. (* NewGadsget.flags control certain aspects of the gadget.  The first five
  92.  * the placement of the descriptive text.  Each gadget kind has its default,
  93.  * which is usually PLACETEXT_LEFT.  Consult the autodocs for details.
  94.  *)
  95.  
  96.   placeTextLeft   * = 0;  (* Right-align text on left side *)
  97.   placeTextRight  * = 1;  (* Left-align text on right side *)
  98.   placeTextAbove  * = 2;  (* Center text above *)
  99.   placeTextBelow  * = 3;  (* Center text below *)
  100.   placeTextIn     * = 4;  (* Center text on *)
  101.  
  102.   highLabel       * = 5;  (* Highlight the label *)
  103.  
  104. (*------------------------------------------------------------------------*)
  105.  
  106. TYPE
  107.  
  108. (* Fill out an array of these and pass that to CreateMenus(): *)
  109.  
  110.   NewMenuPtr * = UNTRACED POINTER TO NewMenu;
  111.   NewMenu * = STRUCT
  112.     type * : SHORTINT;              (*  See below *)
  113.     label * : e.STRPTR;             (*  Menu's label *)
  114.     commKey * : e.STRPTR;           (*  MenuItem Command Key Equiv *)
  115.     flags * : SET;                  (*  Menu or MenuItem flags (see note) *)
  116.     mutualExclude * : LONGSET;      (*  MenuItem MutualExclude word *)
  117.     userData * : e.APTR;            (*  For your own use, see note *)
  118.   END;
  119.  
  120. CONST
  121. (* Needed only by inside IM_ definitions below *)
  122.   menuImage * = -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.   title     * = 1;          (* Menu header *)
  133.   item      * = 2;          (* Textual menu item *)
  134.   sub       * = 3;          (* Textual menu sub-item *)
  135.  
  136.   imItem    * = item + menuImage;  (* Graphical menu item *)
  137.   imSub     * = sub  + menuImage;  (* Graphical menu sub-item *)
  138.  
  139. (* The NewMenu array should be terminated with a NewMenu whose
  140.  * nm_Type equals NM_END.
  141.  *)
  142.   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.   nmIgnore  * = 64;
  148.  
  149. (* nm_Label should be a text string for textual items, a pointer
  150.  * to an Image structure for graphical menu items, or the special
  151.  * constant NM_BARLABEL, to get a separator bar.
  152.  *)
  153.   barLabel  * = sys.VAL(e.STRPTR,-1);
  154.  
  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.   menuDisabled * = I.menuEnabled;
  163.   itemDisabled * = I.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.   commandString * = I.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.   flagMask    * = -({I.commSeq,I.itemText}+I.highFlags);
  177.   flagMaskV39 * = -({I.itemText}+I.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. (*  These return codes can be obtained through the GTMN_ErrorCode tag *)
  189.   gtMenuTrimmed   * = 000000001H;      (* Too many menus, items, or subitems,
  190.                                         * menu has been trimmed down
  191.                                         *)
  192.   gtMenuInvalide  * = 000000002H;      (* Invalid NewMenu array *)
  193.   gtMenuNoMem     * = 000000003H;      (* Out of memory *)
  194.  
  195. (*------------------------------------------------------------------------*)
  196.  
  197. (* Starting with V39, checkboxes and mx gadgets can be scaled to your
  198.  * specified gadget width/height.  Use the new GTCB_Scaled or GTMX_Scaled
  199.  * tags, respectively.        Under V37, and by default in V39, the imagery
  200.  * is of the following fixed size:
  201.  *)
  202.  
  203. (* MX gadget default dimensions: *)
  204.   mxWidth        * = 17;
  205.   mxHeight       * =  9;
  206.  
  207. (* Checkbox default dimensions: *)
  208.   checkboxWidth  * = 26;
  209.   checkboxHeight * = 11;
  210.  
  211.  
  212. (*------------------------------------------------------------------------*)
  213.  
  214. (*  Tags for toolkit functions: *)
  215.  
  216.   tagBase           * = u.user + 80000H;
  217.  
  218.   viNewWindow       * = tagBase+1;   (* Unused *)
  219.   viNWTags          * = tagBase+2;   (* Unused *)
  220.  
  221.   Private0          * = tagBase+3;   (* (private) *)
  222.  
  223.   cbChecked         * = tagBase+4;   (* State of checkbox *)
  224.  
  225.   lvTop             * = tagBase+5;   (* Top visible one in listview *)
  226.   lvLabels          * = tagBase+6;   (* List to display in listview *)
  227.   lvReadOnly        * = tagBase+7;   (* TRUE if listview is to be
  228.                                       * read-only
  229.                                       *)
  230.   lvScrollWidth     * = tagBase+8;   (* Width of scrollbar *)
  231.  
  232.   mxLabels          * = tagBase+9;   (* NULL-terminated array of labels *)
  233.   mxActive          * = tagBase+10;  (* Active one in mx gadget *)
  234.  
  235.   txText            * = tagBase+11;  (* Text to display *)
  236.   txCopyText        * = tagBase+12;  (* Copy text label instead of referencing it *)
  237.  
  238.   nmNumber          * = tagBase+13;  (* Number to display *)
  239.  
  240.   cyLabels          * = tagBase+14;  (* NULL-terminated array of labels *)
  241.   cyActive          * = tagBase+15;  (* The active one in the cycle gad *)
  242.  
  243.   paDepth           * = tagBase+16;  (* Number of bitplanes in palette *)
  244.   paColor           * = tagBase+17;  (* Palette color *)
  245.   paColorOffset     * = tagBase+18;  (* First color to use in palette *)
  246.   paIndicatorWidth  * = tagBase+19;  (* Width of current-color indicator *)
  247.   paIndicatorHeight * = tagBase+20;  (* Height of current-color indicator *)
  248.  
  249.   scTop             * = tagBase+21;  (* Top visible in scroller *)
  250.   scTotal           * = tagBase+22;  (* Total in scroller area *)
  251.   scVisible         * = tagBase+23;  (* Number visible in scroller *)
  252.   scOverlap         * = tagBase+24;  (* Unused *)
  253.  
  254. (*  tagBase+25 through tagBase+37 are reserved *)
  255.  
  256.   slMin             * = tagBase+38;  (* Slider min value *)
  257.   slMax             * = tagBase+39;  (* Slider max value *)
  258.   slLevel           * = tagBase+40;  (* Slider level *)
  259.   slMaxLevelLen     * = tagBase+41;  (* Max length of printed level *)
  260.   slLevelFormat     * = tagBase+42;  (* Format string for level *)
  261.   slLevelPlace      * = tagBase+43;  (* Where level should be placed *)
  262.   slDispFunc        * = tagBase+44;  (* Callback for number calculation
  263.                                       * before display
  264.                                       *)
  265.   stString          * = tagBase+45;  (* String gadget's displayed string *)
  266.   stMaxChars        * = tagBase+46;  (* Max length of string *)
  267.  
  268.   inNumber          * = tagBase+47;  (* Number in integer gadget *)
  269.   inMaxChars        * = tagBase+48;  (* Max number of digits *)
  270.  
  271.   mnTextAttr        * = tagBase+49;  (* MenuItem font TextAttr *)
  272.   mnFrontPen        * = tagBase+50;  (* MenuItem text pen color *)
  273.  
  274.   bbRecessed        * = tagBase+51;  (* Make BevelBox recessed *)
  275.  
  276.   visualInfo        * = tagBase+52;  (* result of VisualInfo call *)
  277.  
  278.   lvShowSelected    * = tagBase+53;  (* show selected entry beneath
  279.          * listview, set tag data = NULL for display-only, or pointer
  280.          * to a string gadget you've created
  281.          *)
  282.   lvSelected        * = tagBase+54;  (* Set ordinal number of selected
  283.                                       * entry in the list
  284.                                       *)
  285.   Reserved1         * = tagBase+56;  (* Reserved for future use *)
  286.  
  287.   txBorder          * = tagBase+57;  (* Put a border around
  288.                                       * Text-display gadgets
  289.                                       *)
  290.   nmBorder          * = tagBase+58;  (* Put a border around
  291.                                       * Number-display gadgets
  292.                                       *)
  293.   scArrows          * = tagBase+59;  (* Specify size of arrows for
  294.                                       * scroller
  295.                                       *)
  296.   mnMenu            * = tagBase+60;  (* Pointer to Menu for use by
  297.                                       * LayoutMenuItems()
  298.                                       *)
  299.   mxSpacing         * = tagBase+61;  (* Added to font height to
  300.          * figure spacing between mx choices.  Use this instead
  301.          * of LAYOUTA_SPACING for mx gadgets.
  302.          *)
  303.  
  304. (* New to V37 GadTools.  Ignored by GadTools V36 *)
  305.   fullMenu          * = tagBase+62;  (* Asks CreateMenus() to validate that this
  306.                                       * is a complete menu structure
  307.                                       *)
  308.   secondaryError    * = tagBase+63;  (* ti_Data is a pointer to a ULONG to receive
  309.                                       * error reports from CreateMenus()
  310.                                       *)
  311.   underscore        * = tagBase+64;  (* ti_Data points to the symbol that preceeds
  312.                                       * the character you'd like to underline in a
  313.                                       * gadget label
  314.                                       *)
  315.  
  316.   stEditHook        * = tagBase+55; (* String EditHook *)
  317.   inEditHook        * = stEditHook; (* Same thing, different name, just to
  318.                                      * round out INTEGER_KIND gadgets
  319.                                      *)
  320.  
  321. (* New to V39 GadTools.  Ignored by GadTools V36 and V37 *)
  322.   mnCheckMark       * = tagBase+65; (* ti_Data is checkmark img to use *)
  323.   mnAmigaKey        * = tagBase+66; (* ti_Data is Amiga-key img to use *)
  324.   mnNewLookMenus    * = tagBase+67; (* ti_Data is boolean *)
  325.  
  326. (* New to V39 GadTools.  Ignored by GadTools V36 and V37.
  327.  * Set to TRUE if you want the checkbox or mx image scaled to
  328.  * the gadget width/height you specify.  Defaults to FALSE,
  329.  * for compatibility.
  330.  *)
  331.   cbScaled          * = tagBase+68; (* ti_Data is boolean *)
  332.   mxScaled          * = tagBase+69; (* ti_Data is boolean *)
  333.  
  334.   paNumColors       * = tagBase+70; (* Number of colors in palette *)
  335.  
  336.   mxTitlePlace      * = tagBase+71; (* Where to put the title *)
  337.  
  338.   txFrontPen        * = tagBase+72; (* Text color in TEXT_KIND gad *)
  339.   txBackPen         * = tagBase+73; (* Bgrnd color in TEXT_KIND gad *)
  340.   txJustification   * = tagBase+74; (* See GTJ_#? constants *)
  341.  
  342.   nmFrontPen        * = tagBase+72; (* Text color in NUMBER_KIND gad *)
  343.   nmBackPen         * = tagBase+73; (* Bgrnd color in NUMBER_KIND gad *)
  344.   nmJustification   * = tagBase+74; (* See GTJ_#? constants *)
  345.   nmFormat          * = tagBase+75; (* Formatting string for number *)
  346.   nmMaxNumberLen    * = tagBase+76; (* Maximum length of number *)
  347.  
  348.   bbFrameType       * = tagBase+77; (* defines what kind of boxes
  349.                                      * DrawBevelBox() renders. See
  350.                                      * the BBFT_#? constants for
  351.                                      * possible values
  352.                                      *)
  353.  
  354.   lvMakeVisible     * = tagBase+78; (* Make this item visible *)
  355.   lvItemHeight      * = tagBase+79; (* Height of an individual item *)
  356.  
  357.   slMaxPixelLen     * = tagBase+80; (* Max pixel size of level display *)
  358.   slJustification   * = tagBase+81; (* how should the level be displayed *)
  359.  
  360.   paColorTable      * = tagBase+82; (* colors to use in palette *)
  361.  
  362.   lvCallBack        * = tagBase+83; (* general-purpose listview call back *)
  363.   lvMaxPen          * = tagBase+84; (* maximum pen number used by call back *)
  364.  
  365.   txClipped         * = tagBase+85; (* make a TEXT_KIND clip text *)
  366.   nmClipped         * = tagBase+85; (* make a NUMBER_KIND clip text *)
  367.  
  368. (* Old definition, now obsolete: *)
  369.   Reserved0         * = stEditHook;
  370.  
  371. (*------------------------------------------------------------------------*)
  372.  
  373. (* Justification types for GTTX_Justification and GTNM_Justification tags *)
  374.   jLeft   * = 0;
  375.   jRight  * = 1;
  376.   jCenter * = 2;
  377.  
  378. (*------------------------------------------------------------------------*)
  379.  
  380. (* Bevel box frame types for GTBB_FrameType tag *)
  381.   bbftButton      * = 1;  (* Standard button gadget box *)
  382.   bbftRidge       * = 2;  (* Standard string gadget box *)
  383.   bbftIconDropBox * = 3;  (* Standard icon drop box     *)
  384.  
  385. (*------------------------------------------------------------------------*)
  386.  
  387. (* Typical suggested spacing between "elements": *)
  388.   interWidth  * = 8;
  389.   interHeight * = 4;
  390.  
  391. (*------------------------------------------------------------------------*)
  392.  
  393. (*  "nWay" is an old synonym for cycle gadgets *)
  394.   nWAYKind     * = cycleKind;
  395.   nWAYIDCMP    * = cycleIDCMP;
  396.   nwLabels     * = cyLabels;
  397.   nwActive     * = cyActive;
  398.  
  399. (*------------------------------------------------------------------------*)
  400.  
  401. (* These two definitions are obsolete, but are here for backwards
  402.  * compatibility.  You never need to worry about these:
  403.  *)
  404.   gadToolBit  * = 08000H;
  405.  
  406. (*------------------------------------------------------------------------*)
  407.  
  408. (* These definitions are for the GTLV_CallBack tag *)
  409.  
  410. (* The different types of messages that a listview callback hook can see *)
  411.   lvDraw      * =  0202H;  (* draw yourself, with state *)
  412.  
  413. (* Possible return values from a callback hook *)
  414.   lvcbOk      * =  0;     (* callback understands this message type    *)
  415.   lvcbUnknown * =  1;     (* callback does not understand this message *)
  416.  
  417. (* states for LVDrawMsg.lvdm_State *)
  418.   lvrNormal           * = 0; (* the usual                 *)
  419.   lvrSelected         * = 1; (* for selected gadgets      *)
  420.   lvrNormalDisabled   * = 2; (* for disabled gadgets      *)
  421.   lvrSelectedDisabled * = 8; (* disabled and selected     *)
  422.  
  423. TYPE
  424. (* structure of LV_DRAW messages, object is a (struct Node * ) *)
  425.   LVDrawMsg * = STRUCT (msg: I.Msg)
  426.     rastPort * : g.RastPortPtr;   (* where to render to        *)
  427.     drawInfo * : I.DrawInfoPtr;   (* useful to have around     *)
  428.     bounds   * : g.Rectangle;     (* limits of where to render *)
  429.     state    * : LONGINT;         (* how to render             *)
  430.   END;
  431.  
  432. VAR
  433.   base * : e.LibraryPtr;
  434.  
  435. (*--- functions in V36 or higher (distributed as Release 2.0) ---*)
  436. (*
  437.  * Gadget Functions
  438.  *)
  439. PROCEDURE CreateGadgetA   *{base,- 30}(kind{0}        : LONGINT;
  440.                                        gad{8}         : I.GadgetPtr;
  441.                                        VAR ng{9}      : NewGadget;
  442.                                        taglist{10}    : ARRAY OF u.TagItem): I.GadgetPtr;
  443. PROCEDURE CreateGadget    *{base,- 30}(kind{0}        : LONGINT;
  444.                                        gad{8}         : I.GadgetPtr;
  445.                                        VAR ng{9}      : NewGadget;
  446.                                        tag1{10}..     : u.Tag): I.GadgetPtr;
  447. PROCEDURE FreeGadgets     *{base,- 36}(gad{8}         : I.GadgetPtr);
  448. PROCEDURE SetGadgetAttrsA *{base,- 42}(VAR gad{8}     : I.Gadget;
  449.                                        win{9}         : I.WindowPtr;
  450.                                        req{10}        : I.RequesterPtr;
  451.                                        taglist{11}    : ARRAY OF u.TagItem);
  452. PROCEDURE SetGadgetAttrs  *{base,- 42}(VAR gad{8}     : I.Gadget;
  453.                                        win{9}         : I.WindowPtr;
  454.                                        req{10}        : I.RequesterPtr;
  455.                                        tag1{11}..     : u.Tag);
  456. (*
  457.  * Menu functions
  458.  *)
  459. PROCEDURE CreateMenusA    *{base,- 48}(newmenu{8}     : ARRAY OF NewMenu;
  460.                                        taglist{9}     : ARRAY OF u.TagItem): I.MenuPtr;
  461. PROCEDURE CreateMenus     *{base,- 48}(newmenu{8}     : ARRAY OF NewMenu;
  462.                                        tag1{9}..      : u.Tag): I.MenuPtr;
  463. PROCEDURE CreateMenusAB   *{base,- 48}(newmenu{8}     : NewMenuPtr;
  464.                                        taglist{9}     : ARRAY OF u.TagItem): I.MenuPtr;
  465. PROCEDURE CreateMenusB    *{base,- 48}(newmenu{8}     : NewMenuPtr;
  466.                                        tag1{9}..      : u.Tag): I.MenuPtr;
  467. PROCEDURE FreeMenus       *{base,- 54}(menu{8}        : I.MenuPtr);
  468. PROCEDURE LayoutMenuItemsA*{base,- 60}(firstitem{8}   : I.MenuItemPtr;
  469.                                        vi{9}          : VisualInfo;
  470.                                        tagList{10}    : ARRAY OF u.TagItem): BOOLEAN;
  471. PROCEDURE LayoutMenuItems *{base,- 60}(firstitem{8}   : I.MenuItemPtr;
  472.                                        vi{9}          : VisualInfo;
  473.                                        tag1{10}..     : u.Tag): BOOLEAN;
  474. PROCEDURE LayoutMenusA    *{base,- 66}(firstmenu{8}   : I.MenuPtr;
  475.                                        vi{9}          : VisualInfo;
  476.                                        taglist{10}    : ARRAY OF u.TagItem): BOOLEAN;
  477. PROCEDURE LayoutMenus     *{base,- 66}(firstmenu{8}   : I.MenuPtr;
  478.                                        vi{9}          : VisualInfo;
  479.                                        tag1{10}..     : u.Tag): BOOLEAN;
  480. (*
  481.  * Misc Event-Handling Functions
  482.  *)
  483. PROCEDURE GetIMsg         *{base,- 72}(iport{8}       : e.MsgPortPtr): I.IntuiMessagePtr;
  484. PROCEDURE ReplyIMsg       *{base,- 78}(imsg{9}        : I.IntuiMessagePtr);
  485. PROCEDURE RefreshWindow   *{base,- 84}(win{8}         : I.WindowPtr;
  486.                                        req{9}         : I.RequesterPtr);
  487. PROCEDURE BeginRefresh    *{base,- 90}(win{8}         : I.WindowPtr);
  488. PROCEDURE EndRefresh      *{base,- 96}(win{8}         : I.WindowPtr;
  489.                                        complete{0}    : I.LONGBOOL);
  490. PROCEDURE FilterIMsg      *{base,-102}(imsg{9}        : I.IntuiMessagePtr): I.IntuiMessagePtr;
  491. PROCEDURE PostFilterIMsg  *{base,-108}(imsg{9}        : I.IntuiMessagePtr): I.IntuiMessagePtr;
  492. PROCEDURE CreateContext   *{base,-114}(VAR glist{8}   : I.GadgetPtr): I.GadgetPtr;
  493. (*
  494.  * Rendering Functions
  495.  *)
  496. PROCEDURE DrawBevelBoxA   *{base,-120}(rport{8}       : g.RastPortPtr;
  497.                                        left{0}        : LONGINT;
  498.                                        top{1}         : LONGINT;
  499.                                        width{2}       : LONGINT;
  500.                                        height{3}      : LONGINT;
  501.                                        taglist{9}     : ARRAY OF u.TagItem);
  502. PROCEDURE DrawBevelBox    *{base,-120}(rport{8}       : g.RastPortPtr;
  503.                                        left{0}        : LONGINT;
  504.                                        top{1}         : LONGINT;
  505.                                        width{2}       : LONGINT;
  506.                                        height{3}      : LONGINT;
  507.                                        tag1{9}..      : u.Tag);
  508. (*
  509.  * Visuals Functions
  510.  *)
  511. PROCEDURE GetVisualInfoA  *{base,-126}(screen{8}      : I.ScreenPtr;
  512.                                        taglist{9}     : ARRAY OF u.TagItem): VisualInfo;
  513. PROCEDURE GetVisualInfo   *{base,-126}(screen{8}      : I.ScreenPtr;
  514.                                        tag1{9}..      : u.Tag): VisualInfo;
  515. PROCEDURE FreeVisualInfo  *{base,-132}(vi{8}          : VisualInfo);
  516.  
  517. (*--- functions in V39 or higher (beta release for developers only) ---*)
  518.  
  519. PROCEDURE GetGadgetAttrsA *{base,-0AEH}(gad{8}        : I.GadgetPtr;
  520.                                         win{9}        : I.WindowPtr;
  521.                                         req{10}       : I.RequesterPtr;
  522.                                         taglist{11}   : ARRAY OF u.TagItem): LONGINT;
  523. PROCEDURE GetGadgetAttrs  *{base,-0AEH}(gad{8}        : I.GadgetPtr;
  524.                                         win{9}        : I.WindowPtr;
  525.                                         req{10}       : I.RequesterPtr;
  526.                                         tag1{11}..    : u.Tag ): LONGINT;
  527.  
  528. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  529.  
  530. (* A UserData pointer can be associated with each Menu and MenuItem structure.
  531.  * The CreateMenus() call allocates space for a UserData after each
  532.  * Menu or MenuItem (header, item or sub-item).  You should use the
  533.  * GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
  534.  *)
  535.  
  536. PROCEDURE MenuUserData * (menu: I.MenuPtr): e.APTR;
  537. TYPE
  538.   UserMenu = STRUCT (menu: I.Menu) userData: e.APTR; END;
  539. BEGIN
  540.   RETURN menu(UserMenu).userData;
  541. END MenuUserData;
  542.  
  543.  
  544. PROCEDURE MenuItemUserData * (menuitem: I.MenuItemPtr): e.APTR;
  545. TYPE
  546.   UserItem = STRUCT (menu: I.MenuItem) userData: e.APTR; END;
  547. BEGIN
  548.   RETURN menuitem(UserItem).userData;
  549. END MenuItemUserData;
  550.  
  551.  
  552. BEGIN
  553.   base := e.OpenLibrary(gadtoolsName,37);
  554.  
  555. CLOSE
  556.   IF base#NIL THEN e.CloseLibrary(base) END;
  557.  
  558. END GadTools.
  559.  
  560.