(************************************************************************** $RCSfile: GadTools.mod $ Description: Interface to gadtools.library Created by: fjc (Frank Copeland) $Revision: 1.2 $ $Author: fjc $ $Date: 1994/05/12 19:11:02 $ Copyright © 1994, Frank Copeland. This file is part of the Oberon-A Library. See Oberon-A.doc for conditions of use and distribution. Log entries are at the end of the file. ***************************************************************************) MODULE GadTools; (* $P- allow non-portable code *) IMPORT T := Types, E := Exec, U := Utility, G := Graphics, I := Intuition, SYS := SYSTEM; CONST GenericKind * = 0; ButtonKind * = 1; CheckboxKind * = 2; IntegerKind * = 3; ListviewKind * = 4; MxKind * = 5; NumberKind * = 6; CycleKind * = 7; PaletteKind * = 8; ScrollerKind * = 9; SliderKind * = 11; StringKind * = 12; TextKind * = 13; NumKinds * = 14; CONST gadToolBit * = {15}; gadToolMask * = -gadToolBit; CONST ArrowIdcmp * = { I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpIntuiTicks, I.idcmpMouseButtons }; ButtonIdcmp * = { I.idcmpGadgetUp }; CheckBoxIdcmp * = { I.idcmpGadgetUp }; IntegerIdcmp * = { I.idcmpGadgetUp }; ListViewIdcmp * = { I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove } + ArrowIdcmp; MxIdcmp * = { I.idcmpGadgetDown }; NumberIdcmp * = {}; CycleIdcmp * = { I.idcmpGadgetUp }; PaletteIdcmp * = { I.idcmpGadgetUp }; ScrollerIdcmp * = { I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove }; SliderIdcmp * = { I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove }; StringIdcmp * = { I.idcmpGadgetUp }; TextIdcmp * = {}; CONST InterWidth * = 8; InterHeight * = 4; TYPE NewGadgetPtr * = CPOINTER TO NewGadget; NewGadget * = RECORD ngLeftEdge *, ngTopEdge * : INTEGER; ngWidth *, ngHeight * : INTEGER; ngGadgetText * : T.STRPTR; ngTextAttr * : G.TextAttrPtr; ngGadgetID * : T.UWORD; ngFlags * : SET; ngVisualInfo * : T.APTR; ngUserData * : T.APTR; END; CONST PlaceTextLeft * = 0; PlaceTextRight * = 1; PlaceTextAbove * = 2; PlaceTextBelow * = 3; PlaceTextIn * = 4; ngHighLabel * = 5; TYPE NewMenuPtr * = CPOINTER TO NewMenu; NewMenu * = RECORD nmType * : SHORTINT; nmLabel * : T.STRPTR; nmCommKey * : T.STRPTR; nmFlags * : T.WSET; nmMutualExclude * : SET; nmUserData * : T.APTR; END; CONST nmTitle * = 1; nmItem * = 2; nmSub * = 3; nmEnd * = 0; MenuImage * = -128; imItem * = nmItem + MenuImage; imSub * = nmSub + MenuImage; nmBarLabel * = SYS.VAL(T.STRPTR, -1); nmMenuDisabled * = I.MenuEnabled; nmItemDisabled * = I.ItemEnabled; nmFlagMask * = -({ I.CommSeq, I.ItemText } + I.HighFlags); menuTrimmed * = 00000001H; menuInvalid * = 00000002H; menuNoMem * = 00000003H; CONST tagBase * = U.tagUser + 80000H; viNewWindow * = tagBase+1; viNWTags * = tagBase+2; private0 * = tagBase+3; cbChecked * = tagBase+4; lvTop * = tagBase+5; lvLabels * = tagBase+6; lvReadOnly * = tagBase+7; lvScrollWidth * = tagBase+8; mxLabels * = tagBase+9; mxActive * = tagBase+10; txText * = tagBase+11; txCopyText * = tagBase+12; nmNumber * = tagBase+13; cyLabels * = tagBase+14; cyActive * = tagBase+15; paDepth * = tagBase+16; paColor * = tagBase+17; paColorOffset * = tagBase+18; paIndicatorWidth * = tagBase+19; paIndicatorHeight * = tagBase+20; scTop * = tagBase+21; scTotal * = tagBase+22; scVisible * = tagBase+23; scOverlap * = tagBase+24; slMin * = tagBase+38; slMax * = tagBase+39; slLevel * = tagBase+40; slMaxLevelLen * = tagBase+41; slLevelFormat * = tagBase+42; slLevelPlace * = tagBase+43; slDispFunc * = tagBase+44; stString * = tagBase+45; stMaxChars * = tagBase+46; inNumber * = tagBase+47; inMaxChars * = tagBase+48; mnTextAttr * = tagBase+49; mnFrontPen * = tagBase+50; bbRecessed * = tagBase+51; visualInfo * = tagBase+52; lvShowSelected * = tagBase+53; lvSelected * = tagBase+54; reserved1 * = tagBase+56; txBorder * = tagBase+57; nmBorder * = tagBase+58; scArrows * = tagBase+59; mnMenu * = tagBase+60; mxSpacing * = tagBase+61; mnFullMenu * = tagBase+62; mnSecondaryError * = tagBase+63; underscore * = tagBase+64; stEditHook * = tagBase+55; reserved0 * = stEditHook; CONST NWayKind * = CycleKind; NWayIdcmp * = CycleIdcmp; nwLabels * = cyLabels; nwActive * = cyActive; (*-- Library Base variable --------------------------------------------*) TYPE GadToolsBasePtr * = CPOINTER TO GadToolsBase; GadToolsBase * = RECORD (E.Library) END; CONST Name * = "gadtools.library"; VAR Base * : GadToolsBasePtr; cleanup : PROCEDURE (rc : LONGINT); (*-- Library Functions ------------------------------------------------*) LIBCALL (base : GadToolsBasePtr) CreateGadget* ( kind {0} : T.ULONG; gad {8} : I.GadgetPtr; VAR ng {9} : NewGadget; taglist {10} : ARRAY OF U.TagItem ) : I.GadgetPtr; -30; LIBCALL (base : GadToolsBasePtr) FreeGadgets* ( gad {8} : I.GadgetPtr ); -36; LIBCALL (base : GadToolsBasePtr) SetGadgetAttrs* ( gad {8} : I.GadgetPtr; win {9} : I.WindowPtr; req {10} : I.RequesterPtr; taglist {11} : ARRAY OF U.TagItem ); -42; LIBCALL (base : GadToolsBasePtr) CreateMenus* ( VAR newmenu {8} : ARRAY OF NewMenu; taglist {9} : ARRAY OF U.TagItem ) : I.MenuPtr; -48; LIBCALL (base : GadToolsBasePtr) FreeMenus* ( menu {8} : I.MenuPtr ); -54; LIBCALL (base : GadToolsBasePtr) LayoutMenuItems* ( firstitem {8} : I.MenuItemPtr; vi {9} : T.APTR; taglist {10} : ARRAY OF U.TagItem ) : BOOLEAN; -60; LIBCALL (base : GadToolsBasePtr) LayoutMenus* ( firstmenu {8} : I.MenuPtr; vi {9} : T.APTR; taglist {10} : ARRAY OF U.TagItem ) : BOOLEAN; -66; LIBCALL (base : GadToolsBasePtr) GetIMsg* ( iport {8} : E.MsgPortPtr ) : I.IntuiMessagePtr; -72; LIBCALL (base : GadToolsBasePtr) ReplyIMsg* ( imsg {9} : I.IntuiMessagePtr ); -78; LIBCALL (base : GadToolsBasePtr) RefreshWindow* ( win {8} : I.WindowPtr; req {9} : I.RequesterPtr ); -84; LIBCALL (base : GadToolsBasePtr) BeginRefresh* ( win {8} : I.WindowPtr ); -90; LIBCALL (base : GadToolsBasePtr) EndRefresh* ( win {8} : I.WindowPtr; complete {0} : T.LBOOL ); -96; LIBCALL (base : GadToolsBasePtr) FilterIMsg* ( imsg {9} : I.IntuiMessagePtr ) : I.IntuiMessagePtr; -102; LIBCALL (base : GadToolsBasePtr) PostFilterIMsg* ( imsg {8} : I.IntuiMessagePtr ) : I.IntuiMessagePtr; -108; LIBCALL (base : GadToolsBasePtr) CreateContext* ( VAR glistptr {8} : I.GadgetPtr ) : I.GadgetPtr; -114; LIBCALL (base : GadToolsBasePtr) DrawBevelBox* ( rport {8} : G.RastPortPtr; left {0} : LONGINT; top {1} : LONGINT; width {2} : LONGINT; height {3} : LONGINT; taglist {9} : ARRAY OF U.TagItem ); -120; LIBCALL (base : GadToolsBasePtr) GetVisualInfo* ( screen {8} : I.ScreenPtr; taglist {9} : ARRAY OF U.TagItem ) : T.APTR; -126; LIBCALL (base : GadToolsBasePtr) FreeVisualInfo* ( vi {8} : T.APTR ); -132; (*-- C Macros defined as procedures -----------------------------------*) (* $L+ Absolute long addressing for globals *) (*-----------------------------------*) PROCEDURE MenuUserData * (menu : I.MenuPtr) : T.APTR; BEGIN RETURN SYS.VAL (T.APTR, SYS.VAL (LONGINT, menu) + SIZE (I.Menu)) END MenuUserData; (*-----------------------------------*) PROCEDURE MenuitemUserData * (menuitem : I.MenuItemPtr) : T.APTR; BEGIN RETURN SYS.VAL (T.APTR, SYS.VAL (LONGINT, menuitem) + SIZE (I.MenuItem)) END MenuitemUserData; (*-- Library Base variable --------------------------------------------*) (* $L- Address globals through A4 *) (*-----------------------------------*) PROCEDURE* CloseLib (rc : LONGINT); BEGIN IF Base # NIL THEN E.Base.CloseLibrary (Base) END; IF cleanup # NIL THEN cleanup (rc) END END CloseLib; (*-----------------------------------*) PROCEDURE OpenLib * (); BEGIN IF Base = NIL THEN Base := E.Base.OpenLibrary (Name, E.libraryMinimum); IF Base = NIL THEN HALT (100) END; SYS.SETCLEANUP (CloseLib, cleanup) END; END OpenLib; BEGIN Base := NIL; cleanup := NIL END GadTools. (************************************************************************** $Log: GadTools.mod $ Revision 1.2 1994/05/12 19:11:02 fjc - Prepared for release Revision 1.1 1994/01/15 21:04:12 fjc - Start of revision control ***************************************************************************) (* Comments stripped by StripComments 1.0 *)