XTkBiScrollerFrame.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 11, 1992 2:28 pm PDT
DIRECTORY
Xl USING [Size],
XTk USING [Class, dontUse, Event, TQ, Widget, WidgetSpec];
XTkBiScrollerFrame: CEDAR DEFINITIONS
~ BEGIN
A BiScrollerFrame 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. The child is not really scrolled automatically, but the implementor of the child is supposed to provide the illusion of scrolling.
BiScrollerFrame: TYPE = XTk.Widget;
biScrollerFrameClass: READONLY XTk.Class;
State1: TYPE = RECORD [start, next: REAL];
State2: TYPE = RECORD [h, v: State1];
CreateBiScrollerFrame:
PROC [widgetSpec: XTk.WidgetSpec ¬ [], child: XTk.Widget ¬
NIL, insideSize: Xl.Size ¬ [XTk.dontUse, XTk.dontUse], vsbar, hsbar:
BOOL ¬
TRUE]
RETURNS [biScrollerFrame: BiScrollerFrame];
Creates a BiScrollerFrame; the BiScrollerFrame 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
IsBiScrollerFrame:
PROC [widget: XTk.Widget]
RETURNS [
BOOL];
Predicate whether calling GetState, etc. makes sense.
Child:
PROC [biScrollerFrame: BiScrollerFrame]
RETURNS [child: XTk.Widget];
Returns the current child widget.
ReplaceChild:
PROC [biScrollerFrame: BiScrollerFrame, child: XTk.Widget, delayed:
BOOL ¬
FALSE, preventDestructionOfOldChild:
BOOL ¬
FALSE];
Replaces widget to be used as child; aquires the necessary locks.
GetState:
PROC [biScrollerFrame: BiScrollerFrame]
RETURNS [state: State2];
Returns the current scroll state of the bi-scrollers scroll bars.
ParentalSetState:
PROC [biScrollerFrame: BiScrollerFrame, state: State2, event: XTk.Event ¬
NIL];
Sets the scroll state of the scroll bars; 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
PublicSetState:
PROC [biScrollerFrame: BiScrollerFrame, hAction, vAction: Action, x, y:
REAL, event: XTk.Event ¬
NIL];
Tries to set the scroll state of the scroll bars; 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
stateChanged:
READONLY
ATOM;
-- $BiScrollerFrameState
Notifiers will be called by ParentalSetState.
Action: TYPE = {none, backward, forward, thumb, configure};
ScrollProc:
TYPE =
PROC [biScrollerFrame: BiScrollerFrame, hAction, vAction: Action, x, y:
REAL, event: XTk.Event, clientData:
REF];
ScrollProc is the type of the client supplied procedure which is called when an interactive action with a BiScrollerFrame occurred.
"hAction, vAction" is the reason the client procedure is being called.
It may or may not be possible that actions on both axis are reported in two separate calls.
"x, y"
in [0..1) for backward, forward, thumb;
widgetLength for configure.
"event" X event causing action (NIL if not available); useful for time stamp...
"clientData" from registration.
SetScrollProc:
PROC [biScrollerFrame: BiScrollerFrame, scrollProc: ScrollProc, clientData:
REF ¬
NIL, tq: XTk.
TQ ¬
NIL];
Registers a procedure to be called on interactive attempts of scrolling. For scrolling to succeed it is necessary that the ScrollProc both, sets the picture displayed in the child, and, sets the values to be displayed in the scroll bars using SetState.
scrollProc: called to notify interactions.
clientData: passed to client procedures.
tq: ThreadQueue used for scrollerProc. For NIL, a reasonable choice will be made.
END.