DEFINITION MODULE AES;

FROM SYSTEM IMPORT ADDRESS;


(* ---------------------------------------------------------------------- *)

(* AES Application Library interface *)



PROCEDURE ApplInitialise (): INTEGER;

(* Initialise application. Returns ApId *)


PROCEDURE ApplRead (Id, Length: INTEGER; PBuff: ADDRESS);

(* Read from a message pipe. Returns coded return message, 0 = error *)


PROCEDURE ApplWrite (Id, Length: INTEGER; PBuff: ADDRESS);

(* Write to a message pipe. Returns coded return message, 0 = error *)


PROCEDURE ApplFind (VAR FPname: ARRAY OF CHAR): INTEGER;

(* Find the Id of another application in the system. *)


PROCEDURE ApplTPlayback (TpMem: ADDRESS;
                          TpNum, TpScale: INTEGER);

(* Play back a piece of GEM AES recording of user's actions. *)


PROCEDURE ApplTRecord (TrMem: ADDRESS; TrNum: INTEGER);

(* Record the next ApTrNum user actions. Returns number recorded. *)


PROCEDURE ApplExit;

(* Exit application. *)



(* ---------------------------------------------------------------------- *)

(* AES Event Library interface *)



PROCEDURE EventKeyboard (): INTEGER;

(* Wait for keyboard input. *)


PROCEDURE EventButton (Clicks, BMask, BState: INTEGER;
                        VAR BmX, BmY, BButton, Bkstate: INTEGER): INTEGER;

(* Wait for a mouse action. *)


PROCEDURE EventMouse (MoFlags, MoX, MoY, MoWidth, MoHeight: INTEGER;
                       VAR MomX, MomY, MoButton, MokState: INTEGER);

(* Wait for mouse to enter or leave a specified rectangle. *)


PROCEDURE EventMessage (PBuff: ADDRESS);

(* Wait for 16 bit message from the message pipe. *)


PROCEDURE EventTimer (LoCount, HiCount: INTEGER);

(* Wait for time to pass *)


PROCEDURE EventMultiple (Flags, Clicks, Mask, State, 
                          M1Flags, M1X, M1Y, M1Width, M1Height,
                          M2Flags, M2X, M2Y, M2Width, M2Height: INTEGER;
                          PBuff: ADDRESS;
                          LoCount, HiCount: INTEGER;
                      VAR MoX, MoY, MoButton, MokState, 
                          KReturn, BReturn: INTEGER): INTEGER;

(* Wait for multiple events. *)


PROCEDURE EventDoubleClick (New, GetOrSet: INTEGER): INTEGER;

(* Set or Get double click speed. *)



(* ---------------------------------------------------------------------- *)

(* AES Forms Library interface *)



PROCEDURE FormDo (Tree: ADDRESS; StartOb: INTEGER): INTEGER;

(* Causes the form library to monitor a users interaction with a form *)


PROCEDURE FormDialogue (Flag, LIX, LIY, LIW, LIH,
                        BIX, BIY, BIW, BIH: INTEGER);

(* Multi forms action according to flag *)


PROCEDURE FormAlert (DefButton: INTEGER; VAR String: ARRAY OF CHAR): INTEGER;

(* Displays an alert *)


PROCEDURE FormError (ErrorNum: INTEGER): INTEGER;

(* Displays an error *)


PROCEDURE FormCenter (Tree: ADDRESS; VAR X, Y, W, H: INTEGER);

(* Centers a dialog box on the screen *)



(* ---------------------------------------------------------------------- *)

(* File Selector Library interface *)


PROCEDURE FileSelectorInput (InPath, InSel: ADDRESS; VAR ExButton: INTEGER);



(* ---------------------------------------------------------------------- *)

(* AES Graphics Library interface *)



PROCEDURE GrafRubberBox (X, Y, MinWidth, MinHeight: INTEGER;
                         VAR LastWidth, LastHeight: INTEGER);

(* Draws a "rubber box" *)


PROCEDURE GrafDragBox (Width, Height, StartX, StartY, BoundX, BoundY,
                       BoundW, BoundH: INTEGER;
                       VAR FinishX, FinishY: INTEGER);

(* Allow user to drag a box *)


PROCEDURE GrafMoveBox (Width, Height, 
                       SourceX, SourceY, DestX, DestY: INTEGER);

(* Draws a moving box *)


PROCEDURE GrafGrowBox (StX, StY, StWidth, StHeight,
                       FinX, FinY, FinWidth, FinHeight: INTEGER);

(* Draws an expanding box outline *)


PROCEDURE GrafShrinkBox (FinX, FinY, FinWidth, FinHeight,
                         StX, StY, StWidth, StHeight: INTEGER);

(* Draws an shrinking box outline *)


PROCEDURE GrafWatchBox (Tree: ADDRESS; Object, InState, OutState: INTEGER):
                        INTEGER;

(* Tracks mouse in and out of box *)


PROCEDURE GrafSlideBox (Tree: ADDRESS; 
                        Parent, Object, VH: INTEGER): INTEGER;

(* Tracks sliding box in a parent box *)


PROCEDURE GrafHandle (VAR WChar, HChar, WBox, HBox: INTEGER): INTEGER;

(* Gets the GEM VDI handle *)


PROCEDURE GrafMouse (Number: INTEGER; Faddr: ADDRESS);

(* Changes to mouse *)


PROCEDURE GrafMouseKeyboardState (VAR MX, MY, MState, KState: INTEGER);

(* Return mouse loc and state *)



(* ---------------------------------------------------------------------- *)

(* AES Menu Library interface *)



PROCEDURE MenuBar (Tree: ADDRESS; Show: INTEGER);

(* Display or erase current menu bar *)


PROCEDURE MenuItemCheck (Tree: ADDRESS; Item, Check: INTEGER);

(* Display or erase a check mark next to a menu item *)


PROCEDURE MenuItemEnable (Tree: ADDRESS; Item, Enable: INTEGER);

(* Enables or disables a menu item *)


PROCEDURE MenuTitleNormal (Tree: ADDRESS; Title, Normal: INTEGER);

(* Displays a menu title in normal or reverse video *)


PROCEDURE MenuText (Tree: ADDRESS; Item: INTEGER; Text: ADDRESS);

(* Changes the text of a menu item *)


PROCEDURE MenuRegister (Apid: INTEGER; VAR PString: ARRAY OF CHAR): INTEGER;

(* Place desk accessorie's text in a menu *)



(* ---------------------------------------------------------------------- *)

(* AES Object library interface *)



PROCEDURE ObjectAdd (Tree: ADDRESS; Parent, Child: INTEGER);

(* Adds and object to the object tree *)


PROCEDURE ObjectDelete (Tree: ADDRESS; Object: INTEGER);

(* Delete an object from an object tree *)


PROCEDURE ObjectDraw (Tree: ADDRESS; StartOb, Depth, XClip, YClip,
                      WClip, HClip: INTEGER);

(* Draws any object(s) in the object tree *)


PROCEDURE ObjectFind (Tree: ADDRESS; 
                      StartOb, Depth, MX, MY: INTEGER): INTEGER;

(* Finds an object under the mouse form *)


PROCEDURE ObjectOffset (Tree: ADDRESS; Object: INTEGER;
                        VAR Xoff, Yoff: INTEGER);

(* Computes an objects X and Y coords relative to the screen *)


PROCEDURE ObjectOrder (Tree: ADDRESS; Object, NewPos: INTEGER);

(* Moves an object within its parents list *)


PROCEDURE ObjectEdit (Tree: ADDRESS; 
                      Object, Char, IdX, Kind: INTEGER;
                      VAR NewIdX: INTEGER);

(* Allow user to edit text in an object *)


PROCEDURE ObjectChange (Tree: ADDRESS; 
                        Object, resrvd, XClip, YClip, WClip, HClip,
                        NewState, Redraw: INTEGER);

(* Changes an objects State value *)



(* ---------------------------------------------------------------------- *)

(* Resource library interface *)



PROCEDURE ResourceLoad (VAR FName: ARRAY OF CHAR);

(* Load a resource file *)


PROCEDURE ResourceFree;

(* Free loaded space *)


PROCEDURE ResourceGetAddr (Type, Index: INTEGER; VAR Addr: ADDRESS);

(* Get address of resource *)


PROCEDURE ResourceSetAddr (Type, Index: INTEGER;
                           Addr: ADDRESS);

(* Set address of resource *)


PROCEDURE ResourceObjectFix (Tree: ADDRESS; Object: INTEGER);

(* Convert object's character x,y to pixel x,y *)



(* ---------------------------------------------------------------------- *)

(* Scrap Library interface *)



PROCEDURE ScrapRead (Scrap: ADDRESS);

(* Reads the current scrap directory *)


PROCEDURE ScrapWrite (Scrap: ADDRESS);

(* Writes the current scrap directory *)



(* ---------------------------------------------------------------------- *)

(* Shell Library interface *)



PROCEDURE ShellRead (Command, Tail: ADDRESS);


PROCEDURE ShellWrite (DoEx, IsGr, IsCr: INTEGER; Command, Tail: ADDRESS);


PROCEDURE ShellFind (Buff: ADDRESS);


PROCEDURE ShellEnvrn (Value, Param: ADDRESS);



(* ---------------------------------------------------------------------- *)

(* Window Library interface *)



PROCEDURE WindowCreate (Kind, WX, WY, WW, WH: INTEGER): INTEGER;

(* Create window *)


PROCEDURE WindowOpen (Handle, WX, WY, WW, WH: INTEGER);

(* Open window *)


PROCEDURE WindowClose (Handle: INTEGER);

(* Close a window *)


PROCEDURE WindowDelete (Handle: INTEGER);

(* Delete window and free space *)


PROCEDURE WindowGet (Handle, Field: INTEGER;
                     VAR W1, W2, W3, W4: INTEGER);

(* Gets info of a window *)


PROCEDURE WindowSet (Handle, Field, W1, W2, W3, W4: INTEGER);

(* Sets info of a window *)


PROCEDURE WindowFind (MX, MY: INTEGER): INTEGER;

(* Find window under mouse *)


PROCEDURE WindowUpdate (BegEnd: INTEGER);

(* Update window *)


PROCEDURE WindowCalc (Type, Kind, InX, InY, InW, InH: INTEGER;
                      VAR OutX, OutY, OutW, OutH: INTEGER);

(* Calc window *)


END AES.
