<* PRAGMA LL *>A
ReactivityVBT
is a filter that can make its child active,
passive, dormant, and invisible. The {\em active\/} state does
nothing; mouse and keyboard events are relayed to child. The {\em
passive\/} state doesn't allow mouse or keyboard events to go to
the child.
The {\em dormant\/} state doesn't send mouse or keyboard events to
the child; it also grays out the child. The {\em vanish\/} state
also doesn't send mouse or keyboard events to go to the child; in
addition, it draws over the child in the background color, thereby
making it invisible.
When the state of a ReactivityVBT
is set, the caller also
specifies a cursor to be used.
If a VBT-descendant of a ReactivityVBT
is painted, it will appear
correctly. For example, if the ReactivityVBT
is in the vanished
state, the descendant will not appear until the state changes; if
the ReactivityVBT
is in a dormant state, the descendant will be
grayed out.
A ReactivityVBT
also passes on any miscellaneous events to take
the keyboard focus to the descendant that last acquired the
keyboard focus.
INTERFACEThe callReactivityVBT ; IMPORT Cursor, ETAgent, PaintOp, Rect, VBT; TYPE State = {Active, Passive, Dormant, Vanish}; T <: Public; Public = ETAgent.T OBJECT METHODS <* LL.sup <= VBT.mu *> init (ch: VBT.T; colors: PaintOp.ColorScheme := NIL): T; <* LL = VBT.mu.v *> paintDormant (r: Rect.T; colors: PaintOp.ColorScheme); END;
v.init(..)
initializes v
as a ReactivityVBT
with child ch
and with an initial state of Active
. If
colors
is NIL
, then PaintOp.bgFg
is used instead. The
colors
are used to draw the vanished and dormant states.
The implementation calls v.paintDormant(r, colors)
to paint
the part of ch
bounded by rectangle r
when v
's state
is Dormant
. The ``current colors'' of v
are passed as
colors
. Initially, the current colors are those that were
specified when the ReactivityVBT
was initialized. They can
be changed using the SetColors
procedure. The default
method paints a Pixmap.Gray
texture using
colors.transparentBg
.
PROCEDURE Set (v: T; state: State; cursor: Cursor.T); <* LL.sup = VBT.mu *>
Changev
's state and cursor, and markv
for redisplay.
PROCEDURE Get (v: T): State; <* LL.sup = VBT.mu *>
Retrieve v
's current state.
PROCEDURE GetCursor (v: T): Cursor.T; <* LL.sup = VBT.mu *>
Retrieve v
's current cursor.
PROCEDURE SetColors (v: T; colors: PaintOp.ColorScheme); <* LL.sup = VBT.mu *>
Change the colors thatv
uses for theDormant
andVanish
states. Ifv
is currently in theDormant
orVanish
state, markv
for redisplay.
END ReactivityVBT.