XTkNumberLabel.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, March 31, 1992 12:23:55 pm PST
Christian Jacobi, April 20, 1992 3:27 pm PDT
A number-label is a widget which displays a number.
DIRECTORY
XTkCommon USING [StyleSpec],
XTk USING [Event, Widget, WidgetSpec];
XTkNumberLabel: CEDAR DEFINITIONS ~
BEGIN
StyleSpec: TYPE = XTkCommon.StyleSpec;
IsNumberLabel: PROC [widget: XTk.Widget] RETURNS [BOOL];
Predicate whether SetVal and GetVal make sense
Create: PROC [widgetSpec: XTk.WidgetSpec ¬ [], init: NAT ¬ 0, filter: NumberFilter ¬ NIL, filterData: REF ¬ NIL, style: StyleSpec ¬ [], editable: BOOLTRUE] RETURNS [XTk.Widget];
Creates a number-label widget.
NumberFilter: TYPE = PROC [self: XTk.Widget, filterData: REF, proposedValue: NAT, event: XTk.Event] RETURNS [useValue: NAT ← 0, inhibit: BOOLFALSE];
GetVal: PROC [widget: XTk.Widget] RETURNS [value: NAT];
Returns current number in widget.
SetVal: PROC [widget: XTk.Widget, value: NAT, event: XTk.Event ¬ NIL];
Tries to change number label; can be called by anybody (e.g interactive edits).
The proposed number will be filtered and if the filter thinks so, the real InternalSetVal procedure is called.
event is optional, it is forwarded to registered notifiers
SetFilter: PROC [widget: XTk.Widget, filter: NumberFilter ¬ NIL, filterData: REF ¬ NIL];
Replaces filter.
InternalSetVal: PROC [widget: XTk.Widget, value: NAT, event: XTk.Event ¬ NIL];
Replaces number of number label; must be called by logical parent only (no filtering will be done).
event is optional, it is forwarded to registered notifiers.
SetEditable: PROC [widget: XTk.Widget, editable: BOOL];
Allows or disallows interactive edits.
valueChangedKey: READONLY REF;
Key for notifier. Notifier is called when number changed
END.