MBQueue.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created by: Cattell and Haugeland on October 21, 1982 9:11 am
Last edited by: Cattell on October 21, 1982 9:11 am
Last edited by: MBrown on October 21, 1982 6:22 pm
Last Edited by: Maxwell, December 17, 1982 10:06 am
Swinehart, August 5, 1985 11:47:11 am PDT
Doug Wyatt, April 14, 1985 11:34:53 pm PST
Provides Menu items and Buttons that are automatically serialized.
DIRECTORY
Buttons USING [Button, ButtonProc],
Imager USING [Font],
List USING [ AList ],
Menus USING [MenuEntry, MenuProc, MouseButton],
Rope USING [ROPE],
ViewerClasses USING [ViewerRec];
MBQueue: CEDAR DEFINITIONS
= BEGIN
Queue: TYPE = REF QueueObj;
QueueObj: TYPE;
Create: PROC [pushModel: BOOLTRUE, propList: List.AList ← NIL] RETURNS [Queue];
Creates a queue, a context in which mouse buttons are serialized. All menu item and
mouse button procs defined in the context of this queue will be strictly serialized, i.e.
the procs will be called in the order that the user clicked, and each proc will completely
finish execution before the next one starts.
If pushModel = FALSE, then actions are to be removed from the queue by a client process,
using DequeueAction (below), rather than by this package.
If pushModel = TRUE, client actions will be invoked by a process that will include propList on its property list.
The client process should be prepared to handle ABORTED.
CreateMenuEntry: PROC [q: Queue,
name: Rope.ROPE,
proc: Menus.MenuProc,
clientData: REF ANYNIL,
documentation: REF ANYNIL,
fork: BOOLTRUE,
guarded: BOOLFALSE
] RETURNS [Menus.MenuEntry];
Identical to Menus.CreateEntry, except for the first argument q. Defines a menu item that is interpreted in the context of q.
CreateButton: PROC [q: Queue,
info: ViewerClasses.ViewerRec ← [],
proc: Buttons.ButtonProc,
clientData: REF ANYNIL,
fork: BOOLTRUE,
font: Imager.Font ← NIL,
documentation: REF ANYNIL,
guarded: BOOLFALSE,
paint: BOOLTRUE
] RETURNS [Buttons.Button];
Identical to Buttons.Create, except for the first argument q. Defines a button that is interpreted in the context of q.
QueueClientAction: PROC [q: Queue, proc: PROC [REF ANY], data: REF ANY];
Allows client to queue actions other than the menu item clicks and button clicks, which
are user-initiated. The client's proc will be called after any user clicks before the call,
and before any user clicks after the call.
Action: TYPE = RECORD [
SELECT type: * FROM
client => [
proc: PROC [REF ANY],
data: REF ANY
],
user => [
proc: Menus.MenuProc,
parent: REF ANY, clientData: REF ANY,
mouseButton: Menus.MouseButton, shift, control: BOOL
]
ENDCASE
];
DequeueAction: PROC [q: Queue] RETURNS [Action];
Waits for an action to appear, then returns it.
Called only for "pull model" queues.
Flush: PROC [q: Queue];
Flushes all pending button presses and menu selections in the context of q. This procedure
can be called, e.g., when some illegal actions suggests the user is confused an further
mouse-ahead should be ignored.
FlushWithCallback: PROC [q: Queue, proc: PROC[Action] ← NIL];
Like Flush, but applies proc to each action being flushed.
END.