DEFINITION MODULE FormMgr;

(*
AES Form Manager.

UK __DATE__ __TIME__
*)

(*DEF_SWITCHES*)

FROM PORTAB IMPORT SIGNEDWORD,UNSIGNEDWORD,ANYPOINTER;
FROM RcMgr  IMPORT GRect;

IMPORT AES;

#if export
EXPORT QUALIFIED TreePtr,ObjectIndex,FormDo,FormDials,FormDial,FormAlert,
                 NoFile,NoMemory,FormError,FormCenter,Key,ObjectPtr,
                 FormKeybd,FormButton,
                 formdo,formdial,formalert,formcenter;
#endif

(* [Form] Manager: [Do] Form Input, AES(50) ********************************)

TYPE TreePtr = AES.TreePtr;

     ObjectIndex = AES.ObjectIndex;

VAR FormDo: PROCEDURE(TreePtr,ObjectIndex): SIGNEDWORD;

(* [Form] Manager: [Dial] A Form Progress, AES(51) *************************)

TYPE FormDials = (FmDStart,    (* [F]or[mD]ial: Dial [Start] Form     *)
                  FmDGrow,     (* [F]or[mD]ial: Dial [Grow]ing Form   *)
                  FmDShrink,   (* [F]or[mD]ial: Dial [Shrink]ing Form *)
                  FmDFinish,   (* [F]or[mD]ial: Dial [Finish] Form    *)
                  FmDAStart,   (*                                     *)
                  FmDAFinish); (*                                     *)

VAR FormDial: PROCEDURE(FormDials, VAR GRect, VAR GRect);

(* [Form] Manager: Do [Alert] Form Input, AES(52) **************************)

VAR FormAlert: PROCEDURE(UNSIGNEDWORD,ANYPOINTER): UNSIGNEDWORD;

(* [Form] Manager: Do [Error] Form Input, AES(53) **************************)

#if GEMDOS
CONST NoFile   = -33;
      NoMemory = -39;
#elif PCDOS
CONST NoFile   = 2;
      NoMemory = 8;
#elif UNIX
CONST NoFile   = -33;
      NoMemory = -39;
#endif

PROCEDURE FormError(Error: SIGNEDWORD);

(* [Form] Manager: [Center] Form, AES(54) **********************************)

VAR FormCenter: PROCEDURE(TreePtr, VAR GRect);

(* [Form] Manager: Filter [Keyb]oar[d] Input, AES(55) **********************)

TYPE Key = AES.Key;

     ObjectPtr = AES.ObjectPtr;

PROCEDURE FormKeybd(    PTree : TreePtr;
                        Ob    : ObjectIndex;
                        NextOb: ObjectPtr;
                        InKey : Key;
                    VAR NewOb : ObjectPtr;
                    VAR OutKey: Key): BOOLEAN;

(* [Form] Manager: Handle Mouse [Button] Input, AES(56) ********************)

PROCEDURE FormButton(    PTree : TreePtr;
                         Ob    : ObjectPtr;
                         Clicks: UNSIGNEDWORD;
                     VAR NextOb: ObjectPtr): BOOLEAN;

(***************************************************************************)

PROCEDURE formdo(PTree: TreePtr;
                 Start: ObjectIndex): SIGNEDWORD;

PROCEDURE formdial(    Dial: FormDials;
                   VAR From: GRect;
                   VAR To  : GRect);

PROCEDURE formalert(DefBut  : UNSIGNEDWORD;
                    PAlrtStr: ANYPOINTER): UNSIGNEDWORD;

PROCEDURE formcenter(    Tree: TreePtr;
                     VAR Rect: GRect);

END FormMgr.
