XTkContainers.mesa
Copyright Ó 1988, 1991, 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, October 18, 1988 10:46:22 am PDT
Christian Jacobi, August 7, 1991 6:15 pm PDT
Implements some simple widget container classes.
DIRECTORY
XTk USING [Class, Widget, WidgetSpec];
XTkContainers: CEDAR DEFINITIONS
~ BEGIN
Widget: TYPE = XTk.Widget;
WidgetSpec: TYPE = XTk.WidgetSpec;
ContainerWidget: TYPE = Widget;
Orientation: TYPE = MACHINE DEPENDENT {inX, inY};
yStack:
READONLY XTk.Class;
Stacks children vertically.
xStack:
READONLY XTk.Class;
Stacks children horizontally.
container:
READONLY XTk.Class;
Children keep position and size from creation time.
CreateYStack:
PROC [widgetSpec: WidgetSpec ¬ [], stack:
LIST
OF Widget ¬
NIL, force:
INT ¬ -1]
RETURNS [ContainerWidget];
Container which abuts children in Y direction.
force: force children height; -1 to leave individual; 0 to split equal.
CreateXStack:
PROC [widgetSpec: WidgetSpec ¬ [], stack:
LIST
OF Widget ¬
NIL, force:
INT ¬ -1]
RETURNS [ContainerWidget];
Container which abuts children in X .direction
force: force children width; -1 to leave individual; 0 to split equal
CreateAbut:
PROC [widgetSpec: WidgetSpec ¬ [], children:
LIST
OF Widget ¬
NIL, orient: Orientation ¬ inX, force:
INT ¬ -1]
RETURNS [ContainerWidget];
Container which abuts children in direction orient.
force: whether children should all have this size in orientation; -1 means use individual size of children; 0 to split equal.
CreateContainer:
PROC [widgetSpec: WidgetSpec ¬ [], children:
LIST
OF Widget ¬
NIL]
RETURNS [ContainerWidget];
Container which draws children at their requested size and position.
AppendChild:
PROC [container: ContainerWidget, child: Widget, startReconfigure:
BOOL ¬
TRUE];
Append child as last child to ContainerWidget.
Callable from any thread.
AppendChildren:
PROC [container: ContainerWidget, children:
LIST
OF Widget, startReconfigure:
BOOL ¬
TRUE];
Append children to ContainerWidget.
Callable from any thread.
RemoveChild:
PROC [container: ContainerWidget, child: Widget, destroyChild:
BOOL ¬
TRUE, startReconfigure:
BOOL ¬
TRUE];
Removes child from ContainerWidget.
Callable from any thread.
SetForce:
PROC [container: ContainerWidget, force:
INT];
force: forces children height in stacks.
-1 to leave individual sizes; 0 to split equal.
Delayed until next reconfigure. Maybe ignored if container has "varying sized" child.
SetVaryingSize:
PROC [childOfStack: XTk.Widget, varyingSize:
BOOL ¬
TRUE];
If childOfStack is actually used as a child of an stack, childOfStack will be sized varying. (The varying sized children will be stretched to match the size of the container; the non-varying sized children will get their desired size, if possible) .
Ignored if childOfStack is used in different context.
END.