XmTree - Man Page
The Tree widget class
Synopsis
#include <Xm/XTree.h>
Description
The Tree widget is a container that shows the relationship of its children in a graphical tree-like format. Each child of the Tree widget is a node in the Tree. The parent-child relationships between these nodes are completely distinct from the widget hierarch.. The hierarchy of nodes is created by specifying the tree "parent" of each node as a constraint resource. If a node's parent is NULL then it is assumed to be a root of the tree. Although each widget can only have one parent, the Tree widget supports adding more than one "root" node to a single Tree.
Note: the Tree widget assumes that is will be totally responsible for mapping and unmapping its children. Therefore no child of this widget should ever modify its mappedWhenManaged resource. If a child does modify this resource the behavior is undefined.
User Interaction
Each node in the tree can be in four states: open, closed, always open, and hidden. The state of a node changes how it appears to the user and what actions are available to the user.
Open This node will have an open folder shown to its left that may be selected by the user to close this node. When a node is open all of its children will be visible to the user.
Closed This node will have a closed folder shown to its left that may be selected by the user to open this node. When a node is closed none of its children will be visible to the user.
Always Open This node will have no folder button associated with it. All of its children will be visible to the user.
Hidden This node will not be shown to the user and all of its children will appear and act exactly as if they were children of this node's parent. It will appear to the user as if this node does not exist.
To maintain consistency of the user interface we have found that it is bestto use the node state "Always Open" for nodes with no children. This way the user will only see a folder button next to a node that has children to display. A folder button associated with a node that has no children has no defined semantics.
Normal Resources
Name | Class | Type | Initial Value |
connectStyle | ConnectStyle | unsigned char | XmTreeDirect |
horizontalNodeSpace | Dimension | HorizontalDimension | 20 |
verticalNodeSpace | Dimension | VerticalDimension | 2 |
All resource names begin with XmN and all resource class names begin with XmC.
connectStyle
The style of the lines visually connecting parent nodes to children nodes. The valid styles are XmTreeDirect or XmTreeLadder.
horizontalNodeSpace
verticalNodeSpace
The amount of space between each node in the tree and it nearest neighbor.
The following resources are inherited from the XmHierarchy widget:
Name | Class | Type | Initial Value |
autoClose | AutoClose | Boolean | True |
closeFolderPixmap | Pixmap | Pixmap | XmUNSPECIFIED_PIXMAP |
horizontalMargin | Dimension | HorizontalDimension | 2 |
openFolderPixmap | Pixmap | Pixmap | XmUNSPECIFIED_PIXMAP |
refigureMode | Boolean | Boolean | True |
verticalMargin | Dimension | VerticalDimension | 2 |
All resource names begin with XmN and all resource class names begin with XmC.
Constraint Resources
Name | Class | Type | Initial Value |
openClosePadding | OpenClosePadding | Int | 0 |
lineColor | Foreground | Pixel | <dynamic> |
lineWidth | LineWidth | Dimension | 0 |
All resource names begin with XmN and all resource class names begin with XmC. openClosePadding
The number of pixels between the folder button and the node it is associated with.
lineColor
The color of the line connecting a node to its parent. The default value for this resource is the foreground color of the Tree widget.
lineWidth
The width of a connection line between a node and its parent
The following constraint resources are inherited from the XmHierarchy widget:
Name | Class | Type | Initial Value |
insertBefore | InsertBefore | Widget | NULL |
nodeState | NodeState | XmHierarchyNodeState | Open |
parentNode | ParentNode | Widget | NULL |
All resource names begin with XmN and all resource class names begin with XmC. Geometry Management:
The layout is performed by assigning each node a box that is just large enough to con- tain itself and all of its children. A recursive layout is then performed that centers each node vertically in its box and at the extreme left horizontally. The children's boxes are then placed to the right of the node separated by the horizontalNodeSpace from their parent, stacked above each other and separated by verticalNodeSpace. This process is repeated recursively for each child in the tree.
The preferred size of the entire tree will be just large enough to contain all nodes in the hierarchy. As the state of nodes change the tree will attempt to resize itself to con- tain its current configuration. If the tree is forced larger than the desired size the nodes will be centered vertically and flush to the left edge of the tree widget. If the tree is forced smaller, some nodes may be moved or drawn outside the end of the tree. For this reason it is usually desirable to put the tree into a Scrolled Window widget.
See Also
XmColumn(3X)
Copyright
Copyright (c) 1992 by Integrated Computer Solutions, Inc.