DIRECTORY Xl USING [Geometry], XTk USING [Class, ImplementorClass, Mapping, RemoveChildProc, Widget, WidgetSpec], XTkFriends USING [InstPart]; XTkCollections: CEDAR DEFINITIONS IMPORTS XTkFriends ~ BEGIN Widget: TYPE = XTk.Widget; CollectionWidget: TYPE = XTk.Widget; Create: PROC [widgetSpec: XTk.WidgetSpec ¬ [], children: LIST OF Widget ¬ NIL, childCount: NAT ¬ 0] RETURNS [CollectionWidget]; RemoveChild: PROC [collection: CollectionWidget, child: Widget, reConsiderNow: BOOL ¬ TRUE, preventDestruction: BOOL ¬ FALSE]; RemoveChildLR: PROC [collection: CollectionWidget, child: Widget, reConsiderNow: BOOL ¬ TRUE, preventDestruction: BOOL ¬ FALSE]; AddChild: PROC [collection: CollectionWidget, newChild: Widget, position: REF ¬ NIL, reConsiderNow: BOOL ¬ TRUE]; AddChildLR: PROC [collection: CollectionWidget, newChild: Widget, position: REF ¬ NIL, reConsiderNow: BOOL ¬ TRUE]; AddChildren: PROC [collection: CollectionWidget, children: LIST OF Widget, reConsiderNow: BOOL ¬ TRUE]; AddChildrenLR: PROC [collection: CollectionWidget, children: LIST OF Widget, reConsiderNow: BOOL ¬ TRUE]; EnumerateChildren: PROC [collection: CollectionWidget, eachChild: EachChildProc, data: REF ¬ NIL]; EachChildProc: TYPE = PROC [collection: CollectionWidget, child: Widget, data: REF, idx: NAT] RETURNS [stop: BOOL ¬ FALSE]; AssertEmptySlotsLR: PROC [collection: CollectionWidget, num: NAT ¬ 0]; GetCollectionInstPart: PROC [collection: Widget] RETURNS [CollectionInstPart] = INLINE { RETURN [ NARROW[XTkFriends.InstPart[collection, collectionClass]] ]; }; collectionClass: READONLY XTk.Class; AddChildProc: TYPE = PROC [collection: CollectionWidget, newChild: Widget, position: REF, reConsiderNow: BOOL]; AddChildrenProc: TYPE = PROC [collection: CollectionWidget, children: LIST OF Widget, reConsiderNow: BOOL]; EnumerateChildrenProc: TYPE = PROC [collection: CollectionWidget, eachChild: EachChildProc, data: REF]; CollectionClassPart: TYPE = REF CollectionClassPartRec; CollectionClassPartRec: TYPE = RECORD [ enumerateChildren: EnumerateChildrenProc, addChildLR: AddChildProc, addChildrenLR: AddChildrenProc ]; NewCollectionClassPart: PROC [class: XTk.ImplementorClass] RETURNS [CollectionClassPart]; CollectionInstPart: TYPE = REF CollectionInstPartRec; CollectionInstPartRec: TYPE = RECORD [ slotsUsed: NAT ¬ 0, hasEmptySlots: BOOL ¬ FALSE, niloutSizingForked: BOOL ¬ FALSE, reserved: REF ¬ NIL, sizing: REF ConfigureData ¬ NIL, --allocated only while needed children: REF ChildrenData ¬ NIL ]; ChildrenData: TYPE = RECORD [ children: SEQUENCE count: NAT OF ChildrenRec ]; ChildrenRec: TYPE = RECORD [ child: Widget ]; ConfigureData: TYPE = RECORD [ d: SEQUENCE count: NAT OF ConfigureRec ]; ConfigureRec: TYPE = RECORD [ g: Xl.Geometry ¬ [], mapping: XTk.Mapping ¬ dontUse ]; RemoveChildInPlaceLR: XTk.RemoveChildProc; RemoveChildAndSqueezeLR: XTk.RemoveChildProc; AddChildInFirstPlaceLR: PROC [collection: CollectionWidget, newChild: Widget, position: REF ¬ NIL, reConsiderNow: BOOL ¬ TRUE]; BasicEnumerateChildren: PROC [collection: CollectionWidget, eachChild: EachChildProc, data: REF ¬ NIL]; END. V XTkCollections.mesa Copyright Σ 1989, 1990, 1991 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, June 15, 1989 11:13:50 am PDT Christian Jacobi, August 23, 1991 2:06 pm PDT A friends level interface to XTk, useful to define composite subclasses. Basics Creates a collection widget. childCount: caller might guess a number; hint only. Removes child from parent: Immediately unrealizes X window and removes childs data structures from parent. Parent may delay reconsidering its layout until call of ReConsiderChildrenLR [or configure of collection]. Childs data structures will also be destroyed unless preventDestruction is TRUE. Client callable for many subclasses. Internal RemoveChild. Callable from rootThread only; Client callable for many subclasses. Adds child to parents data structures. Visibility and X window creation might be delayed until call of ReConsiderChildrenLR [or configure of collection]. Client callable for many subclasses. Internal AddChild. Callable from rootThread only [or while creation]; Client callable for many subclasses. Conveniance procedure: like multiple calls to AddChild, but faster for some classes. See AddChild for details. Internal AddChildren. See AddChildLR for details. Shallow enumerates children. Adding or removing children while enumeration might not be considered in time. Makes shure collection has at least num empty children slots. Must be called on rootThread only!!. Subclassing Subclasses must choose a removeChildLR procedure! When called procedure sees newChild.s.parent already assigned and screen bound if necessary. Like AddChildProc, maybe faster for some classes. Modifies subClass to use a new copy of the CollectionClassPartRec. Returns a ref to the new copy which can be changed safely. (The new copy replaces the default original CollectionClassPartRec used for further sub-sub-classes). To be used by subclasses only to implement inheritance. To be used by subclasses only to implement inheritance. To be used by subclasses only to implement inheritance. To be used by subclasses only to implement inheritance. Κ:•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ=™HKšœ7Οk™:šœ-™-K™——šž œ˜ Kšœžœ ˜KšœžœI˜RKšœ žœ ˜—K˜šΟnœžœž ˜!Kšžœ ˜—Kšžœ˜K˜KšœI™IK™KšΠbl™K˜Kšœžœ˜Kšœžœ˜$K˜šŸœžœ-žœžœ žœžœžœ˜Kšœ™Kšœ3™3—K˜š Ÿ œžœ>žœžœžœžœ˜~J™mJšœk™kJšœP™PKšœ%™%—š Ÿ œžœ>žœžœžœžœ˜€Jšœ™KšœC™CK˜—š Ÿœžœ<žœžœžœžœ˜qJšœš™šKšœ$™$K˜—š Ÿ œžœ<žœžœžœžœ˜sJšœ™KšœW™WK˜—š Ÿ œžœ*žœžœžœžœ˜gJšœU™UJšœ™K˜—š Ÿ œžœ*žœžœžœžœ˜iJšœ™Jšœ™K˜—šŸœžœ@žœžœ˜bJ™J™NK˜—Kšœžœžœ5žœžœžœžœžœ˜{K˜šŸœžœ%žœ˜FJšœ=™=JšΟc$™$—K™šŸœžœžœžœ˜XKšžœžœ5˜DKšœ˜K˜—Kš  ™ K™šœžœ ˜$Kšœ1™1K™—š œžœžœ<žœžœ˜oKšœ\™\K™—š œžœžœ*žœžœžœ˜kKšœ3™3K™—Kšœžœžœ@žœ˜gK˜Kšœžœžœ˜7šœžœžœ˜'Kšœ)˜)Kšœ˜Kšœ˜K˜K˜—šŸœžœžœ˜YKšœε™ε—K˜Kšœžœžœ˜5šœžœžœ˜&Kšœ žœ˜Kšœžœžœ˜Kšœžœžœ˜!Kšœ žœžœ˜Kšœžœžœ‘˜>Kšœ žœž˜ K˜—K˜šœžœžœ˜Kšœ žœžœžœ ˜,K˜—K˜šœ žœžœ˜K˜ K˜K˜—šœžœžœ˜Kšœžœžœžœ ˜&K˜—J™šœžœžœ˜Kšœ˜K˜K˜—K˜šŸœ˜*Kšœ7™7K™—šŸœ˜-Kšœ7™7K™—š Ÿœžœ<žœžœžœžœ˜Kšœ7™7K™—šŸœžœ@žœžœ˜gKšœ7™7—K˜Kšžœ˜K˜K˜—…— 8Θ