XTkScroller.mesa
Copyright Ó 1990, 1991 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, October 22, 1990 3:28:21 pm PDT
Christian Jacobi, March 7, 1991 6:49 pm PST
DIRECTORY
XTk USING [Class, Event, TQ, Widget, WidgetSpec];
Simple scroll-bar widgets.
State is simply remembered and painted. If resized it is the clients business to compute new state. On interactive actions the client simply sets new state and performs scrolling in synch...
XTkScroller: CEDAR DEFINITIONS
~ BEGIN
Scroller: TYPE = XTk.Widget;
scrollerClass: READONLY XTk.Class;
Direction: TYPE = {horizontal, vertical}; --order may change
State: TYPE = RECORD [start, next: REAL];
[start..next) denotes the displayed area, in range [0..1); .
CreateScroller: PROC [widgetSpec: XTk.WidgetSpec ¬ [], direction: Direction ¬ vertical, state: State ¬ [0, 1]] RETURNS [Scroller];
Creates a scroller widget.
GetDirection: PROC [scroller: Scroller] RETURNS [direction: Direction];
... returns the direction of a scroller.
GetState: PROC [scroller: Scroller] RETURNS [state: State];
... returns the current state of the scroller.
SetState: PROC [scroller: Scroller, state: State, propagate: BOOL ¬ FALSE];
... sets the state of the scroller.
setStateCalled: READONLY ATOM; -- ¬ $ScrollerSetStateCalled
Notifiers called on SetState with propagate=TRUE.
Action: TYPE = {none, backward, forward, thumb, configure};
ScrollProc: TYPE = PROC [scroller: Scroller, action: Action, value: REAL, event: XTk.Event, clientData: REF];
ScrollProc is the type of the client supplied procedure which is called when an interactive action with a scroller occurred. Called on "tq"; clients probably want to act on resize only once, not for both, the general configure notification, and, this resize.
"action" is the reason the client procedure is being called.
"value"
for backward, forward, thumb in [0..1);
for configure: widgetLength.
"event" X event causing action (NIL if not available); useful for time stamp...
"clientData" from registration.
InteractiveRegistrations: PROC [scroller: Scroller, scrollerProc: ScrollProc, clientData: REF ¬ NIL, tq: XTk.TQ ¬ NIL];
clientData: passed to client procedures.
scrollerProc: called to notify interactions.
tq: ThreadQueue used for scrollerProc. NIL for rootThread.
END.