|##########|
|#MAGIC   #|DBGFFBGO
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x--x---xxx--x--------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x----x----------
|##########|
DEFINITION MODULE GBView;

FROM System IMPORT Regs;
FROM EGSGfx IMPORT RastPortPtr;
IMPORT EGSIntui AS I;
IMPORT EGSGadBox AS GB;
FROM EGS IMPORT EBitMapPtr;
FROM Exec IMPORT LibraryPtr;


CONST
  ViewType       = CAST(LONGINT,"VIEW".data);

TYPE
  ViewGadPtr     = POINTER TO ViewGadget;

  ViewGadFlags   = (scrollLeft,scrollRight,scrollTop,scrollBottom,
                    scrollArrows,vgf31=31);
  ViewGadFlagSet = SET OF ViewGadFlags;


  FillDataPtr    = POINTER TO FillData;
  FillData       = RECORD
                     rp       : RastPortPtr;
                     gad      : ViewGadPtr;
                     sx,sy    : INTEGER;
                     w,h      : INTEGER;
                     dx,dy    : INTEGER;
                   END;

  FillCall       = PROCEDURE(data IN A1 : FillDataPtr);

  ViewInfoPtr    = POINTER TO ViewInfo;
  ViewInfo       = RECORD
                     call     : FillCall;
                     data     : ANYPTR;
                     width,
                     height   : INTEGER;
                     zoom     : INTEGER;
                   END;

  ViewGadget     = RECORD OF I.MasterGadget;
                     vflags   : ViewGadFlagSet;

                     hprop,
                     vprop    : I.PropGadPtr;

                     dispX,
                     dispY    : INTEGER;

                     box      : I.MasterGadPtr;
                     con      : GB.GadContext;

                     info     : ViewInfoPtr;
                   END;

VAR
  GBViewBase : LibraryPtr;

LIBRARY GBViewBase BY - 30
  PROCEDURE CreateViewGadget(con   IN A0: GB.GadContext;
                             minW  IN D0,
                             maxW  IN D1,
                             minH  IN D2,
                             maxH  IN D3  : INTEGER;
                             flags IN D4  : ViewGadFlagSet;
                             id    IN D5  : LONGINT):GB.GadBoxPtr;

LIBRARY GBViewBase BY - 36
  PROCEDURE ScrollViewGadget(win  IN A0 : I.WindowPtr;
                             gad  IN A1 : ViewGadPtr;
                             dx   IN D0,
                             dy   IN D1 : INTEGER);

LIBRARY GBViewBase BY - 42
  PROCEDURE ModifyViewGadget(win  IN A0 : I.WindowPtr;
                             gad  IN A1 : ViewGadPtr;
                             info IN A2 : ViewInfoPtr;
                             x    IN D0,
                             y    IN D1 : INTEGER);

LIBRARY GBViewBase BY - 48
  PROCEDURE ModifyBMViewGadget(win  IN A0 : I.WindowPtr;
                               gad  IN A1 : ViewGadPtr;
                               bm   IN A2 : EBitMapPtr;
                               x    IN D0,
                               y    IN D1 : INTEGER);

LIBRARY GBViewBase BY - 54
  PROCEDURE ModifyMaskViewGadget(win   IN A0 : I.WindowPtr;
                                 gad   IN A1 : ViewGadPtr;
                                 bm    IN A2 : EBitMapPtr;
                                 front IN D0,
                                 back  IN D1 : LONGINT;
                                 x     IN D2,
                                 y     IN D3 : INTEGER);

LIBRARY GBViewBase BY - 60
  PROCEDURE UpdateViewRect(win   IN A0 : I.WindowPtr;
                           gad   IN A1 : ViewGadPtr;
                           x     IN D0,
                           y     IN D1,
                           w     IN D2,
                           h     IN D3 : INTEGER);

LIBRARY GBViewBase BY - 66
  PROCEDURE ModifyBMZoomViewGadget(win  IN A0 : I.WindowPtr;
                                   gad  IN A1 : ViewGadPtr;
                                   bm   IN A2 : EBitMapPtr;
                                   x    IN D0,
                                   y    IN D1 : INTEGER;
                                   zoom IN D2 : INTEGER);

LIBRARY GBViewBase BY - 72
  PROCEDURE GCScrollView(con  IN A0 : GB.GadContext;
                         id   IN D0 : LONGINT;
                         dx   IN D1,
                         dy   IN D2 : INTEGER);

LIBRARY GBViewBase BY - 78
  PROCEDURE GCGetViewDispX(con  IN A0 : GB.GadContext;
                           id   IN D0 : LONGINT):INTEGER;

LIBRARY GBViewBase BY - 84
  PROCEDURE GCGetViewDispY(con  IN A0 : GB.GadContext;
                           id   IN D0 : LONGINT):INTEGER;

LIBRARY GBViewBase BY - 90
  PROCEDURE GCSetViewValue(con  IN A0 : GB.GadContext;
                           id   IN D0 : LONGINT;
                           info IN A1 : ViewInfoPtr;
                           x    IN D1,
                           y    IN D2 : INTEGER);

LIBRARY GBViewBase BY - 96
  PROCEDURE GCSetViewValueBM(con  IN A0 : GB.GadContext;
                             id   IN D0 : LONGINT;
                             map  IN A1 : EBitMapPtr;
                             x    IN D1,
                             y    IN D2 : INTEGER);

LIBRARY GBViewBase BY -102
  PROCEDURE GCSetViewValueMask(con   IN A0 : GB.GadContext;
                               id    IN D0 : LONGINT;
                               map   IN A1 : EBitMapPtr;
                               front IN D1 : LONGINT;
                               back  IN D2 : LONGINT;
                               x     IN D3,
                               y     IN D4 : INTEGER);

LIBRARY GBViewBase BY -108
  PROCEDURE GCSetViewValueBMZoom(con  IN A0 : GB.GadContext;
                                 id   IN D0 : LONGINT;
                                 map  IN A1 : EBitMapPtr;
                                 x    IN D1,
                                 y    IN D2 : INTEGER;
                                 zoom IN D3 : INTEGER);

LIBRARY GBViewBase BY -114
  PROCEDURE GCUpdateViewRect(con IN A0 : GB.GadContext;
                             id  IN D0 : LONGINT;
                             x   IN D1,
                             y   IN D2,
                             w   IN D3,
                             h   IN D4 : INTEGER);

END GBView.
