home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Pascal / HISOFTPASCAL2,0-3.DMS / in.adf / Units / GadTools.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-05-20  |  7.7 KB  |  430 lines

  1. unit GadTools;
  2.  
  3. INTERFACE
  4. uses Exec, Graphics, Intuition, Utility;
  5.  
  6.  
  7. type
  8.     pNewGadget = ^tNewGadget;
  9.     tNewGadget = record
  10.         ng_LeftEdge: integer;
  11.         ng_TopEdge: integer;
  12.         ng_Width: integer;
  13.         ng_Height: integer;
  14.         ng_GadgetText: pbyte;
  15.         ng_TextAttr: pTextAttr;
  16.         ng_GadgetID: word;
  17.         ng_Flags: long;
  18.         ng_VisualInfo: pointer;
  19.         ng_UserData: pointer;
  20.         end;
  21.  
  22.     pNewMenu = ^tNewMenu;
  23.     tNewMenu = record
  24.         nm_Type: byte;
  25.         nm_Label: STRPTR;
  26.         nm_CommKey: STRPTR;
  27.         nm_Flags: word;
  28.         nm_MutualExclude: longint;
  29.         nm_UserData: pointer;
  30.         end;
  31.  
  32.     ppGadget = ^pGadget;
  33.  
  34.  
  35. var
  36.     GadToolsBase: pLibrary;
  37.  
  38.  
  39. const
  40.     GTMX_Labels = $80080009;
  41.     GTCY_Active = $8008000F;
  42.     GTSC_Top = $80080015;
  43.     GTNW_Labels = $8008000E;
  44.     GTNM_Border = $8008003A;
  45.     GTMN_FullMenu = $8008003E;
  46.     NWAY_KIND = 7;
  47.     GTPA_IndicatorHeight = $80080014;
  48.     GTMN_Menu = $8008003C;
  49.     GT_TagBase = $80080000;
  50.     GTSL_Level = $80080028;
  51.     NUM_KINDS = $E;
  52.     GTMN_FrontPen = $80080032;
  53.     INTEGER_KIND = 3;
  54.     GTPA_ColorOffset = $80080012;
  55.     NM_BARLABEL = $FFFFFFFF;
  56.     PALETTE_KIND = 8;
  57.     TEXT_KIND = $D;
  58.     GTSC_Total = $80080016;
  59.     GTSC_Visible = $80080017;
  60.     SLIDERIDCMP = $70;
  61.     GTIN_Number = $8008002F;
  62.     GTMX_Active = $8008000A;
  63.     GTLV_Selected = $80080036;
  64.     GTNW_Active = $8008000F;
  65.     LISTVIEW_KIND = 4;
  66.     NM_ITEMDISABLED = $10;
  67.     GTLV_Top = $80080005;
  68.     GTNM_Number = $8008000D;
  69.     GTMX_Spacing = $8008003D;
  70.     GADTOOLMASK = $FFFF7FFF;
  71.     NUMBERIDCMP = 0;
  72.     GTPA_IndicatorWidth = $80080013;
  73.     GTSL_LevelFormat = $8008002A;
  74.     NM_MENUDISABLED = 1;
  75.     GTSC_Overlap = $80080018;
  76.     GTTX_Border = $80080039;
  77.     INTERHEIGHT = 4;
  78.     PLACETEXT_IN = $10;
  79.     GT_Private0 = $80080003;
  80.     GT_Reserved0 = $80080037;
  81.     GT_Reserved1 = $80080038;
  82.     GTLV_ShowSelected = $80080035;
  83.     NM_FLAGMASK = $FFFFFF39;
  84.     MXIDCMP = $20;
  85.     GTMN_TextAttr = $80080031;
  86.     CYCLEIDCMP = $40;
  87.     GTVI_NewWindow = $80080001;
  88.     STRINGIDCMP = $40;
  89.     GTSC_Arrows = $8008003B;
  90.     NM_TITLE = 1;
  91.     GTMENU_NOMEM = 3;
  92.     PLACETEXT_ABOVE = 4;
  93.     SLIDER_KIND = $B;
  94.     GTLV_ScrollWidth = $80080008;
  95.     BUTTONIDCMP = $40;
  96.     GTTX_Text = $8008000B;
  97.     NUMBER_KIND = 6;
  98.     GADTOOLBIT = $8000;
  99.     GTST_String = $8008002D;
  100.     CHECKBOXIDCMP = $40;
  101.     GTTX_CopyText = $8008000C;
  102.     PLACETEXT_BELOW = 8;
  103.     IM_ITEM = $82;
  104.     GTMN_SecondaryError = $8008003F;
  105.     PLACETEXT_RIGHT = 2;
  106.     NM_ITEM = 2;
  107.     MX_KIND = 5;
  108.     CYCLE_KIND = 7;
  109.     STRING_KIND = $C;
  110.     MENU_IMAGE = $80;
  111.     GTCB_Checked = $80080004;
  112.     ARROWIDCMP = $400068;
  113.     BUTTON_KIND = 1;
  114.     NM_END = 0;
  115.     GT_VisualInfo = $80080034;
  116.     CHECKBOX_KIND = 2;
  117.     INTERWIDTH = 8;
  118.     GTVI_NWTags = $80080002;
  119.     PLACETEXT_LEFT = 1;
  120.     GTMENU_INVALID = 2;
  121.     SCROLLERIDCMP = $70;
  122.     IM_SUB = $83;
  123.     NG_HIGHLABEL = $20;
  124.     NWAYIDCMP = $40;
  125.     GTMENU_TRIMMED = 1;
  126.     NM_SUB = 3;
  127.     GTSL_MaxLevelLen = $80080029;
  128.     GTIN_MaxChars = $80080030;
  129.     INTEGERIDCMP = $40;
  130.     PALETTEIDCMP = $40;
  131.     TEXTIDCMP = 0;
  132.     GTSL_LevelPlace = $8008002B;
  133.     GTBB_Recessed = $80080033;
  134.     LISTVIEWIDCMP = $400078;
  135.     GTPA_Depth = $80080010;
  136.     GT_Underscore = $80080040;
  137.     GENERIC_KIND = 0;
  138.     GTCY_Labels = $8008000E;
  139.     SCROLLER_KIND = 9;
  140.     GTSL_DispFunc = $8008002C;
  141.     GTSL_Min = $80080026;
  142.     GTSL_Max = $80080027;
  143.     GTST_MaxChars = $8008002E;
  144.     GTST_EditHook = $80080037;
  145.     GTLV_Labels = $80080006;
  146.     GTPA_Color = $80080011;
  147.     GTLV_ReadOnly = $80080007;
  148.  
  149.  
  150. function CreateGadgetA
  151.         (kind: long;
  152.         gad: pGadget;
  153.         ng: pNewGadget;
  154.         taglist: pTagItem): pGadget;
  155.  
  156. procedure FreeGadgets (gad: pGadget);
  157. procedure GT_SetGadgetAttrsA
  158.         (gad: pGadget;
  159.         win: pWindow;
  160.         req: pRequester;
  161.         taglist: pTagItem);
  162.  
  163. function CreateMenusA
  164.         (newmenu: pNewMenu;
  165.         taglist: pTagItem): pMenu;
  166.  
  167. procedure FreeMenus (menu: pMenu);
  168. function LayoutMenuItemsA
  169.         (firstitem: pMenuItem;
  170.         vi: pointer;
  171.         taglist: pTagItem): boolean;
  172.  
  173. function LayoutMenusA
  174.         (firstmenu: pMenu;
  175.         vi: pointer;
  176.         taglist: pTagItem): boolean;
  177.  
  178. function GT_GetIMsg (iport: pMsgPort): pIntuiMessage;
  179. procedure GT_ReplyIMsg (imsg: pIntuiMessage);
  180. procedure GT_RefreshWindow
  181.         (win: pWindow;
  182.         req: pRequester);
  183.  
  184. procedure GT_BeginRefresh (win: pWindow);
  185. procedure GT_EndRefresh
  186.         (win: pWindow;
  187.         complete: boolean);
  188.  
  189. function GT_FilterIMsg (imsg: pIntuiMessage): pIntuiMessage;
  190. function GT_PostFilterIMsg (imsg: pIntuiMessage): pIntuiMessage;
  191. function CreateContext (glistptr: ppGadget): pGadget;
  192. procedure DrawBevelBoxA
  193.         (rport: pRastPort;
  194.         left: integer;
  195.         top: integer;
  196.         width: integer;
  197.         height: integer;
  198.         taglist: pTagItem);
  199.  
  200. function GetVisualInfoA
  201.         (screen: pScreen;
  202.         taglist: pTagItem): pointer;
  203.  
  204. procedure FreeVisualInfo (vi: pointer);
  205.  
  206.  
  207. function GTMENU_USERDATA (menu: pMenu): pointer;
  208. function GTMENUITEM_USERDATA (menuitem: pMenuItem): pointer;
  209.  
  210.  
  211. IMPLEMENTATION
  212. function GTMENU_USERDATA; xassembler;
  213. asm
  214.     move.l    4(sp),a0
  215.     move.l    30(a0),8(sp)
  216. end;
  217.  
  218. function GTMENUITEM_USERDATA; xassembler;
  219. asm
  220.     move.l    4(sp),a0
  221.     move.l    34(a0),8(sp)
  222. end;
  223.  
  224. function CreateGadgetA; xassembler;
  225. asm
  226.     movem.l    a2/a6,-(sp)
  227.     lea        $C(sp),a6
  228.     move.l    (a6)+,a2
  229.     move.l    (a6)+,a1
  230.     move.l    (a6)+,a0
  231.     move.l    (a6)+,d0
  232.     move.l    GadToolsBase,a6
  233.     jsr        -$1E(a6)
  234.     move.l    d0,$1C(sp)
  235.     movem.l    (sp)+,a2/a6
  236. end;
  237.  
  238. procedure FreeGadgets; xassembler;
  239. asm
  240.     move.l    a6,-(sp)
  241.     move.l    8(sp),a0
  242.     move.l    GadToolsBase,a6
  243.     jsr        -$24(a6)
  244.     move.l    (sp)+,a6
  245. end;
  246.  
  247. procedure GT_SetGadgetAttrsA; xassembler;
  248. asm
  249.     movem.l    a2-a3/a6,-(sp)
  250.     lea        $10(sp),a6
  251.     move.l    (a6)+,a3
  252.     move.l    (a6)+,a2
  253.     move.l    (a6)+,a1
  254.     move.l    (a6)+,a0
  255.     move.l    GadToolsBase,a6
  256.     jsr        -$2A(a6)
  257.     movem.l    (sp)+,a2-a3/a6
  258. end;
  259.  
  260. function CreateMenusA; xassembler;
  261. asm
  262.     move.l    a6,-(sp)
  263.     lea        8(sp),a6
  264.     move.l    (a6)+,a1
  265.     move.l    (a6)+,a0
  266.     move.l    GadToolsBase,a6
  267.     jsr        -$30(a6)
  268.     move.l    d0,$10(sp)
  269.     move.l    (sp)+,a6
  270. end;
  271.  
  272. procedure FreeMenus; xassembler;
  273. asm
  274.     move.l    a6,-(sp)
  275.     move.l    8(sp),a0
  276.     move.l    GadToolsBase,a6
  277.     jsr        -$36(a6)
  278.     move.l    (sp)+,a6
  279. end;
  280.  
  281. function LayoutMenuItemsA; xassembler;
  282. asm
  283.     movem.l    a2/a6,-(sp)
  284.     lea        $C(sp),a6
  285.     move.l    (a6)+,a2
  286.     move.l    (a6)+,a1
  287.     move.l    (a6)+,a0
  288.     move.l    GadToolsBase,a6
  289.     jsr        -$3C(a6)
  290.     tst.l    d0
  291.     sne        d0
  292.     neg.b    d0
  293.     move.b    d0,$18(sp)
  294.     movem.l    (sp)+,a2/a6
  295. end;
  296.  
  297. function LayoutMenusA; xassembler;
  298. asm
  299.     movem.l    a2/a6,-(sp)
  300.     lea        $C(sp),a6
  301.     move.l    (a6)+,a2
  302.     move.l    (a6)+,a1
  303.     move.l    (a6)+,a0
  304.     move.l    GadToolsBase,a6
  305.     jsr        -$42(a6)
  306.     tst.l    d0
  307.     sne        d0
  308.     neg.b    d0
  309.     move.b    d0,$18(sp)
  310.     movem.l    (sp)+,a2/a6
  311. end;
  312.  
  313. function GT_GetIMsg; xassembler;
  314. asm
  315.     move.l    a6,-(sp)
  316.     move.l    8(sp),a0
  317.     move.l    GadToolsBase,a6
  318.     jsr        -$48(a6)
  319.     move.l    d0,$C(sp)
  320.     move.l    (sp)+,a6
  321. end;
  322.  
  323. procedure GT_ReplyIMsg; xassembler;
  324. asm
  325.     move.l    a6,-(sp)
  326.     move.l    8(sp),a1
  327.     move.l    GadToolsBase,a6
  328.     jsr        -$4E(a6)
  329.     move.l    (sp)+,a6
  330. end;
  331.  
  332. procedure GT_RefreshWindow; xassembler;
  333. asm
  334.     move.l    a6,-(sp)
  335.     lea        8(sp),a6
  336.     move.l    (a6)+,a1
  337.     move.l    (a6)+,a0
  338.     move.l    GadToolsBase,a6
  339.     jsr        -$54(a6)
  340.     move.l    (sp)+,a6
  341. end;
  342.  
  343. procedure GT_BeginRefresh; xassembler;
  344. asm
  345.     move.l    a6,-(sp)
  346.     move.l    8(sp),a0
  347.     move.l    GadToolsBase,a6
  348.     jsr        -$5A(a6)
  349.     move.l    (sp)+,a6
  350. end;
  351.  
  352. procedure GT_EndRefresh; xassembler;
  353. asm
  354.     move.l    a6,-(sp)
  355.     moveq    #0,d0
  356.     move.b    8(sp),d0
  357.     move.l    $A(sp),a0
  358.     move.l    GadToolsBase,a6
  359.     jsr        -$60(a6)
  360.     move.l    (sp)+,a6
  361. end;
  362.  
  363. function GT_FilterIMsg; xassembler;
  364. asm
  365.     move.l    a6,-(sp)
  366.     move.l    8(sp),a1
  367.     move.l    GadToolsBase,a6
  368.     jsr        -$66(a6)
  369.     move.l    d0,$C(sp)
  370.     move.l    (sp)+,a6
  371. end;
  372.  
  373. function GT_PostFilterIMsg; xassembler;
  374. asm
  375.     move.l    a6,-(sp)
  376.     move.l    8(sp),a1
  377.     move.l    GadToolsBase,a6
  378.     jsr        -$6C(a6)
  379.     move.l    d0,$C(sp)
  380.     move.l    (sp)+,a6
  381. end;
  382.  
  383. function CreateContext; xassembler;
  384. asm
  385.     move.l    a6,-(sp)
  386.     move.l    8(sp),a0
  387.     move.l    GadToolsBase,a6
  388.     jsr        -$72(a6)
  389.     move.l    d0,$C(sp)
  390.     move.l    (sp)+,a6
  391. end;
  392.  
  393. procedure DrawBevelBoxA; xassembler;
  394. asm
  395.     movem.l    d3/a6,-(sp)
  396.     lea        $C(sp),a6
  397.     move.l    (a6)+,a1
  398.     move.w    (a6)+,d3
  399.     move.w    (a6)+,d2
  400.     move.w    (a6)+,d1
  401.     move.w    (a6)+,d0
  402.     move.l    (a6)+,a0
  403.     move.l    GadToolsBase,a6
  404.     jsr        -$78(a6)
  405.     movem.l    (sp)+,d3/a6
  406. end;
  407.  
  408. function GetVisualInfoA; xassembler;
  409. asm
  410.     move.l    a6,-(sp)
  411.     lea        8(sp),a6
  412.     move.l    (a6)+,a1
  413.     move.l    (a6)+,a0
  414.     move.l    GadToolsBase,a6
  415.     jsr        -$7E(a6)
  416.     move.l    d0,$10(sp)
  417.     move.l    (sp)+,a6
  418. end;
  419.  
  420. procedure FreeVisualInfo; xassembler;
  421. asm
  422.     move.l    a6,-(sp)
  423.     move.l    8(sp),a0
  424.     move.l    GadToolsBase,a6
  425.     jsr        -$84(a6)
  426.     move.l    (sp)+,a6
  427. end;
  428.  
  429. end.
  430.