XTkXScroller.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, June 9, 1992 6:45 pm PDT
Christian Jacobi, June 12, 1992 12:16 pm PDT
DIRECTORY
Xl USING [Point],
XTk USING [Class, Widget, WidgetSpec];
XTkXScroller: CEDAR DEFINITIONS
~ BEGIN
An XScroller is a widget which can have one child and can scroll the child both vertically and horizontally by simply changing the position of the child.
The X in its name is motivated by the fact that X window positions are directly used to implement the scrolling.
To track the offset, register a notifier on postConfigureKey for the XScroller. (As long as a child exists and is realized, SetOffset will cause a configure.)
XScroller: TYPE = XTk.Widget;
xScrollerClass: READONLY XTk.Class;
A collection sub-class which may have only one child
CreateXScroller: PROC [widgetSpec: XTk.WidgetSpec ¬ [], child: XTk.Widget ¬ NIL, bindx, bindy: BOOL ¬ FALSE] RETURNS [xScroller: XScroller];
Creates a XScroller; the XScroller is the container widget.
IsXScroller: PROC [widget: XTk.Widget] RETURNS [BOOL];
Predicate whether calling GetState, etc. makes sense.
Child: PROC [xScroller: XScroller] RETURNS [child: XTk.Widget];
Returns the current child widget.
ReplaceChild: PROC [xScroller: XScroller, child: XTk.Widget, delayed: BOOL ¬ FALSE, preventDestructionOfOldChild: BOOL ¬ FALSE];
Replaces widget to be used as child; aquires the necessary locks.
GetOffset: PROC [xScroller: XScroller] RETURNS [p: Xl.Point];
Returns the position of the child.
SetOffset: PROC [xScroller: XScroller, p: Xl.Point];
Sets the position of the child.
SetBindXY: PROC [xScroller: XScroller, bindx, bindy: BOOL];
Bind=true means that the dimension of the child is set from container.
Bind=false means that the dimension of the child is set from child.
END.