TBQueueImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Willie-Sue, May 9, 1985 9:49:07 am PDT
Contents: impl'n of TBQueue - modeled after MBQueueImpl
DIRECTORY
MBQueue,
MBQueuePrivate,
TBQueue USING [],
Rope USING [ROPE],
TiogaButtons USING [TiogaButtonProc, TiogaButton,
AppendToButton, CreateButton, CreateButtonFromNode],
TiogaOps USING [Ref],
ViewerClasses USING [Viewer];
TBQueueImpl: CEDAR PROGRAM
IMPORTS
MBQueuePrivate, TiogaButtons
EXPORTS
MBQueue, TBQueue
= BEGIN OPEN MBQueue, MBQueuePrivate;
QueueObj: PUBLIC TYPE ~ MBQueuePrivate.QueueObj; -- export concrete type to MBQueue
Viewer: TYPE = ViewerClasses.Viewer;
ROPE: TYPE = Rope.ROPE;
A Queue represents a context for button clicks. It contains a list of pending events.
If pushModel, then notifierRunning is a BOOL that indicates whether or not a process
is currently processing an event. (notifierRunning is ignored if NOT pushModel).
If NOT pushModel, then newEvent is a CONDITION on which a client process may
wait for the next event to occur. (newEvent is ignored if pushModel).
MyClickInfo is stored in the clientData field maintained by Viewers. Since we assign
an MBQueue ClickProc and clientData with the button, we need this record to save the
real clientData and ClickProc. We also save the queue, so we know the context of the click.
Public procedures
CreateTiogaButton: PUBLIC PROC [
q: Queue, viewer: ViewerClasses.Viewer, rope: ROPENIL, format: ROPENIL,
looks: ROPENIL, proc: TiogaButtons.TiogaButtonProc, clientData: REF ANYNIL,
fork: BOOLTRUE, paint: BOOLTRUE ] RETURNS [TiogaButtons.TiogaButton] = {
RETURN[TiogaButtons.CreateButton[
viewer, rope, format, looks, UserClick,
NEW[MyClickInfoObj ← [proc, clientData, q]],
fork]]
};
CreateTiogaButtonFromNode: PUBLIC PROC [
q: Queue, node: TiogaOps.Ref, start: INT ← 0, end: INTINT.LAST,
proc: TiogaButtons.TiogaButtonProc ← NIL, clientData: REF ANYNIL,
fork: BOOLTRUE] RETURNS [TiogaButtons.TiogaButton] = {
RETURN[TiogaButtons.CreateButtonFromNode[
node, start, end, UserClick,
NEW[MyClickInfoObj ← [proc, clientData, q]],
fork]];
};
AppendToTiogaButton: PUBLIC PROC [
q: Queue, button: TiogaButtons.TiogaButton, rope: ROPENIL, looks: ROPENIL,
proc: TiogaButtons.TiogaButtonProc ← NIL, clientData: REF ANYNIL, fork: BOOLTRUE]
RETURNS [TiogaButtons.TiogaButton] = {
RETURN[TiogaButtons.AppendToButton[
button, rope, looks, UserClick,
NEW[MyClickInfoObj ← [proc, clientData, q]],
fork]];
};
END.