DEFINITION WindowDialog;


(* this is the new object oriented version of WindowDialog.
*)


IMPORT WinView;


CONST (* work bits *)
  DESELECT* = 0; EXITONLY* = 1; REDRAWOBJ* = 5; EXITDIALOG* = 6;
(* these bits determine what to do if an exit object is chosen :
   DESELECT  : deselect exit object before calling exit procedure (no redraw).
   EXITONLY  : no call of exit procedure, close window.
   REDRAWOBJ : redraw exit object after calling exit procedure.
   EXITDIALOG: close window after calling exit procedure.
*)


TYPE
  Proc*     = PROCEDURE;
  Dialog*   = POINTER TO DialDesc;
  DialDesc* = RECORD(WinView.ViewDesc)
                objTree- : S.PTR;

                PROCEDURE(d : Dialog) SetCursor*(obj : INTEGER);
                  (* sets the cursor in editable object obj *)

                PROCEDURE(d : Dialog) RedrawObj*(obj : INTEGER);
                  (* redraws an objects and its children. *)

                PROCEDURE(d : Dialog) SetText*(obj : INTEGER;
                                               str : ARRAY OF CHAR);
                  (* writes str into the text of object obj and redraws
                     it if window is open *)

                PROCEDURE(d : Dialog) SetWork*(obj : INTEGER; proc : Proc;
                                               WorkSet : SET);
                  (* stores the work that will be done if object obj in
                     viewer v is selected *)

                PROCEDURE(d : Dialog) SetPos*(x,y : INTEGER);
                  (* sets the position of the dialog. If its viewer is
                     opened, it will be moved *)

                PROCEDURE(d : Dialog) InitDialog*(Tree : S.PTR;
                               editStart : INTEGER; useCloser : BOOLEAN);
                  (* initializes the dialog and the viewer it uses.
                     Sets the object tree which contains the dialog box
                     and centers it. If not desired, change the position
                     using d.SetPos afterwards. editStart is the index of
                     an editable object to start editing when first
                     opening the dialog. If useCloser is true, the window
                     will have a close button *)

              END;


VAR exit*    : BOOLEAN;
    (* if an exit procedure sets 'Exit' to TRUE, Dialog.Do terminates *)
    exitBut* : INTEGER;
    (* contains the object number of the exit object *)



END WindowDialog.
