XTkChoiceWidgets.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, July 2, 1991 1:58 pm PDT
Christian Jacobi, April 7, 1992 11:28 am PDT
Implements some choice widget classes.
A choice is a widget which allows the user to make a choice.
Choice widgets might sub class or delegate to text widgets.
DIRECTORY
XTk USING [TQ, Widget, WidgetNotifyProc, WidgetSpec],
XTkCommon USING [ChoiceElement, StyleSpec];
XTkChoiceWidgets: CEDAR DEFINITIONS ~
BEGIN
WidgetSpec: TYPE = XTk.WidgetSpec;
StyleSpec: TYPE = XTkCommon.StyleSpec;
ChoiceWidget: TYPE = XTk.Widget;
ChoiceElement: TYPE = XTkCommon.ChoiceElement;
ChoiceList: TYPE = LIST OF ChoiceElement;
IsChoice: PROC [w: XTk.Widget] RETURNS [BOOL];
Returns whether w is a ChoiceWidget
CurrentChoice: PROC [widget: ChoiceWidget] RETURNS [REF ANY];
Returns key field of current choice
Choose: PROC [widget: ChoiceWidget, ce: ChoiceElement];
Selects the feedback choice of a ChoiceWidget;
Like interactive action, except the hitProc is not called.
It is ok if only text or only key in ChoiceElement is defined.
Use this for initializations.
CreateChoices: PROC [widgetSpec: WidgetSpec ¬ [], choices: ChoiceList, horizontal: BOOL ¬ TRUE, hitProc: XTk.WidgetNotifyProc ¬ NIL, registerData: REF ¬ NIL, tq: XTk.TQ ¬ NIL, style: StyleSpec ¬ []] RETURNS [ChoiceWidget];
ChoiceWidget displays choices but marks the currently selected one.
choices must not be NIL.
The hitProc procedure is executed on thread [forked if NIL].
style: applied to all elements
choices with NIL key can not be selected; all choices are visible.
CreateToggle: PROC [widgetSpec: WidgetSpec ¬ [], choices: ChoiceList, hitProc: XTk.WidgetNotifyProc ¬ NIL, registerData: REF ¬ NIL, tq: XTk.TQ ¬ NIL, style: StyleSpec ¬ []] RETURNS [ChoiceWidget];
ChoiceWidget displays current options but can be toggled through choices.
END.