DEFINITION Dialogs; (* SJ  30.1.93 *)

(* Dialogs contains procedures for dialog box handling. You can assign
   procedures to exit buttons and call the dialog handler, the rest is
   done automatically.
*)

CONST
  DESELECT* = 0; EXITONLY* = 1; DELETEBOX* = 2; NEWBOX* = 3; REDRAWBOX* = 4;
  REDRAWOBJ* = 5; EXITDIALOG* = 6;

(* these bits determine what Dialog.Do should do before and after calling
   the exit procedure :
   DESELECT   : deselect object before call
   EXITONLY   : delete box and exit dialog before call
   DELETEBOX  : delete box before call
   NEWBOX     : delete box before call, redraw box after call
   REDRAWBOX  : redraw box after call
   REDRAWOBJ  : redraw exit object after call
   EXITDIALOG : delete box and exit dialog after call
*)


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

                PROCEDURE(d : Dialog) Init*(objTree : S.PTR);
                  (* initialize a dialog *)

                PROCEDURE(d : Dialog) Show*;
                  (* displays the dialog box in the center of the screen.
                     Ment for messages without interaction of the user.
                     Window update is switched on *)

                PROCEDURE(d : Dialog) Delete*;
                  (* deletes the dialog box that was placed with Show.
                     Window update is switched off. Must be called
                     before using Show a second time *)

                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 *)

                PROCEDURE(d : Dialog) SetWork*(obj : INTEGER; proc : Proc;
                                               workSet : SET);
                 (* stores the work that will be done and the procedure
                    called if object obj in dialog d is selected *)

                PROCEDURE(d : Dialog) Do* (StartOb : INTEGER);
                 (* dialog with user. StartOb is the object to start
                    edit with. If an exit object is selected, the
                    corresponding actions defined with Set are done.
                    If nothing is set, the object is deselected, the
                    box deleted and Do terminated *)
              END;


END Dialogs.
