DIRECTORY XTk USING [Class, Event, TQ, Widget, WidgetSpec]; XTkScrollbar: CEDAR DEFINITIONS ~ BEGIN Scrollbar: TYPE = XTk.Widget; scrollbarClass: READONLY XTk.Class; Direction: TYPE = {horizontal, vertical}; State: TYPE = RECORD [start, next: REAL]; CreateScrollbar: PROC [widgetSpec: XTk.WidgetSpec ¬ [], direction: Direction ¬ vertical, state: State ¬ [0, 1]] RETURNS [Scrollbar]; IsScrollbar: PROC [widget: XTk.Widget] RETURNS [BOOL]; GetDirection: PROC [scrollbar: Scrollbar] RETURNS [direction: Direction]; GetState: PROC [scrollbar: Scrollbar] RETURNS [state: State]; ParentalSetState: PROC [scrollbar: Scrollbar, state: State, event: XTk.Event ¬ NIL]; PublicSetState: PROC [scrollbar: Scrollbar, action: Action, value: REAL, event: XTk.Event ¬ NIL]; stateChanged: READONLY ATOM; -- ¬ $ScrollbarState Action: TYPE = {none, backward, forward, thumb, configure}; ScrollProc: TYPE = PROC [scrollbar: Scrollbar, action: Action, value: REAL, event: XTk.Event, clientData: REF]; SetScrollProc: PROC [scrollbar: Scrollbar, scrollProc: ScrollProc, clientData: REF ¬ NIL, tq: XTk.TQ ¬ NIL]; END.  XTkScrollbar.mesa Copyright Σ 1990, 1991, 1992 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, October 22, 1990 3:28:21 pm PDT Christian Jacobi, June 9, 1992 4:14 pm PDT Simple scrollbar widgets. A scrollbar widget implements a raw scroll bar. It has no knowledge what scrolling means, or, what entity is scrolled. State is simply remembered and painted. If resized, it is the clients business to compute a new state. [start..next) denotes the displayed area, in range [0..1); . Creates a scrollbar widget. Predicate whether calling GetState, etc. makes sense. Returns the direction of a scrollbar. Returns the current state of the scrollbar. Changes current state of the scrollbar; must be called by logical parent only (scroll proc will not be called). Eventually the new state will be displayed. event is optional, it is forwarded to registered notifiers Tries to set the state of the scrollbar; can be called by anybody, e.g. interactively. The proposed state will be forwarded to the scroll proc. event is optional, it is forwarded to the scroll proc Notifiers will be called by ParentalSetState. ScrollProc is the type of the client supplied (filter) procedure which is called when an (maybe interactive) action with a scrollbar occurrs. This procedure is supposed to do the actual work, and, eventually call ParentalSetState to display the new state. Clients ought to make a choice and act on "configure" actions only once, not for both: the general configure notification mechanism, and, this ScrollProc. "action" is the reason this procedure is being called. "value" for interactive backward, forward, thumb in [0..1); for configure: widgetLength. "event" cause of action, if available. Useful for time stamp, breaking recursive calls, etc. "clientData" from registration. Sets a (filter) procedure to handle interactive actions. scrollerProc: called to notify interactions. clientData: passed to scrollerProc. tq: ThreadQueue used to call scrollProc. For NIL, a reasonable choice will be made. ΚI–(cedarcode) style•NewlineDelimiter ™code™Kšœ Οeœ=™HKšœ<™™>—K™šŸœžœ[žœ ˜„™K™——šŸ œžœžœžœ˜7K™5K˜—šŸ œžœžœ˜JK™%K˜—šŸœžœžœ˜>K™+K˜—šŸŸœžœ9žœ˜UK™œKšœ:™:K˜—š ŸŸœžœ(œžœžœ˜bK™XJ™8K™5K˜—šœ œžœžœΟc  ˜1K™.K™—Kšœžœ/˜;š œ žœžœ(œžœ žœ˜oK™€K™›K™6šœ™K™4Kšœ™—K™]Kšœ™—K˜š Ÿ œžœ<žœžœ žœžœ˜lJ™8Kšœ,™,K™#K™T—K˜Kšžœ˜K˜K˜K˜—…—Z±