XTkBlinker.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, April 24, 1992 6:12 pm PDT
Christian Jacobi, April 25, 1992 11:40 am PDT
A means to implement blinking features, e.g. for implementing carets.
DIRECTORY Xl, XTk;
XTkBlinker: CEDAR DEFINITIONS ~
BEGIN
This package allows to implement blinking features by creating a window and periodically mapping and unmapping the window. While blinking speed is specified in milliseconds, it is rounded to very coarse units. Changes (including on/off) may appear immediately, or, may be delayed until next blinking phase.
BlinkerClass: TYPE = REF BlinkerClassRep;
BlinkerClassRep: TYPE = RECORD [
createProc: CreateOverlayProc,
installProc: InstallProc ¬ NIL,
classData: REF ¬ NIL,
onTime: CARD, --units are considered private
offTime: CARD
];
CreateOverlayProc: TYPE = PROC [blinkerClass: BlinkerClass, parent: XTk.Widget, attributes: Xl.Attributes, pos: Xl.Point] RETURNS [w: Xl.Window, geometry: Xl.Geometry, ref: REF READONLY ANY ¬ NIL];
Request to BlinkerClass to create an (overlay) window for a particular widget at position pos.
Called when the window is needed (e.g. at bind-sceen time, or, when blinker is turned on)
attributes is a proposal for how to set window attributes
pos is client requested position of logical hot-spot. (The created window should have the position pos+geometry.pos)
Must return:
w: window which will be periodically mapped and unmapped
geometry: geometry to be used in case of pos=[0, 0]
ref: For the benefit of clients, package will hold on to ref for as long as w is used
InstallProc: TYPE = PROC [w: XTk.Widget, key: REF, blinkerClass: BlinkerClass];
Notification to class that a blinker has been installed for a particular widget
Widget need not yet be screen-bound
NewBlinkerClass: PROC [createProc: CreateOverlayProc, installProc: InstallProc ¬ NIL, classData: REF ¬ NIL, onMsec: NAT ¬ 400, offMsec: NAT ¬ 400] RETURNS [BlinkerClass];
Represents application supporting a blinking overlay on widgets
A widget may have multiple blinkers.
InstallBlinker: PROC [w: XTk.Widget, key: REF, blinkerClass: BlinkerClass, persistent: BOOL ¬ FALSE];
Enables blinker behaviour for a particular widget
Note: "key" is used as property key on w to denote this blinker
Initial position is [0, 0] and initial state is "Off"
Persistent means that the widgets remembers when blinking is turned on even over widget migration
BlinkerSetPos: PROC [w: XTk.Widget, key: REF, pos: Xl.Point];
Sets position for blinker. Noop if no blinker is installed.
BlinkerOn: PROC [w: XTk.Widget, key: REF, count: CARD ¬ LAST[CARD]];
Turns blinker on (makes it blinking). Noop if no blinker is installed.
BlinkerOff: PROC [w: XTk.Widget, key: REF];
Turns blinker off (makes it invisible). Noop if no blinker is installed.
ChangeBlinkerSpeed: PROC [w: XTk.Widget, key: REF, onMsec: NAT ¬ 400, offMsec: NAT ¬ 400];
Eventually changes speed of the blinking. Times are very roughly rounded.
END.