<* PRAGMA LL *>The
ScrollerVBTClassinterface allows you to customize the user interface of a scrollbar.
INTERFACEThe call to
ScrollerVBTClass; IMPORT Axis, PaintOp, Pixmap, ScrollerVBT, VBT; REVEAL ScrollerVBT.Private <: T; TYPE T <: Public; Public = VBT.Leaf OBJECT METHODS <* LL.sup = VBT.mu *> init (axis := Axis.T.Ver; colors: PaintOp.ColorQuad := NIL): T; <* LL = VBT.mu *> scroll (READONLY cd : VBT.MouseRec; part : INTEGER; height : INTEGER; towardsEOF: BOOLEAN ); autoScroll (READONLY cd : VBT.MouseRec; linesToScroll: CARDINAL; towardsEOF : BOOLEAN ); thumb (READONLY cd: VBT.MouseRec; part: INTEGER; height: INTEGER); END;
axisorientation, and returns
v. It is displayed using
PaintOp.bgFgwill be used.
The default methods for
are no-ops: the stripe within the scroller doesn't change.
When the user scrolls, the implementation calls
v.scroll(cd, part, height, towardsEOF)on the up-click.
cdis the mouse event;
heightis the number of pixels in the domain of
partis number of pixels away from the top/left edge that the upclick happened.
TRUEwhen invoked from a left-upclick,
FALSEwhen invoked from a right-upclick. (Of these, only
cdis really needed; the others can be computed from
While the user is in continuous or proportional scrolling,
the implementation calls
v.autoScroll(...) repeatedly. The
linesToScroll is somewhat of a misnomer (but kept for
historical purposes). For continuous scrolling, the value
is always 1. For proportional scrolling, the value is the
number of pixels the mouse has moved. Think of
linesToScroll as simply the ``amount that should be
cd field in proportional scrolling is fine,
except it's really a position event, not a mouse event, that
caused the action (this is a good use for an
for historical reasons\dots). For continuous scrolling,
is set to be the mouse record for the down-click that initiate
the scrolling, but with
cd.time = 0.
v.thumb(cd, part, height) is called when the user
thumbs or continuous thumbs.
height is the number of pixels
in the domain of
v in the
the distance in pixels between the mouse and the top/left
cd always has a valid time, cursor position, and
modifier fields. (OK, it isn't the real event, since
continuous thumbing is a position event whereas thumbing is
a mouse event. Again, a good potential client of
By and large, these methods will change the position and size of the stripe. This is done using the following procedure:
PROCEDURE Update (v: T; start, end, length: CARDINAL); <* LL.sup < v *>
Set new values of the stripe and (if they've changed) mark
The coordinate system for
lengthis as follows (we'll consider just a horizontal scrollbar): The left edge of the domain of
vis at coordinate 0, and the right edge consider to be at
length. The stripe extends from
max(min(end,length),start). The implementation will draw a stripe to represent these quantities, scaled to the actual length of the scrollbar.
The visual appearance of a
ScrollerVBT is governed by the
following data structures and procedures:
TYPE Attributes = RECORD axis : Axis.T; margin : REAL; scrollPaintOps : ARRAY Axis.T OF PaintOp.T; scrollPixmaps : ARRAY Axis.T OF Pixmap.T; minStripeLen : REAL; stripeWidth : REAL; stripePaintOps : ARRAY Axis.T OF PaintOp.T; stripePixmaps : ARRAY Axis.T OF Pixmap.T; stripeBorder : REAL; stripeBorderPaintOp: PaintOp.T; stripeBorderPixmap : Pixmap.T; END; PROCEDURE GetAttributes (v: T): Attributes;
Return the attribute currently in effect for
PROCEDURE SetAttributes (v: T; READONLY a: Attributes); <* LL.sup = VBT.mu *>
Change the attributes on
vfor redisplay and notify
v's parent that its shape might have changed.
PROCEDURE Colorize (v: T; colors: PaintOp.ColorQuad); <* LL.sup = VBT.mu *>
Sets the paint op of all the scroller's textures and borders to be