InputFocus.mesa
Copyright Ó 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved.
Last Edited by McGregor, August 17, 1982 10:43 am
Last Edited by: Maxwell, December 17, 1982 10:00 am
Bier, November 15, 1988 12:11:32 pm PST
Doug Wyatt, January 19, 1987 10:40:21 pm PST
Willie-s, October 9, 1991 4:53 pm PDT
DIRECTORY
ViewerClasses USING [NotifyProc, TIPTable, Viewer];
InputFocus: CEDAR DEFINITIONS = BEGIN
Focus: TYPE = REF FocusRec;
FocusRec: TYPE = RECORD [
owner: Viewer ¬ NIL, -- Viewer associated with this focus.
info: REF ¬ NIL, -- focus data private to the owner.
link: PRIVATE Focus ¬ NIL -- focus stack overhead.
];
NotifyProc: TYPE = ViewerClasses.NotifyProc;
TIPTable: TYPE = ViewerClasses.TIPTable;
Viewer: TYPE = ViewerClasses.Viewer;
GetInputFocus: PROC RETURNS [Focus];
Returns a REF to the Current Focus, i.e. the focus on the top of the focus stack.
SetInputFocus: PROC [self: Viewer ¬ NIL, info: REF ¬ NIL];
Sets focus stack to self and calls the modify proc of the Current Focus with {kill}.
PushInputFocus: PROC [self: Viewer ¬ NIL, info: REF ¬ NIL];
Pushes self on top of focus stack and calls modify proc of the Current Focus with {push}.
PopInputFocus: PROC;
Pops the focus stack and calls the modify proc of the old Focus with {kill}, then calls the new Focus (if any) modify proc with {pop}.
CaptureButtons: PROC [proc: NotifyProc, tip: TIPTable, viewer: Viewer ¬ NIL,
captureKeyboard: BOOL ¬ FALSE];
A client may register with the InputFocus mechanism to capture all button events, without regard to the mouse position (useful for growing windows, etc.) Registration is reset by calling ReleaseButtons below. Note that mouse coordinates passed to the NotifyProc will be screen relative rather than relative to any particular viewer. See ViewerOps.MouseInViewer should you require mapping to a particular viewer.
ReleaseButtons: PROC = INLINE { CaptureButtons[NIL, NIL, NIL, TRUE] };
CaptureButtons2: PROC [proc: WideNotifyProc, tip: TIPUser.TIPTable, viewer: Viewer ¬ NIL, captureKeyboard: BOOL ¬ TRUE];
END.