|##########| |#MAGIC #|CLABLNAG |#PROJECT #|"IMPORTAll" |#PATHS #|"StdProject" |#FLAGS #|xx---x-xx---xxx----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx----xxxx-xx--- |##########| DEFINITION MODULE GadTools; | WB 18 Aug 1992 Datei übernommen. (* $A- *) FROM Exec IMPORT LibraryPtr, MsgPortPtr, ListPtr; FROM Intuition IMPORT IDCMPFlagSet, IDCMPFlags, gaTB, layoTB, pgaTB, strgTB,ScreenPtr, WindowPtr, RequesterPtr, GadgetPtr,IntuiMessagePtr, ActivationFlagSet; FROM Graphics IMPORT TextAttrPtr, RastPortPtr; FROM System IMPORT LONGSET, Register, SysStringPtr; FROM Utility IMPORT StdTags, tagUser, HookPtr; TYPE GadgetKind = ( generic, button, checkbox, integer, listview, mx, number, cycle, palette, scroller, slider=11, string, text, makeMeLong = $10000); CONST arrowIDCMP = IDCMPFlagSet:{gadgetUp,gadgetDown,intuiTicks, mouseButtons}; buttonIDCMP = IDCMPFlagSet:{gadgetUp}; checkBoxIDCMP = IDCMPFlagSet:{gadgetUp}; integerIDCMP = IDCMPFlagSet:{gadgetUp}; listViewIDCMP = IDCMPFlagSet:{gadgetUp,gadgetDown,mouseMove}+arrowIDCMP; mxIDCMP = IDCMPFlagSet:{gadgetDown}; numberIDCMP = IDCMPFlagSet:{}; cycleIDCMP = IDCMPFlagSet:{gadgetUp}; paletteIDCMP = IDCMPFlagSet:{gadgetUp}; | Use arrowIDCMP+scrollerIDCMP if your scrollers have arrows: scrollerIDCMP = IDCMPFlagSet:{gadgetUp,gadgetDown,mouseMove}; sliderIDCMP = IDCMPFlagSet:{gadgetUp,gadgetDown,mouseMove}; stringIDCMP = IDCMPFlagSet:{gadgetUp}; textIDCMP = IDCMPFlagSet:{}; |------------------------------------------------------------------------ CONST interWidth = 8; interHeight = 4; |------------------------------------------------------------------------ TYPE VisualInfo = HIDDEN; NewGadgetFlags = ( placeTextLeft, placeTextRight, placeTextAbove, placeTextBelow, placeTextIn, highLabel, rsvd31=31 ); NewGadgetFlagSet = SET OF NewGadgetFlags; NewGadget = RECORD leftEdge, topEdge : INTEGER; width, height : INTEGER; gadgetText : SysStringPtr; textAttr : TextAttrPtr; gadgetID : CARDINAL; flags : NewGadgetFlagSet; visualInfo : VisualInfo; userData : ANYPTR; END; TYPE NewMenuType = ( end = 0, title = 1, item = 2, sub = 3, image = 128, imageItem = 130, imageSub = 131); TYPE NewMenuFlags = (menuDisabled = 0,itemDisabled = 4,checkIt = 0, menuToggle = 3,checked = 8,makeMeWord = 15); NewMenuFlagSet = SET OF NewMenuFlags; NewMenuPtr = POINTER TO NewMenu; NewMenu = RECORD type : NewMenuType; label : SysStringPtr; commKey : SysStringPtr; flags : NewMenuFlagSet; mutualExclude : LONGSET; userData : ANYPTR; END; NewMenuArray = ARRAY OF NewMenu; CONST barLabel = SysStringPtr(-1); TYPE GTMenuPtr = POINTER TO GTMenu; GTMenu = RECORD OF Intuition.Menu userData : ANYPTR; END; GTMenuItemPtr = POINTER TO GTMenuItem; GTMenuItem = RECORD OF Intuition.MenuItem userData : ANYPTR; END; | Return codes through GTMN_ErrorCode tag CM2ndErr = (menuOk = 0, | no error occured menuTrimmed = 1, | Too many menus, items, or | subitems, | menu is trimmed menuInvalid = 2, | Invalid NewMenu array noMem = 3, | Out of memory mmlong = $10000 ); CONST gtTB = tagUser + $80000; | $80080000, base for GadTools Tagvalues TYPE | Callback for number calculation before display DispFunc = PROCEDURE( gad IN A0: GadgetPtr; org IN D0: INTEGER ): LONGINT; | Orientation of sliders and scrollers Orientation = (none,horiz,vert,mmlong=$10000); GadgetTags = TAGS OF StdTags left = gaTB+$01 : LONGINT; underScore = gtTB+64 : LONGCHAR; | the character that | precedes the | | character to be underlined | (to indicate a shortcut). | Can be used for all classes. | ButtonTags buDisabled = gaTB+14 : LONGBOOL; | =gaDisabled | CheckBoxTags cbChecked = gtTB+4 : LONGBOOL; | condition of the | checkbox cbDisabled = gaTB+14 : LONGBOOL; | =gaDisabled | CycleTags cyLabels = gtTB+14 : POINTER TO ARRAY OF SysStringPtr; | | NIL-terminated array of labels cyActive = gtTB+15 : LONGCARD; | active one in the cycle cyDisabled = gaTB+14 : LONGBOOL; | =gaDisabled | IntegerTags inNumber = gtTB+47 : LONGCARD; | initial number in gadget inMaxChars : LONGCARD; | max number of digits (10) inExitHelp = strgTB+$13 : LONGBOOL; | as in Intution.StrgTags inTabCycle = gaTB+$24 : LONGBOOL; | =gaTabCycle inDisabled = gaTB+14 : LONGBOOL; | =gaDisabled | ListViewTags lvTop = gtTB+5 : LONGCARD; | Top visible one in listview lvLabels = gtTB+6 : ListPtr; | List to display in listview lvReadOnly = gtTB+7 : LONGBOOL; | listview is to be read-only lvScrollWidth = gtTB+8 : LONGCARD; | UWORD; Width of scrollbar lvShowSelected = gtTB+$35 : GadgetPtr;| show selected entry | | beneath listview. Pass NULL for | display-only, | or a POINTER to a gadtools string gadget | you've created lvSelected = gtTB+$36 : LONGCARD; | CARDINAL | | SET ordinal number of selected entry | in the list lvSpacing = layoTB+$2 : LONGCARD; | As in Intuition.LayoutTags | MxTags mxLabels = gtTB+9 : POINTER TO ARRAY OF SysStringPtr; | | NIL-terminated array of labels mxActive = gtTB+10 : LONGCARD; | Active one in mx gadget mxSpacing = gtTB+61 : LONGCARD; | Added to font height to | | figure out spacing between mx choices. | Use instead of LayoutTags.spacing for | mx gadgets. | NumberTags nmNumber = gtTB+13 : LONGINT; | Number to display nmBorder = gtTB+58 : LONGBOOL; | | Put a border around Number-display | gadgets | PaletteTags paDisabled = gaTB+$E : LONGBOOL; | same as gaDisabled paDepth = gtTB+16 : LONGCARD; | bitplanes in palette paColor = gtTB+17 : LONGCARD; | Palette color paColorOffset = gtTB+18 : LONGCARD; | 1st color to use in | palette paIndicatorW = gtTB+19 : LONGCARD; | curr. color indicator | width paIndicatorH = gtTB+20 : LONGCARD; | cc. indicator height | ScrollerTags scTop = gtTB+21 : LONGINT; | Top visible in scroller scTotal = gtTB+22 : LONGINT; | Total in scroller area scVisible = gtTB+23 : LONGINT; | Number visible in scroller |scOverlap = gtTB+24 ; | Unused scArrows = gtTB+59 : LONGCARD; | size of arrows for scroller scFreedom = pgaTB+1 : Orientation; | =pgaFreedom scImmediate = pgaTB+$15 : LONGBOOL; | =pgaImmediate scRelVerify = gaTB+$16 : LONGBOOL; | =gaRelVerify scDisabled = gaTB+$E : LONGBOOL; | =gaDisabled | SliderTags slMin = gtTB+38 : LONGINT; | Slider min value slMax = gtTB+39 : LONGINT; | Slider max value slLevel = gtTB+40 : LONGINT; | Slider level slMaxLevelLen = gtTB+41 : LONGCARD; | Max length of | printed level slLevelFormat = gtTB+42 : SysStringPtr; | Format string | for level slLevelPlace = gtTB+43 : NewGadgetFlagSet; | place of level slDispFunc = gtTB+44 : DispFunc; | | Callback for number calc. before | display slFreedom = pgaTB+$1 : Orientation; | =pgaFreedom slImmediate = gaTB+$15 : LONGBOOL; | =gaImmediate slRelVerify = gaTB+$16 : LONGBOOL; | =gaRelVerify slDisabled = gaTB+$E : LONGBOOL; | =gaDisabled | StringTags stString = gtTB+45 : SysStringPtr; | | String gadget's displayed string stMaxChars = gtTB+46 : LONGCARD; | Max length of string stDisabled = gaTB+$E : LONGBOOL; | =gaDisabled stExitHelp = strgTB+$13 : LONGBOOL; | =strgExitHelp stTabCycle = gaTB+$24 : LONGBOOL; | =gaTabCycle stEditHook = gtTB+$37 : HookPtr; | see StringExtend stJustification = strgTB+$10 : ActivationFlagSet; | | choose one of stringLeft (def), | stringRight, stringCenter. stReplaceMode = strgTB+$0D : LONGBOOL; | =strgReplaceMode | TextTags txText = gtTB+11 : SysStringPtr;| Text to display txCopyText = gtTB+12 : LONGBOOL; | Copy text label instead | of referencing it txBorder = gtTB+57 : LONGBOOL; | Put a border around END; | of GadgetTags GadgetTagListPtr = POINTER TO GadgetTagList; GadgetTagList = ARRAY OF GadgetTags; | | Tags for calls to CreateMenus | CreateMenuTags = TAGS OF StdTags frontPen = gtTB+50 : LONGCARD; | MenuItem text pen color fullMenu = gtTB+62 : LONGBOOL; | Asks CreateMenus() to | | validate the completeness of the menu | structure secondaryErr = gtTB+63 : POINTER TO CM2ndErr; | | pointer to a CM2ndErr to receive error | reports from CreateMenus() END; CrMenuTagListPtr = POINTER TO CrMenuTagList; CrMenuTagList = ARRAY OF CreateMenuTags; | | Tags for calls to LayoutMenus | LayoutMenuTags = TAGS OF StdTags textAttr = gtTB+49 : TextAttrPtr; | GTMenuItem font TextAttr menu = gtTB+60 : GTMenuPtr; | Pointer to GTMenu for use | by LayoutMenuItems() END; LaMenuTagListPtr = POINTER TO LaMenuTagList; LaMenuTagList = ARRAY OF LayoutMenuTags; | | Tags for calls to DrawBevelBox | BevelBoxTags = TAGS OF StdTags recessed = gtTB+51 : LONGINT; | Make BevelBox recessed visualInfo : VisualInfo; | result of VisualInfo call END; BevBoxTagListPtr = POINTER TO BevBoxTagList; BevBoxTagList = ARRAY OF BevelBoxTags; | gtTB+25 through gtTB+37 are reserved | gtTB+65 on up reserved for future use GadToolsLibraryPtr = LibraryPtr; VAR GadToolsBase : GadToolsLibraryPtr; LIBRARY GadToolsBase BY -114 PROCEDURE CreateContext( VAR GadgetPtr IN A0 : GadgetPtr ): GadgetPtr; LIBRARY GadToolsBase BY -30 PROCEDURE CreateGadgetTags( kind IN D0 : GadgetKind; previous IN A0 : GadgetPtr; REF newgad IN A1 : NewGadget; taglist IN A2 : LIST OF GadgetTags):GadgetPtr; LIBRARY GadToolsBase BY -30 PROCEDURE CreateGadget( kind IN D0 : GadgetKind; previous IN A0 : GadgetPtr; REF newgad IN A1 : NewGadget; taglist IN A2 : GadgetTagListPtr ): GadgetPtr; LIBRARY GadToolsBase BY -48 PROCEDURE CreateMenusTags(REF newmenu IN A0 : NewMenuArray; taglist IN A1 : LIST OF CreateMenuTags):GTMenuPtr; LIBRARY GadToolsBase BY -48 PROCEDURE CreateMenus( REF newmenu IN A0 : NewMenuArray; taglist IN A1 : CrMenuTagListPtr ): GTMenuPtr; LIBRARY GadToolsBase BY -120 PROCEDURE DrawBevelBox( rport IN A0 : RastPortPtr; left IN D0, top IN D1, width IN D2, height IN D3 : INTEGER; taglist IN A1 : LIST OF BevelBoxTags ); LIBRARY GadToolsBase BY -36 PROCEDURE FreeGadgets( glist IN A0 : GadgetPtr ); LIBRARY GadToolsBase BY -54 PROCEDURE FreeMenus( menu IN A0 : GTMenuPtr ); LIBRARY GadToolsBase BY -132 PROCEDURE FreeVisualInfo( vi IN A0 : VisualInfo ); LIBRARY GadToolsBase BY -126 PROCEDURE GetVisualInfo( screen IN A0 : ScreenPtr; taglist IN A1 : LIST OF StdTags ): VisualInfo; LIBRARY GadToolsBase BY -90 PROCEDURE GT_BeginRefresh( win IN A0 : WindowPtr ); LIBRARY GadToolsBase BY -96 PROCEDURE GT_EndRefresh( win IN A0 : WindowPtr; complete IN D0 : BOOLEAN); LIBRARY GadToolsBase BY -102 PROCEDURE FilterIMsg( imsg IN A1 : IntuiMessagePtr ): IntuiMessagePtr; LIBRARY GadToolsBase BY -72 PROCEDURE GetIMsg( intuiport IN A0 : MsgPortPtr ): IntuiMessagePtr; LIBRARY GadToolsBase BY -108 PROCEDURE PostFilterIMsg(modimsg IN A1 : IntuiMessagePtr):IntuiMessagePtr; LIBRARY GadToolsBase BY -84 PROCEDURE GT_RefreshWindow( win IN A0 : WindowPtr; req IN A1 : RequesterPtr ); LIBRARY GadToolsBase BY -78 PROCEDURE ReplyIMsg( imsg IN A1 : IntuiMessagePtr ); LIBRARY GadToolsBase BY -42 PROCEDURE GT_SetGadgetAttrs( gad IN A0 : GadgetPtr; win IN A1 : WindowPtr; req IN A2 : RequesterPtr; taglist IN A3 : LIST OF GadgetTags ); LIBRARY GadToolsBase BY -60 PROCEDURE LayoutMenuItems(menuitem IN A0 : GTMenuItemPtr; vi IN A1 : VisualInfo; taglist IN A2 : LIST OF LayoutMenuTags):BOOLEAN; LIBRARY GadToolsBase BY -66 PROCEDURE LayoutMenus(menu IN A0 : GTMenuPtr; vi IN A1 : VisualInfo; taglist IN A2 : LIST OF LayoutMenuTags):BOOLEAN; GROUP ArrayGrp = NewMenuArray; ConstGrp = arrowIDCMP, barLabel, buttonIDCMP, checkBoxIDCMP, cycleIDCMP, CM2ndErr, gtTB, integerIDCMP, interHeight, interWidth, gaTB, pgaTB, strgTB, layoTB, listViewIDCMP, mxIDCMP, numberIDCMP, paletteIDCMP, scrollerIDCMP, sliderIDCMP, stringIDCMP, textIDCMP; EnumGrp = GadgetKind, NewGadgetFlags, NewMenuType; PointerGrp = GTMenuItemPtr, GTMenuPtr, GadToolsLibraryPtr, NewMenuPtr, VisualInfo; ProcGrp = CreateContext, CreateGadget, CreateMenus, DrawBevelBox, FreeGadgets, FreeMenus, FreeVisualInfo, GetVisualInfo, GT_BeginRefresh, GT_EndRefresh, FilterIMsg, GetIMsg, PostFilterIMsg, GT_RefreshWindow, ReplyIMsg, GT_SetGadgetAttrs, LayoutMenuItems, LayoutMenus; RecordGrp = GTMenu, GTMenuItem, NewGadget, NewMenu; SetGrp = NewGadgetFlags, NewMenuFlags; SubRangeGrp = NewMenuFlags; TagsGrp = BevelBoxTags, CreateMenuTags, GadgetTags, LayoutMenuTags; TypeGrp = ArrayGrp, EnumGrp, PointerGrp, RecordGrp, SetGrp, SubRangeGrp; All = ConstGrp, ProcGrp, TagsGrp, TypeGrp; END GadTools.