DIRECTORY SharedCell, SharedCellBackdoor, Rope, XTk, XTkLabels, XTkSharedCell; XTkSharedCellImpl: CEDAR MONITOR IMPORTS SharedCell, SharedCellBackdoor, XTk, XTkLabels EXPORTS XTkSharedCell ~ BEGIN Notifier: TYPE = SharedCellBackdoor.Notifier; TextCellNotifier: Notifier = { w: XTk.Widget ~ NARROW[notifierData]; text: Rope.ROPE ¬ NIL; WITH value SELECT FROM r: Rope.ROPE => text ¬ r; ENDCASE => IF value#NIL THEN RETURN; XTkLabels.SetText[w, text]; }; TextDestructNotified: XTk.WidgetNotifyProc = { cell: SharedCell.Cell ~ SharedCell.NarrowCell[registerData]; SharedCellBackdoor.UnRegisterNotifier[cell, TextCellNotifier, widget]; }; BindText: PUBLIC PROC [cell: SharedCell.Cell, textWidget: XTk.Widget] = { IF cell=NIL OR textWidget=NIL THEN ERROR; XTk.RegisterNotifier[textWidget, XTk.postWidgetDestructionKey, TextDestructNotified, cell]; IF textWidget.state XTkLabels.SetText[textWidget, r, delayed]; ENDCASE => {}; }; Binding: TYPE = RECORD [ widget: XTk.Widget, cell: SharedCell.Cell, notifyProc: XTk.WidgetNotifyProc, registerData: REF ]; CellNotifier: Notifier = { b: REF Binding ~ NARROW[notifierData]; w: XTk.Widget ~ b.widget; IF w#NIL THEN b.notifyProc[w, b.registerData, value]; }; DestructNotified: XTk.WidgetNotifyProc = { Unregister[NARROW[registerData]]; }; Unregister: PROC [b: REF Binding] = { cell: SharedCell.Cell ¬ b.cell; IF cell#NIL THEN SharedCellBackdoor.UnRegisterNotifier[cell, CellNotifier, b]; b.cell ¬ NIL; b.widget ¬ NIL; b.registerData ¬ NIL; }; Bind: PUBLIC PROC [cell: SharedCell.Cell, widget: XTk.Widget, notifyProc: XTk.WidgetNotifyProc, registerData: REF, initialCall: BOOL] = { b: REF Binding ~ NEW[Binding ¬ [cell: cell, widget: widget, registerData: registerData]]; IF cell=NIL OR widget=NIL OR notifyProc=NIL THEN ERROR; XTk.RegisterNotifier[widget, XTk.postWidgetDestructionKey, DestructNotified, b]; IF widget.state˜NKšœ žœ žœžœ˜3K˜K˜—š Ÿœžœžœ]žœžœ˜‰Kšœžœ žœE˜YKšžœžœžœžœžœ žœžœžœ˜7K˜Pšžœž˜K˜;—Kšžœžœ˜(šžœ ž˜K˜>—K˜K™—Kšžœ˜K˜—…—  N