DEFINITION MODULE Windows; (* jr/1jan88 *)
(*$ LargeVars:=FALSE NameChk:=FALSE *)

IMPORT IntuitionD;

TYPE
  Window=IntuitionD.WindowPtr;
  WinGad=(sizing, moving, arranging, closing, scrolling);
  WinGadSet=SET OF WinGad;
  Mode=(replMd, xorMd, invMd);
  ModeSet=SET OF Mode;     (* ModeSet{}=orMd *)

PROCEDURE OpenWindow(VAR u: Window; x, y, w, h: INTEGER;
                     title: ARRAY OF CHAR;
                     gad: WinGadSet);
PROCEDURE CloseWindow(VAR u: Window);
PROCEDURE ModifyWindow(VAR u: Window;
                       newX, newY, newW, newH: INTEGER);
(*
 * if a parameter is -1 then that parameter won't change
 *)

PROCEDURE GetSize(VAR u: Window; VAR l, c: INTEGER);
PROCEDURE XYtoPos(VAR u: Window; xx, yy: INTEGER;
                  VAR l, c: INTEGER);
PROCEDURE SetPos(VAR u: Window; l, c: INTEGER);
PROCEDURE GetPos(VAR u: Window; VAR l, c: INTEGER);

PROCEDURE SetColor(VAR u: Window; fg, bg: INTEGER);
(*
 * no change if fg/bg=-1
 *)

PROCEDURE SetMode(VAR u: Window; m: ModeSet);
PROCEDURE Scroll(VAR u: Window; nr: INTEGER);
(*
 * nr: # of lines;  nr<0: scroll up  nr>0: scroll down
 *)

PROCEDURE Clear(VAR u: Window);
PROCEDURE ClearEOL(VAR u: Window);

PROCEDURE WriteS(VAR u: Window; s: ARRAY OF CHAR);
PROCEDURE WriteC(VAR u: Window; c: CHAR);
PROCEDURE WriteL(VAR u: Window);
(*
 * deletes to end of line
 *)

(* --------------- advanced use ------------------ *)

PROCEDURE SetScreen(scr: IntuitionD.ScreenPtr);
(*
 * default: NIL=Workbench Screen
 *)
PROCEDURE SetClip(VAR u: Window; on: BOOLEAN);

END Windows.def
