home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / m2 / CycloneModules.lha / modules / txt / GadToolsD.def < prev    next >
Text File  |  1996-07-29  |  17KB  |  392 lines

  1. (**************************************************************************)
  2. (*                                                                        *)
  3. (* Definition Module GadtoolsD by Marcel Timmermans.                      *)
  4. (* Date     : 21 Feb 1994                                                 *)
  5. (* Language : Modula-2                                                    *)
  6. (*                                                                        *)
  7. (**************************************************************************)
  8.  
  9. (*$ Implementation- *)
  10. DEFINITION MODULE GadToolsD;
  11.  
  12. FROM SYSTEM IMPORT ADDRESS,BITSET,LONGSET,CAST;
  13.  
  14. IMPORT gd:GraphicsD,id:IntuitionD;
  15. FROM UtilityD  IMPORT tagUser;
  16.  
  17. TYPE
  18.  StrPtr=ADDRESS;
  19.  
  20. CONST
  21.  
  22. (* The kinds (almost classes) of gadgets that GadTools supports.
  23.  * Use these identifiers when calling CreateGadgetA()
  24.  *)
  25.  
  26.   genericKind    = 0;
  27.   buttonKind     = 1;
  28.   checkboxKind   = 2;
  29.   integerKind    = 3;
  30.   listviewKind   = 4;
  31.   mxKind         = 5;
  32.   numberKind     = 6;
  33.   cycleKind      = 7;
  34.   paletteKind    = 8;
  35.   scrollerKind   = 9;
  36. (* Kind number 10 is reserved *)
  37.   sliderKind     = 11;
  38.   stringKind     = 12;
  39.   textKind       = 13;
  40.  
  41.   numKinds       = 14;
  42.  
  43. (*------------------------------------------------------------------------*)
  44.  
  45. (*  'Or' the appropriate set together for your Window IDCMPFlags: *)
  46.  
  47.   arrowIDCMP      = id.IDCMPFlagSet{id.gadgetUp,id.gadgetDown,id.intuiTicks,id.mouseButtons};
  48.  
  49.   buttonIDCMP     = id.IDCMPFlagSet{id.gadgetUp};
  50.   checkboxIDCMP   = id.IDCMPFlagSet{id.gadgetUp};
  51.   integerIDCMP    = id.IDCMPFlagSet{id.gadgetUp};
  52.   listviewIDCMP   = id.IDCMPFlagSet{id.gadgetUp,id.gadgetDown,id.mouseMove}+arrowIDCMP;
  53.  
  54.   mxIDCMP         = id.IDCMPFlagSet{id.gadgetDown};
  55.   numberIDCMP     = id.IDCMPFlagSet{};
  56.   cycleIDCMP      = id.IDCMPFlagSet{id.gadgetUp};
  57.   paletteIDCMP    = id.IDCMPFlagSet{id.gadgetUp};
  58.  
  59.   scrollerIDCMP   = id.IDCMPFlagSet{id.gadgetUp,id.gadgetDown,id.mouseMove};
  60.   sliderIDCMP     = id.IDCMPFlagSet{id.gadgetUp,id.gadgetDown,id.mouseMove};
  61.   stringIDCMP     = id.IDCMPFlagSet{id.gadgetUp};
  62.  
  63.   textIDCMP       = id.IDCMPFlagSet{};
  64.  
  65.  
  66. TYPE
  67. (* NewGadsget.flags control certain aspects of the gadget.  The first five
  68.  * the placement of the descriptive text.  Each gadget kind has its default,
  69.  * which is usually PLACETEXT_LEFT.  Consult the autodocs for details.
  70.  *)
  71. NewGadgetFlags=(
  72.   placetextLeft,      (* Right-align text on left side *)
  73.   placetextRight,     (* Left-align text on right side *)
  74.   placetextAbove,     (* Center text above *)
  75.   placetextBelow,     (* Center text below *)
  76.   placetextIn,        (* Center text on *)                
  77.   ngHighlabel,        (* Highlight the label *)
  78.   
  79.   ng6,ng7,ng8,ng9,ng10,ng11,ng12,ng13,ng14,ng15,
  80.   ng16,ng17,ng18,ng19,ng20,ng21,ng22,ng23,
  81.   ng24,ng25,ng26,ng27,ng28,ng29,ng30,ng31
  82.  );
  83.  NewGadgetFlagSet=SET OF NewGadgetFlags;
  84.   
  85. (*  Generic NewGadget used by several of the gadget classes: *)
  86.  
  87.  NewGadget=RECORD
  88.   leftEdge,topEdge:INTEGER;     (*  gadget position *)  
  89.   width,height:INTEGER;         (*  gadget size *)
  90.   gadgetText:ADDRESS;           (*  gadget label *)
  91.   textAttr:gd.TextAttrPtr;      (*  desired font for gadget label *)
  92.   gadgetID:CARDINAL;            (*  gadget ID *)
  93.   flags:NewGadgetFlagSet;       (*  see above *)
  94.   visualInfo:ADDRESS;           (*  Set to retval of GetVisualInfo() *)
  95.   userData:ADDRESS;             (*  gadget UserData *)                  
  96.  END;
  97.  NewGadgetPtr=POINTER TO NewGadget;
  98.  
  99. (* Fill out an array of these and pass that to CreateMenus(): *)
  100.  
  101.  NewMenu=RECORD
  102.   type:SHORTCARD;         (*  See below *)
  103.   label:StrPtr;           (*  Menu's label *)
  104.   commKey:StrPtr;         (*  MenuItem Command Key Equiv *)
  105.   flags:BITSET;           (*  Menu or MenuItem flags (see note) *)
  106.   mutualExclude:LONGSET;  (*  MenuItem MutualExclude word *)
  107.   userData:ADDRESS;       (*  For your own use, see note *)       
  108.  END;
  109.  NewMenuPtr=POINTER TO NewMenu;
  110.  
  111. CONST
  112. (* Needed only by inside IM_ definitions below *)
  113.   menuImage = -128;
  114.  
  115. (* nm_Type determines what each NewMenu structure corresponds to.
  116.  * for the NM_TITLE, NM_ITEM, and NM_SUB values, nm_Label should
  117.  * be a text string to use for that menu title, item, or sub-item.
  118.  * For IM_ITEM or IM_SUB, set nm_Label to point at the Image structure
  119.  * you wish to use for this item or sub-item.
  120.  * NOTE: At present, you may only use conventional images.
  121.  * Custom images created from Intuition image-classes do not work.
  122.  *)
  123.   nmTitle   = 1;          (* Menu header *)
  124.   nmItem    = 2;          (* Textual menu item *)
  125.   nmSub     = 3;          (* Textual menu sub-item *)
  126.  
  127.   imItem    = nmItem + menuImage;  (* Graphical menu item *)
  128.   imSub     = nmSub  + menuImage;  (* Graphical menu sub-item *)
  129.  
  130. (* The NewMenu array should be terminated with a NewMenu whose
  131.  * nm_Type equals NM_END.
  132.  *)
  133.   nmEnd       = 0;          (* End of NewMenu array *)
  134.  
  135. (* Starting with V39, GadTools will skip any NewMenu entries whose
  136.  * nm_Type field has the NM_IGNORE bit set.
  137.  *)
  138.   nmIgnore  = 64;
  139.  
  140. (* nm_Label should be a text string for textual items, a pointer
  141.  * to an Image structure for graphical menu items, or the special
  142.  * constant NM_BARLABEL, to get a separator bar.
  143.  *)
  144.   nmBarlabel  = CAST(StrPtr,-1);
  145.  
  146.  
  147. (* The nm_Flags field is used to fill out either the Menu->Flags or
  148.  * MenuItem->Flags field.  Note that the sense of the MENUENABLED or
  149.  * ITEMENABLED bit is inverted between this use and Intuition's use,
  150.  * in other words, NewMenus are enabled by default.  The following
  151.  * labels are provided to disable them:
  152.  *)
  153.  
  154.  menuDisabled=id.menuEnabled;
  155.  itemDisabled=id.itemEnabled;
  156.  
  157. (* New for V39:  NM_COMMANDSTRING.  For a textual MenuItem or SubItem,
  158.  * point nm_CommKey at an arbitrary string, and set the NM_COMMANDSTRING
  159.  * flag.
  160.  *)
  161.  commandString=id.commSeq;
  162.  
  163. (* The following are pre-cleared (COMMSEQ, ITEMTEXT, and HIGHxxx are set
  164.  * later as appropriate):
  165.  * Under V39, the COMMSEQ flag bit is not cleared, since it now has
  166.  * meaning.
  167.  *)
  168.  
  169.   flagMask    = -(id.MenuItemFlagSet{id.commSeq,id.itemText}+id.highFlags);
  170.   flagMaskV39 = -(id.MenuItemFlagSet{id.itemText}+id.highFlags);
  171.  
  172. (* You may choose among CHECKIT, MENUTOGGLE, and CHECKED.
  173.  * Toggle-select menuitems are of type CHECKIT|MENUTOGGLE, along
  174.  * with CHECKED if currently selected.        Mutually exclusive ones
  175.  * are of type CHECKIT, and possibly CHECKED too.  The nm_MutualExclude
  176.  * is a bit-wise representation of the items excluded by this one,
  177.  * so in the simplest case (choose 1 among n), these flags would be
  178.  * ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter.
  179.  *)
  180.  
  181. (*  These return codes can be obtained through the GTMN_ErrorCode tag *)
  182.  
  183.   gtMenuTrimmed   = 1;      (* Too many menus, items, or subitems,
  184.                              * menu has been trimmed down
  185.                              *)
  186.   gtMenuInvalide  = 2;      (* Invalid NewMenu array *)
  187.   gtMenuNoMem     = 3;      (* Out of memory *)
  188.  
  189. (*------------------------------------------------------------------------*)
  190.  
  191. (* Starting with V39, checkboxes and mx gadgets can be scaled to your
  192.  * specified gadget width/height.  Use the new GTCB_Scaled or GTMX_Scaled
  193.  * tags, respectively. Under V37, and by default in V39, the imagery
  194.  * is of the following fixed size:
  195.  *)
  196.  
  197. (* MX gadget default dimensions: *)
  198.   mxWidth        = 17;
  199.   mxHeight       =  9;
  200.  
  201. (* Checkbox default dimensions: *)
  202.   checkboxWidth  = 26;
  203.   checkboxHeight = 11;
  204.  
  205. TYPE
  206. (*  Tags for toolkit functions: *)
  207.  
  208.  GtTags=(gtTagBase:=tagUser+080000H,
  209.   gtviNewWindow,                    (* Unused *)
  210.   gtviNWTags,                       (* Unused *)
  211.   gtPrivate0,                       (* (private) *)
  212.   gtcbChecked,                      (* State of checkbox *)
  213.   gtlvTop,                          (* Top visible one in listview *)
  214.   gtlvLabels,                       (* List to display in listview *)
  215.   gtlvReadOnly,                     (* TRUE if listview is to be 
  216.                                      * read-only
  217.                                      *)    
  218.   gtlvScrollWidth,                  (* Width of scrollbar *)
  219.   gtmxLabels,                       (* NULL-terminated array of labels *)
  220.   gtmxActive,                       (* Active one in mx gadget *)        
  221.   gttxText,                         (* Text to display *)
  222.   gttxCopyText,                     (* Copy text label instead of referencing it *)
  223.   gtnmNumber,                       (* Number to display *)
  224.   gtcyLabels,                       (* NULL-terminated array of labels *)
  225.   gtcyActive,                       (* The active one in the cycle gad *)
  226.   gtpaDepth,                        (* Number of bitplanes in palette *)
  227.   gtpaColor,                        (* Palette color *)
  228.   gtpaColorOffset,                  (* First color to use in palette *)
  229.   gtpaIndicatorWidth,               (* Width of current-color indicator *)
  230.   gtpaIndicatorHeight,              (* Height of current-color indicator *)
  231.   gtscTop,                          (* Top visible in scroller *)
  232.   gtscTotal,                        (* Total in scroller area *)
  233.   gtscVisible,                      (* Number visible in scroller *)
  234.   gtscOverlap,                      (* Unused *)                 
  235.   gtres25,gtres26,gtres27,gtres28,gtres29,gtres30,
  236.   gtres31,gtres32,gtres33,gtres34,gtres35,gtres36,gtres37,
  237.   gtslMin,                          (* Slider min value *)
  238.   gtslMax,                          (* Slider max value *)
  239.   gtslLevel,                        (* Slider level *)
  240.   gtslMaxLevelLen,                  (* Max length of printed level *)
  241.   gtslLevelFormat,                  (* Format string for level *)
  242.   gtslLevelPlace,                   (* Where level should be placed *)
  243.   gtslDispFunc,                     (* Callback for number calculation
  244.                                      * before display
  245.                                      *)
  246.   gtstString,                       (* String gadget's displayed string *)
  247.   gtstMaxChars,                     (* Max length of string *)            
  248.   gtinNumber,                       (* Number in integer gadget *)
  249.   gtinMaxChars,                     (* Max number of digits *)     
  250.   gtmnTextAttr,                     (* MenuItem font TextAttr *)
  251.   gtmnFrontPen,                     (* MenuItem text pen color *)
  252.   gtbbRecessed,                     (* Make BevelBox recessed *)
  253.   gtVisualInfo,                     (* result of VisualInfo call *)
  254.   gtlvShowSelected,                 (* show selected entry beneath
  255.          * listview, set tag data = NULL for display-only, or pointer
  256.          * to a string gadget you've created
  257.          *)
  258.   gtlvSelected,                     (* Set ordinal number of selected
  259.                                      * entry in the list
  260.                                      *)
  261.   gtstEditHook,                     (* String EditHook *)
  262.   gtReserved1,                      
  263.   gttxBorder,                       (* Put a border around
  264.                                      * Text-display gadgets
  265.                                      *)
  266.   gtnmBorder,                       (* Put a border around
  267.                                      * Number-display gadgets
  268.                                      *)
  269.   gtscArrows,                       (* Specify size of arrows for
  270.                                      * scroller
  271.                                      *)
  272.   gtmnMenu,                         (* Pointer to Menu for use by
  273.                                      * LayoutMenuItems()
  274.                                      *)
  275.   gtmxSpacing,                      (* Added to font height to
  276.          * figure spacing between mx choices.  Use this instead
  277.          * of LAYOUTA_SPACING for mx gadgets.
  278.          *)
  279.  
  280. (* New to V37 GadTools.  Ignored by GadTools V36 *)
  281.   gtmnFullMenu,            (* Asks CreateMenus() to validate that this
  282.                            * is a complete menu structure
  283.                            *)
  284.  
  285.   gtmnSecondaryError,      (* ti_Data is a pointer to a ULONG to receive
  286.                             * error reports from CreateMenus()
  287.                             *)
  288.   gtUnderscore,            (* ti_Data points to the symbol that preceeds
  289.                             * the character you'd like to underline in a
  290.                             * gadget label
  291.                             *)
  292. (* New to V39 GadTools.  Ignored by GadTools V36 and V37 *)
  293.   gtmnCheckmark,                    (* ti_Data is checkmark img to use *)
  294.   gtmnAmigaKey,                     (* ti_Data is Amiga-key img to use *)
  295.   gtmnNewLookMenus,                 (* ti_Data is boolean *)              
  296.  
  297. (* New to V39 GadTools.  Ignored by GadTools V36 and V37.
  298.  * Set to TRUE if you want the checkbox or mx image scaled to
  299.  * the gadget width/height you specify.  Defaults to FALSE,
  300.  * for compatibility.
  301.  *)
  302.  
  303.   gtcbScaled,                       (* ti_Data is boolean *)
  304.   gtmxScaled,                       (* ti_Data is boolean *)
  305.   gtpaNumColors,                    (* Number of colors in palette *)
  306.   gtmxTitlePlace,                   (* Where to put the title *)
  307.   gttxFrontPen,                     (* Text color in TEXT_KIND gad *)
  308.   gttxBackPen,                      (* Bgrnd color in TEXT_KIND gad *)
  309.   gttxJustification,                (* See GTJ_#? constants *)        
  310.   gtnmFormat,                       (* Formatting string for number *)
  311.   gtnmMaxNumberLen,                 (* Maximum length of number *)    
  312.   gtbbFrameType,                    (* defines what kind of boxes
  313.                                      * DrawBevelBox() renders. See
  314.                                      * the BBFT_#? constants for
  315.                                      * possible values
  316.                                      *)
  317.   gtlvMakeVisible,                  (* Make this item visible *)
  318.   gtlvItemHeight,                   (* Height of an individual item *)
  319.   gtslMaxPixelLen,                  (* Max pixel size of level display *)
  320.   gtslJustification,                (* how should the level be displayed *)
  321.   gtpaColorTable,                   (* colors to use in palette *)
  322.   gtlvCallBack,                     (* general-purpose listview call back *)
  323.   gtlvMaxPen,                       (* maximum pen number used by call back *)
  324.   gttxClipped                       (* make a TEXT/NUMBER_KIND clip text *)
  325.   (* Until tagBase + 85 *)
  326.  );
  327.  
  328. CONST
  329. (* Justification types for GTTX_Justification and GTNM_Justification tags *)
  330.   jLeft   = 0;
  331.   jRight  = 1;
  332.   jCenter = 2;
  333.  
  334. (*------------------------------------------------------------------------*)
  335.  
  336. (* Bevel box frame types for GTBB_FrameType tag *)
  337.   bbftButton      = 1;  (* Standard button gadget box *)
  338.   bbftRidge       = 2;  (* Standard string gadget box *)
  339.   bbftIconDropBox = 3;  (* Standard icon drop box     *)
  340.  
  341. (*------------------------------------------------------------------------*)
  342.  
  343. (* Typical suggested spacing between "elements": *)
  344.   interWidth  = 8;
  345.   interHeight = 4;
  346.  
  347. (*------------------------------------------------------------------------*)
  348.  
  349. (*  "nWay" is an old synonym for cycle gadgets *)
  350.   nWAYKind     = cycleKind;
  351.   nWAYIDCMP    = cycleIDCMP;
  352.   nwLabels     = gtcyLabels;
  353.   nwActive     = gtcyActive;
  354.  
  355. (*------------------------------------------------------------------------*)
  356.  
  357. (* These two definitions are obsolete, but are here for backwards
  358.  * compatibility.  You never need to worry about these:
  359.  *)
  360.   gadToolBit  = 08000H;
  361.  
  362. (*------------------------------------------------------------------------*)
  363.  
  364. (* These definitions are for the GTLV_CallBack tag *)
  365.  
  366. (* The different types of messages that a listview callback hook can see *)
  367.   lvDraw      =  0202H;  (* draw yourself, with state *)
  368.  
  369. (* Possible return values from a callback hook *)
  370.   lvcbOk      =  0;     (* callback understands this message type    *)
  371.   lvcbUnknown =  1;     (* callback does not understand this message *)
  372.  
  373. (* states for LVDrawMsg.lvdm_State *)
  374.   lvrNormal           = 0; (* the usual                 *)
  375.   lvrSelected         = 1; (* for selected gadgets      *)
  376.   lvrNormalDisabled   = 2; (* for disabled gadgets      *)
  377.   lvrSelectedDisabled = 8; (* disabled and selected     *)
  378.  
  379. TYPE
  380. (* structure of LV_DRAW messages, object is a (struct Node  *)
  381.  
  382.    LVDrawMsg=RECORD
  383.      methodID:LONGCARD;
  384.      rastPort:gd.RastPortPtr;    (* where to render to        *)
  385.      drawInfo:id.DrawInfoPtr;    (* useful to have around     *)
  386.      bounds:gd.Rectangle;        (* limits of where to render *)
  387.      state:LONGCARD;             (* how to render             *)
  388.    END;
  389.    LVDrawMsgPtr=POINTER TO LVDrawMsg;
  390.  
  391. END GadToolsD.
  392.