MENUEDWINDOW
An INTERLISP package for manipulating windows with attached menues.
Written by: Steve Gadol
General Comments
MENUEDWINDOW is a package designed to make it easy to manipulate a window and an associated menu as a unit. Standard operations like MOVE, RESHAPE, OPEN and CLOSE are done in a way that it appears to the user as if the window and its menu are a single entity. This kind of facility is especially useful for applications based on browsers and editing. A generalization of the browser window in Lafite was the in fact the primary motivation for creating the package.
Operation
MENUEDWINDOW is found on {Phylum}<LispUsers>MENUEDWINDOW.DCOM
This file is complete and does not load any other code.
The entry point to the facility is the function MAKEMENUEDWINDOW. Its parameters are described below in calling sequence.
MENU: An existing menu may be passed in. Or the items to appear in the menu can be specified as a simple list where each element is a label, or each element can itself be a list in which the CAR is the label to appear in the menu.
WINDOWTITLE: The title for the main window is specified as a string. A value of NIL is allowed. If an existing window is passed as the value of WINDOWSPEC, the title of the that window will be preserved when WINDOWTITLE is NIL.
LOCATION: The position of the menu relative to the main window may be specified as TOP, BOTTOM, RIGHT or LEFT.
WINDOWSPEC: If this parameter is NIL the user will be prompted to specify a region for the menued window. The caller may, however, supply either a region or an existing window in this position.
MENUWINDOWTITLE: A separate title for the menu window may be supplied as a string. For menus at the left or right of the main window doing this produces something that looks reasonable. In the case where the menu is in this position and no title is supplied , the title bar from the main window is extened into the menu area. It isn’t recommended that a title be supplied for menus across the top or bottom of the main window though.
FONT: The caller may specify a font to be used in making the menu. The default font is HELVETICA 10 in BOLD face.
MAKEMENUEDWINOW contains heuristics that constrain the size and shape of the both main and menu windows so that the titles and menu items will fit. Thus the caller need not be concerned that a region or existing window will be too small, or that the user may specify something that is not useable.
This function returns the main window of the pair. The binding between the window and the menu is done with WINDOWPROPS as described next.
Notes
The main and menu windows are bound togeter by WINDOWPROPS. The menu is stored under the WINDOWMENU property of the main window, and the window containing the menu is under the MENUWINDOW property. Given the menu window you can get to the main window by retrieving its MAINWINDOW property.
The main window has other properties that are used by the remaining function in the package. The minimum width for the menu and reletive position of the menu window are saved under the menu window’s MINWIDTH and MENUPOSITION properties. The properties AFTERMOVEFN, RESHAPEFN, CLOSEFN, OPENFN, SHRINKFN, and EXPANDFN contain code that implements the corresponding window manipulation functions. Care should be used in modifying or replacing these properties.