DEFINITION MODULE Window; (* This module defines types and procedures for manipulating *) (* windows. *) FROM SYSTEM IMPORT ADDRESS; IMPORT Text; IMPORT Screen; TYPE Pixel = INTEGER; (* Defines the units for the virtual display area. The virtual *) (* display area is the total display area available to the *) (* application, a portion of which is viewable through a window. *) (* The coordinates of the virtual display area range from [0,0] *) (* at the upper left corner to [32767,32767] at the lower right *) (* corner. *) TYPE PixelCoordinate = RECORD X : Pixel; Y : Pixel; END; (* Defines a unique point on the virtual display area. *) TYPE Area = RECORD Width : Pixel; Height : Pixel; END; (* Defines a rectangular area on the virtual display. *) TYPE Box = RECORD Origin : PixelCoordinate; Size : Area; END; (* Defines a rectanglar area located at a specific point on *) (* the virtual display area. *) TYPE RedrawRoutineType = PROCEDURE ( Screen.Box ); (* Defines the type for the application's window redraw routine. *) TYPE InformationPtr = POINTER TO Information; TYPE Information = RECORD Predecessor : InformationPtr; Successor : InformationPtr; Id : INTEGER; Name : Text.String80; InformationLine : Text.String80; Components : INTEGER; WorkRegion : Screen.Box; Borders : Screen.Box; BackdropFillStyle : INTEGER; BackdropFillIndex : INTEGER; BackdropContents : INTEGER; VirtualRegionSize : Area; VirtualOrigin : PixelCoordinate; IconList : INTEGER; RedrawRoutine : RedrawRoutineType; END; (* Contains the information for a specific window instance. *) PROCEDURE ScreenPointToWindowPoint ( ScreenPoint : Screen.PixelCoordinate; WindowOrigin : Screen.PixelCoordinate; ScreenOrigin : PixelCoordinate; VAR WindowPoint : PixelCoordinate ); (* Convert a point from screen coordinates to virtual display *) (* coordinates. "Point" is the point to be converted. *) (* "WindowOrigin" is the origin of the window relative to the *) (* physical screen. "ScreenOrigin" is the origin of the window *) (* relative to the virtual display area. *) PROCEDURE WindowPointToScreenPoint ( WindowPoint : PixelCoordinate; ScreenOrigin : PixelCoordinate; WindowOrigin : Screen.PixelCoordinate; VAR ScreenPoint : Screen.PixelCoordinate ); (* Convert a point from virtual display coordinates to screen *) (* coordinates. "Point" is the point to be converted. *) (* "WindowOrigin" is the origin of the window relative to the *) (* physical screen. "ScreenOrigin" is the origin of the window *) (* relative to the virtual display area. *) PROCEDURE ScreenBoxToWindowBox ( ScreenBox : Screen.Box; WindowOrigin : Screen.PixelCoordinate; ScreenOrigin : PixelCoordinate; VAR WindowBox : Box ); (* Convert a region from screen coordinates to virtual display *) (* coordinates. "ScreenBox" is the region to be converted. *) (* "WindowOrigin" is the origin of the window relative to the *) (* physical screen. "ScreenOrigin" is the origin of the window *) (* relative to the virtual display area. *) PROCEDURE WindowBoxToScreenBox ( WindowBox : Box; ScreenOrigin : PixelCoordinate; WindowOrigin : Screen.PixelCoordinate; VAR ScreenBox : Screen.Box ); (* Convert a region from virtual display coordinates to screen *) (* coordinates. "WindowBox" is the region to be converted. *) (* "WindowOrigin" is the origin of the window relative to the *) (* physical screen. "ScreenOrigin" is the origin of the window *) (* relative to the virtual display area. *) PROCEDURE ContainsPoint ( Point : PixelCoordinate; Region : Box ) : BOOLEAN; (* Returns "true" if the region contains the specified point, *) (* or "false" otherwise. *) PROCEDURE Intersected ( Region1 : Box; Region2 : Box; VAR Result : Box ) : BOOLEAN; (* Returns "true" if the two regions intersect, or "false" *) (* otherwise. If the two regions do indeed intersect, "result" *) (* contains the coordinates of the intersection region. *) PROCEDURE Find ( WindowId : INTEGER; VAR WindowPtr : InformationPtr ) : BOOLEAN; (* Given the handle of a window, this routine returns *) (* a pointer to the corresponding window information *) (* structure. This routine returns "true" if the window *) (* was successfully located, or "false" otherwise. *) PROCEDURE Open ( GrowFromBox : Screen.Box; WindowPtr : InformationPtr; WindowName : Text.String80; WindowInformationLine : Text.String80; WindowRegion : Screen.Box; WindowVirtualRegionSize : Area; WindowComponents : INTEGER; WindowFillStyle : INTEGER; WindowFillIndex : INTEGER; WindowContents : INTEGER; WindowRedrawRoutine : RedrawRoutineType ) : BOOLEAN; (* Open a new window. The window appears at the location *) (* specified by "WindowRegion". "WindowVirtualRegionSize" *) (* limits the size of the virtual region available to the *) (* application. "Components" contains the flags identifying *) (* the desired window components. "WindowFillStyle" and *) (* "WindowFillIndex" define the window's backdrop pattern *) (* and style. If the window contents are defined by an object *) (* tree, "WindowContents" contains the index of the object *) (* tree. "WindowRedrawRoutine" contains a pointer to the *) (* routine that will be invoked when the window is to be *) (* redrawn. The open routine returns "true" if a window was *) (* created successfully, or "false" otherwise. *) PROCEDURE Redraw ( WindowId : INTEGER; Region : Screen.Box ); (* Redraw the area of the window specified by "Region". *) PROCEDURE Top ( WindowId : INTEGER ); (* Top the window specified by "WindowId". *) PROCEDURE Resize ( WindowId : INTEGER; NewSize : Screen.Box ); (* Resize the window specified by "WindowId". *) PROCEDURE Move ( WindowId : INTEGER; NewOrigin : Screen.PixelCoordinate ); (* Move the origin of the window to that indicated by *) (* "NewOrigin". *) PROCEDURE Full ( WindowId : INTEGER ); (* If the window does not cover the entire screen, make the *) (* window as large as possible. Otherwise, if the window *) (* already covers the screen, resize the window to it's *) (* size prior to the last "full" message. *) PROCEDURE MoveDisplayArea ( WindowId : INTEGER; Direction : INTEGER ); (* A window directional icon has been clicked, so move the *) (* window over the virtual display area in the corresponding *) (* direction. *) PROCEDURE MoveHorizSlider ( WindowId : INTEGER; NewPosition : INTEGER ); (* The horizontal slider has been moved, so move the window *) (* over the virtual display area in the corresponding direction. *) PROCEDURE MoveVertSlider ( WindowId : INTEGER; NewPosition : INTEGER ); (* The vertical slider has been moved, so move the window over *) (* the virtual display area in the corresponding direction. *) PROCEDURE SetVirtualRegionSize ( WindowId : INTEGER; Size : Area ); (* Establish a new maximum size for the virtual display area. *) PROCEDURE ChangeName ( WindowId : INTEGER; WindowName : Text.String80 ); (* Change the name of the window. *) PROCEDURE ChangeInformationLine ( WindowId : INTEGER; WindowInformationLine : Text.String80 ); (* Change the contents of the window's information line. *) PROCEDURE Close ( WindowId : INTEGER; ShrinkToBox : Screen.Box ); (* Close the window and remove it from the screen. The storage *) (* allocated to the window is then disposed. *) PROCEDURE Unavailable; (* Display an alert indicating that there are no more windows *) (* available to be opened. *) END Window. FileId.Fil