XmForm(3X)
okay bestie, pull up a chair π because we are about to get into the XmForm(3X) manual page β and yes, the header literally says XmForm(3X) while the page itself is all about the Tree widget class. We don't make the rules, we just read them. πΈ
β¨ NAME β¨
XmTree β the Tree widget class, no cap. π³
πΈ SYNOPSIS πΈ
#include <Xm/XTree.h>
π DESCRIPTION π
So the Tree widget is a container, and what it does is show the relationship between its children in a cute little graphical tree-ish format. Every single child of the Tree widget is a node in the Tree. π«Ά
And here's the spicy part: the parent-child relationships between those nodes are completely distinct from the widget hierarchy. Like, separate. Unrelated. Different lanes entirely. The hierarchy of nodes gets built by you specifying the tree "parent" of each node as a constraint resource. If a node's parent is NULL, then it's assumed to be a root of the tree. π±
And even though each widget can only ever have one parent, the Tree widget supports adding more than one "root" node to a single Tree. Multiple roots! Main character energy from every single one of them. π
Note: the Tree widget assumes that it will be totally responsible for mapping and unmapping its children. So literally no child of this widget should ever modify its mappedWhenManaged resource. If a child does modify this resource, the behavior is undefined. Don't do it. We're serious. π
π User Interaction π
Every node in the tree can be in one of four states: open, closed, always open, and hidden. The state of a node changes how it looks to the user and what actions are available to them. Vibe check per node, basically. β¨
- Open β this node gets an open folder shown to its left, and the user can select it to close this node. When a node is open, all of its children are visible to the user. π
- Closed β this node gets a closed folder shown to its left, and the user can select it to open this node. When a node is closed, none of its children are visible</> to the user. π
- Always Open β this node has no folder button associated with it at all. All of its children are visible to the user. Just permanently unbothered. π
- Hidden β this node is not shown to the user at all, and all of its children appear and act exactly as if they were children of this node's parent. To the user, it looks like this node straight up does not exist. π
To maintain consistency of the user interface, we have found that it's best to use the node state "Always Open" for nodes with no children. That way the user only ever sees a folder button next to a node that actually has children to display. A folder button associated with a node that has no children has no defined semantics. So like... don't. π
β¨ Normal Resources β¨
connectStyleβ classConnectStyle, typeunsigned char, initial valueXmTreeDirect.horizontalNodeSpaceβ classHorizontalDimension, typeDimension, initial value20.verticalNodeSpaceβ classVerticalDimension, typeDimension, initial value2.
All resource names begin with XmN and all resource class names begin with XmC.
connectStyle β the style of the lines that visually connect parent nodes to children nodes. The valid styles are XmTreeDirect or XmTreeLadder. Pick your fighter. π
horizontalNodeSpace, verticalNodeSpace β the amount of space between each node in the tree and its nearest neighbor. Personal space matters bestie. π«Ά
The following resources are inherited from the XmHierarchy widget:
autoCloseβ classAutoClose, typeBoolean, initial valueTrue.closeFolderPixmapβ classPixmap, typePixmap, initial valueXmUNSPECIFIED_PIXMAP.horizontalMarginβ classHorizontalDimension, typeDimension, initial value2.openFolderPixmapβ classPixmap, typePixmap, initial valueXmUNSPECIFIED_PIXMAP.refigureModeβ classBoolean, typeBoolean, initial valueTrue.verticalMarginβ classVerticalDimension, typeDimension, initial value2.
All resource names begin with XmN and all resource class names begin with XmC.
π Constraint Resources π
openClosePaddingβ classOpenClosePadding, typeInt, initial value0.lineColorβ classForeground, typePixel, initial value<dynamic>.lineWidthβ classLineWidth, typeDimension, initial value0.
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's associated with. Their little gap. Their boundaries. π
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. Iconic default behavior honestly. β¨
lineWidth β the width of a connection line between a node and its parent. πΈ
The following constraint resources are inherited from the XmHierarchy widget:
insertBeforeβ classInsertBefore, typeWidget, initial valueNULL.nodeStateβ classNodeState, typeXmHierarchyNodeState, initial valueOpen.parentNodeβ classParentNode, typeWidget, initial valueNULL.
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's just large enough to contain itself and all of its children. Then a recursive layout happens that centers each node vertically in its box and puts it at the extreme left horizontally. After that, the children's boxes are placed to the right of the node, separated by horizontalNodeSpace from their parent, stacked above each other and separated by verticalNodeSpace. And this whole process gets repeated recursively for each child in the tree. It's giving fractal. π¦
The preferred size of the entire tree will be just large enough to contain all the nodes in the hierarchy. As the state of nodes changes, the tree will attempt to resize itself to contain its current configuration. π₯
Now here's the tea: 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. But if the tree is forced smaller, some nodes may be moved or drawn outside the end of the tree. For this reason, it's usually desirable to put the tree into a Scrolled Window widget. Protect your nodes bestie, wrap them. π
π¦ SEE ALSO π¦
XmColumn(3X)
π COPYRIGHT π
Copyright (c) 1992 by Integrated Computer Solutions, Inc.
and that's the whole page, bestie π«Άβ¨ this one dropped on 15 July 1992, and the footer is out here repping XmForm(3X) one more time just to keep us on our toes. π no cap, you now know the Tree widget better than half the internet. periodt. π
π
π¦ where this page comes from
- alpine 3.24: motif-doc 2.5.2-r0 Β· LGPL-2.1-or-later
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms