MODULE; IMPORT ButtonVBT, FeedbackVBT, Filter, HighlightVBT, MultiClass, MultiFilter, MultiSplit, VBT; REVEAL T = Public BRANDED OBJECT OVERRIDES init := Init; callback := Callback; END; TYPE MC = MultiClass.Filter OBJECT OVERRIDES replace := Replace; succ := Succ END; PROCEDURE BooleanVBT Init (v: T; btn: ButtonVBT.T): T = BEGIN EVAL HighlightVBT.T.init(v, btn); (* Wipe out the Action on the button. *) btn.action := Action; MultiClass.Be(v, NEW(MC)); WITH ch = MultiFilter.Child(btn) DO IF ch # NIL THEN MultiClass.BeChild(v, ch) END END; RETURN v END Init; PROCEDURECallback (<* UNUSED *> v : T; <* UNUSED *> READONLY cd: VBT.MouseRec) = BEGIN END Callback; PROCEDUREAction (btn: ButtonVBT.T; READONLY cd: VBT.MouseRec) = BEGIN WITH f = Filter.Child(btn) DO FeedbackVBT.SetState(f, NOT FeedbackVBT.GetState(f)); END; NARROW(VBT.Parent(btn), T).callback(cd); END Action; PROCEDUREPut (v: T; state: BOOLEAN) = BEGIN WITH btn = Filter.Child(v), f = Filter.Child(btn) DO FeedbackVBT.SetState(f, state) END END Put; PROCEDUREGet (v: T): BOOLEAN = BEGIN WITH btn = Filter.Child(v), f = Filter.Child(btn) DO RETURN FeedbackVBT.GetState(f) END END Get; PROCEDUREReplace (m: MC; <* UNUSED *> ch: VBT.T; new: VBT.T) = BEGIN WITH v = NARROW(m.vbt, T), btn = Filter.Child(v) DO EVAL MultiFilter.Replace(btn, new) END END Replace; PROCEDURESucc (m: MC; ch: VBT.T): VBT.T = <* FATAL MultiSplit.NotAChild *> BEGIN WITH v = NARROW(m.vbt, T), btn = Filter.Child(v) DO RETURN MultiSplit.Succ(btn, ch) END END Succ; BEGIN END BooleanVBT.