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
= 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: ROPE ← NIL, format: ROPE ← NIL,
looks: ROPE ← NIL, proc: TiogaButtons.TiogaButtonProc, clientData: REF ANY ← NIL,
fork: BOOL ← TRUE, paint: BOOL ← TRUE ] 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: INT ← INT.LAST,
proc: TiogaButtons.TiogaButtonProc ← NIL, clientData: REF ANY ← NIL,
fork:
BOOL ←
TRUE]
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: ROPE ← NIL, looks: ROPE ← NIL,
proc: TiogaButtons.TiogaButtonProc ←
NIL, clientData:
REF
ANY ←
NIL, fork:
BOOL ←
TRUE]
RETURNS [TiogaButtons.TiogaButton] = {
RETURN[TiogaButtons.AppendToButton[
button, rope, looks, UserClick,
NEW[MyClickInfoObj ← [proc, clientData, q]],
fork]];
};
END.