---
name: "XmHierarchy"
section: "3"
platform: "linux"
package: "openmotif"
version: "2.3.8-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/XmHierarchy"
---

# XmHierarchy(3)

The Hierarchy widget class

## NAME

**XmHierarchy** — The Hierarchy widget class

## SYNOPSIS

```
#include <Xm/Hierarchy.h>
```

## DESCRIPTION

The Hierarchy widget is not intended to be instantiated itself, but rather should be  used as the base class for any widget that would like to present a hierarchy of information  to the user that is different for the actual widget instance hierarchy of the application.  This base class is currently used for two widgets in the Motif widget set, Tree  and Outline, giving those two widgets a very similar API.

Note: The Hierarchy widget assumes that it 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.

### Classes

Hierarchy inherits behaviour, resources, and traits from **Core**, **Composite**, **Composite**, **Constraint**, and **XmManager** classes.

The class pointer is **xmHierarchyWidgetClass**.

The class name is **XmHierarchy**.

### New Resources

| | | | | | |
| --- | --- | --- | --- | --- | --- |
| **XmHierarchy Resource Set** |
| **Name** | **Class** | **Type** | **Default** | **Access** |
|  |  |  |  |  |  |
| XmNautoClose | XmCAutoClose | Boolean | True | CSG |
|  |  |  |  |  |  |
| XmNcloseFolderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED\_PIXMAP | CSG |
|  |  |  |  |  |  |
| XmNhorizontalMargin | XmCDimension | Dimension | 2 | CSG |
|  |  |  |  |  |  |
| XmNnodeStateCallback | XmCNodeStateCallback | XtCallbackList | NULL | C |
|  |  |  |  |  |  |
| XmNopenFolderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED\_PIXMAP | CSG |
|  |  |  |  |  |  |
| XmNrefigureMode | XmCBoolean | Boolean | True | CSG |
|  |  |  |  |  |  |
| XmNverticalMargin | XmCDimension | Dimension | 2 | CSG |
|  |  |  |  |  |  |

- **XmNautoClose**

  This resource determines if the hierarchy should automatically restore a parent  node's children when the parent node is reopened. If autoClose is False, and the  hierarchy is fully expanded when the root node is closed, then the entire hierarchy  will be displayed as expanded when the root node is reopened. If autoClose is  True, then the root node's children are closed when the root node is reopened.

- **XmNcloseFolderPixmap**

  This resource defines a pixmap for the closed representation of the folder pixmap to be used throughout the tree. It can be a color pixmap or bitmap. If the user does not specify a pixmap the default bitmap will be used.

- **XmNhorizontalMargin**

  - **XmNverticalMargin**

  The exact definition of these resources are left to the subclass of the hierarchy  widget that does the geometry layout. They are intended to be used as the amount  of space between the object and the edges of the window it is displayed in. They  are included here for consistency.

- **XmNopenFolderPixmap**

  This resource defines a pixmap for the open representation of the folder pixmap to be used throughout the tree . It can be a color pixmap or bitmap. If the user does not specify a pixmap the default opened folder bitmap.

- **XmNnodeStateCallback**

  The list of callback routines called when a folder button is clicked. See "Callback Routine" for more details.

- **XmNrefigureMode**

  This resource determines whether the Hierarchy should adjust the sizes of the  children after a geometry or resize request, or simply ignore the request. This  resource is very useful in improving the performance of an application that is  making a large number of geometry changes all at once.

  | | | | | | |
  | --- | --- | --- | --- | --- | --- |
  | **XmHierarchy Constraint Resource Set** |
  | **Name** | **Class** | **Type** | **Default** | **Access** |
  |  |  |  |  |  |  |
  | XmNinsertBefore | XmCInsertbefore | Widget | NULL | CSG |
  |  |  |  |  |  |  |
  | XmNnodeState | XmCNodeState | XMHierarchyNodeState | XmOpen | CSG |
  |  |  |  |  |  |  |
  | XmNparentNode | XmCParentNode | Widget | NULL | CSG |
  |  |  |  |  |  |  |

- **XmNinsertBefore**

  Specifies another node that has the same parentNode. This node will then be  placed immediately before that node in the hierarchy. If this value is NULL then  the node will be inserted at the end of the list. This resource allows the hierarchy's  children to be reordered.

- **XmNnodeState**

  The state of this node. Acceptable values are: XmOpen, XmClosed, XmAlwaysOpen,  and XmHidden. A type converter has been registered that can convert the  following strings: "open", "close", "alwaysOpen", and "hidden".

- **XmNparentNode**

  The hierarchy parent of this node. The parent node MUST be a widget sibling of  the current node.

### Inherited Resources

Hierarchy inherits behavior and resources from the superclasses described in the following tables. For a complete description of each resource, refer to the reference page for that superclass.

| | | | | | |
| --- | --- | --- | --- | --- | --- |
| **XmManager Resource Set** |
| **Name** | **Class** | **Type** | **Default** | **Access** |
|  |  |  |  |  |  |
| XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
|  |  |  |  |  |  |
| XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED\_PIXMAP | CSG |
|  |  |  |  |  |  |
| XmNforeground | XmCForeground | Pixel | dynamic | CSG |
|  |  |  |  |  |  |
| XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
|  |  |  |  |  |  |
| XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG |
|  |  |  |  |  |  |
| XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
|  |  |  |  |  |  |
| XmNinitialFocus | XmCInitialFocus | Widget | dynamic | CSG |
|  |  |  |  |  |  |
| XmNlayoutDirection | XmCLayoutDirection | XmDirection | dynamic | CG |
|  |  |  |  |  |  |
| XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB\_GROUP | CSG |
|  |  |  |  |  |  |
| XmNpopupHandlerCallback | XmCCallback | XtCallbackList | NULL | C |
|  |  |  |  |  |  |
| XmNshadowThickness | XmCShadowThickness | Dimension | dynamic | CSG |
|  |  |  |  |  |  |
| XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CG |
|  |  |  |  |  |  |
| XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
|  |  |  |  |  |  |
| XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
|  |  |  |  |  |  |
| XmNtraversalOn | XmCTraversalOn | Boolean | True | CSG |
|  |  |  |  |  |  |
| XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
|  |  |  |  |  |  |
| XmNuserData | XmCUserData | XtPointer | NULL | CSG |
|  |  |  |  |  |  |

| | | | | | |
| --- | --- | --- | --- | --- | --- |
| **Composite Resource Set** |
| **Name** | **Class** | **Type** | **Default** | **Access** |
|  |  |  |  |  |  |
| XmNchildren | XmCReadOnly | WidgetList | NULL | G |
|  |  |  |  |  |  |
| XmNinsertPosition | XmCInsertPosition | XtOrderProc | NULL | CSG |
|  |  |  |  |  |  |
| XmNnumChildren | XmCReadOnly | Cardinal | 0 | G |
|  |  |  |  |  |  |

| | | | | | |
| --- | --- | --- | --- | --- | --- |
| **Core Resource Set** |
| **Name** | **Class** | **Type** | **Default** | **Access** |
|  |  |  |  |  |  |
| XmNaccelerators | XmCAccelerators | XtAccelerators | dynamic | N/A |
|  |  |  |  |  |  |
| XmNancestorSensitive | XmCSensitive | Boolean | dynamic | G |
|  |  |  |  |  |  |
| XmNbackground | XmCBackground | Pixel | dynamic | CSG |
|  |  |  |  |  |  |
| XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED\_PIXMAP | CSG |
|  |  |  |  |  |  |
| XmNborderColor | XmCBorderColor | Pixel | XtDefaultForeground | CSG |
|  |  |  |  |  |  |
| XmNborderPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED\_PIXMAP | CSG |
|  |  |  |  |  |  |
| XmNborderWidth | XmCBorderWidth | Dimension | 0 | CSG |
|  |  |  |  |  |  |
| XmNcolormap | XmCColormap | Colormap | dynamic | CG |
|  |  |  |  |  |  |
| XmNdepth | XmCDepth | int | dynamic | CG |
|  |  |  |  |  |  |
| XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C |
|  |  |  |  |  |  |
| XmNheight | XmCHeight | Dimension | dynamic | CSG |
|  |  |  |  |  |  |
| XmNinitialResourcesPersistent | XmCInitialResourcesPersistent | Boolean | True | C |
|  |  |  |  |  |  |
| XmNmappedWhenManaged | XmCMappedWhenManaged | Boolean | True | CSG |
|  |  |  |  |  |  |
| XmNscreen | XmCScreen | Screen \* | dynamic | CG |
|  |  |  |  |  |  |
| XmNsensitive | XmCSensitive | Boolean | True | CSG |
|  |  |  |  |  |  |
| XmNtranslations | XmCTranslations | XtTranslations | dynamic | CSG |
|  |  |  |  |  |  |
| XmNwidth | XmCWidth | Dimension | dynamic | CSG |
|  |  |  |  |  |  |
| XmNx | XmCPosition | Position | 0 | CSG |
|  |  |  |  |  |  |
| XmNy | XmCPosition | Position | 0 | CSG |
|  |  |  |  |  |  |

### Callback Information

When a folder is clicked, the routines registered on the XmNnodeStateCallback list are passed a pointer to the following structure as client data:

```
typedef struct _XmHierarchyNodeStateData {
	Widget widget;
	XmHierarchyNodeState state;
} XmHierarchyNodeStateData;
```

- *widget*

  the child node of Hierarchy being opened or closed.

- *state*

  the current XmNnodeState (after the click) of the  node. Legal values are XmOpen, XmClosed, XmAlwaysOpen,  and XmHidden.

### Children

The hierarchy maintains IconButtons for each node in the hierarchy. Setting openFolderPixmap or closeFolderPixmap is done through XtSetValues. IconButtons may only be manipulated by the Hierarchy.

## RELATED

[**Composite**(3)](/Composite/3.md), [**Constraint**(3)](/Constraint/3.md), [**Core**(3)](/Core/3.md), [**XmCreateHierarchy**(3)](/XmCreateHierarchy/3.md), [**XmHierarchyGetChildNodes**(3)](/XmHierarchyGetChildNodes/3.md), [**XmHierarchyOpenAllAncestors**(3)](/XmHierarchyOpenAllAncestors/3.md), [**XmManager**(3)](/XmManager/3.md).
