<> <> DIRECTORY Graphics, Rope, TiogaItemClass, TiogaNode, TiogaNodeOps, VFonts; TestNodesClassImpl: CEDAR PROGRAM IMPORTS Graphics, Rope, TiogaNodeOps, VFonts = BEGIN <<********** TestBox Class Implementation **********>> BoxLengthProc: TiogaItemClass.ItemLengthProc = BEGIN RETURN[1]; END; <<>> BoxNotifyProc: TiogaItemClass.ItemNotifyProc = BEGIN ERROR; END; BoxDestroyProc: TiogaItemClass.ItemDestroyProc = BEGIN END; BoxCopyProc: TiogaItemClass.ItemCopyProc = BEGIN ERROR; END; BoxFastFormatProc: TiogaItemClass.ItemFastFormatProc = BEGIN <> desiredWidth: INTEGER = 350; desiredHeight: INTEGER = 8; rightExtent _ MIN[desiredWidth, rightBound]; topExtent _ MIN[desiredHeight/2+desiredHeight/4, topBound]; bottomExtent _ MIN[desiredHeight-topExtent, bottomBound]; Graphics.SetStipple[context, 122645B]; Graphics.DrawBox[context, [0, -bottomExtent, rightExtent, topExtent]]; Graphics.SetColor[context, Graphics.black]; Graphics.DrawBox[context, [0, 0, rightExtent, 1]]; -- draw in baseline Graphics.DrawBox[context, [0, -bottomExtent, 1, topExtent]]; -- draw in baseline end _ 1; END; BoxLineBreakFormatProc: TiogaItemClass.ItemLineBreakFormatProc = BEGIN ERROR; END; BoxDisplayProc: TiogaItemClass.ItemDisplayProc = BEGIN ERROR; END; BoxSetSelectionProc: TiogaItemClass.ItemSetSelectionProc = BEGIN ERROR; END; BoxSetProc: TiogaItemClass.ItemSetProc = BEGIN ERROR; END; BoxGetProc: TiogaItemClass.ItemGetProc = BEGIN ERROR; END; <<>> <<********** TestList Class Implementation **********>> ListLengthProc: TiogaItemClass.ItemLengthProc = BEGIN RETURN[1]; END; <<>> ListNotifyProc: TiogaItemClass.ItemNotifyProc = BEGIN ERROR; END; ListDestroyProc: TiogaItemClass.ItemDestroyProc = BEGIN ERROR; END; ListCopyProc: TiogaItemClass.ItemCopyProc = BEGIN ERROR; END; ListFastFormatProc: TiogaItemClass.ItemFastFormatProc = BEGIN rope: Rope.ROPE = ""; rightExtent _ MIN[VFonts.StringWidth[rope], rightBound]; topExtent _ MIN[VFonts.FontAscent[], topBound]; bottomExtent _ MIN[VFonts.FontHeight[]-VFonts.FontAscent[], bottomBound]; Graphics.SetCP[context, 0, 0]; Graphics.DrawRope[context, rope]; Graphics.DrawBox[context, [0, 0, rightExtent, 1]]; -- draw in baseline Graphics.DrawBox[context, [0, 0, -bottomExtent, topExtent]]; -- draw in baseline end _ Rope.Size[rope]; END; ListLineBreakFormatProc: TiogaItemClass.ItemLineBreakFormatProc = BEGIN ERROR; END; ListDisplayProc: TiogaItemClass.ItemDisplayProc = BEGIN ERROR; END; ListSetSelectionProc: TiogaItemClass.ItemSetSelectionProc = BEGIN ERROR; END; ListSetProc: TiogaItemClass.ItemSetProc = BEGIN ERROR; END; ListGetProc: TiogaItemClass.ItemGetProc = BEGIN ERROR; END; <<********** Class Registration **********>> [] _ TiogaNodeOps.RegisterItemClass[TiogaItemClass.ItemClassRec[ length: BoxLengthProc, notify: BoxNotifyProc, format: BoxFastFormatProc, lineBreakFormat: BoxLineBreakFormatProc, display: BoxDisplayProc, setSelection: BoxSetSelectionProc, get: BoxGetProc, set: BoxSetProc, copy: BoxCopyProc, destroy: BoxDestroyProc, tipTable: NIL, flavor: $TestBox, privateOps: NIL ], FALSE]; [] _ TiogaNodeOps.RegisterItemClass[TiogaItemClass.ItemClassRec[ length: ListLengthProc, notify: ListNotifyProc, format: ListFastFormatProc, lineBreakFormat: ListLineBreakFormatProc, display: ListDisplayProc, setSelection: ListSetSelectionProc, get: ListGetProc, set: ListSetProc, copy: ListCopyProc, destroy: ListDestroyProc, tipTable: NIL, flavor: $TestList, privateOps: NIL ], FALSE]; END.