XTkXBiScroller.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, June 9, 1992 6:45 pm PDT
Christian Jacobi, June 11, 1992 2:13 pm PDT
DIRECTORY
Xl USING [Point, Size],
XTk USING [Class, dontUse, Event, Widget, WidgetSpec];
XTkXBiScroller: CEDAR DEFINITIONS
~ BEGIN
An XBiScroller is a widget which has a "useful" area (the child) which can be scrolled both vertically and horizontally with the use of two scroll bars. Scrolling is done by simply changing the position of the child. The X in its name is due to the fact that X window positions are directly used to implement the scrolling.
XBiScroller: TYPE = XTk.Widget;
xBiScrollerClass: READONLY XTk.Class;
A collection sub-class which may have only one child
CreateXBiScroller: PROC [widgetSpec: XTk.WidgetSpec ¬ [], child: XTk.Widget ¬ NIL, insideSize: Xl.Size ¬ [XTk.dontUse, XTk.dontUse], vsbar, hsbar: BOOL ¬ TRUE] RETURNS [xBiScroller: XBiScroller];
Creates a XBiScroller; the XBiScroller is the outer widget which is the container for the scroll bars and the child. The child is the widget which displays the actual information.
insideSize: If specified, widgetSpec.size is overwritten with insideSize+Size[ScrollBar]
vsbar: Make a vertical scroll bar
hsbar: Make a horizontal scroll bar
IsXBiScroller: PROC [widget: XTk.Widget] RETURNS [BOOL];
Predicate whether calling GetState, etc. makes sense.
Child: PROC [xBiScroller: XBiScroller] RETURNS [child: XTk.Widget];
Returns the current child widget.
ReplaceChild: PROC [xBiScroller: XBiScroller, child: XTk.Widget, delayed: BOOL ¬ FALSE, preventDestructionOfOldChild: BOOL ¬ FALSE];
Replaces widget to be used as child; aquires the necessary locks.
GetState: PROC [xBiScroller: XBiScroller] RETURNS [p: Xl.Point];
Returns the current scroll state of the xscroller.
DirectSetState: PROC [xBiScroller: XBiScroller, p: Xl.Point, event: XTk.Event ¬ NIL];
Sets the scroll state of the xscrollers; must be called by logical parent only (filter proc will not be called). Eventually the child will be configured to display the new state; aquires the necessary locks.
event is optional, it is forwarded to registered notifiers
PublicSetState: PROC [xBiScroller: XBiScroller, p: Xl.Point, event: XTk.Event ¬ NIL];
Tries to set the scroll state of the xscrollers; can be called by anybody, e.g. interactively.
The proposed state will be forwarded to the filter proc.
event is optional, it is forwarded to the scroll proc
stateChangedLR: READONLY ATOM;
Notifiers will be called by ParentalSetState.
LR: notifcation from within the rootTq lock.
FilterProc: TYPE = PROC [xBiScroller: XBiScroller, p: Xl.Point, filterData: REF, event: XTk.Event];
FilterProc is the type of the client supplied filter procedure which is called when an interactive action with a XBiScroller occurred; it is supposed to deny, accept, or, change the request. Acceptance or change must be implemented by calling DirectSetState.
"event" passed through, if available.
SetFilterProc: PROC [xBiScroller: XBiScroller, filterProc: FilterProc, filterData: REF ¬ NIL];
Registers a procedure to be called to filter proposed scroll positions. A nil proc is like accepting all proposed values.
END.