# CK Core Motif component catalogue

This catalogue is generated from the gallery manifest. Each anchor is the documentation target recorded by the corresponding manifest entry. Use **Demo** to inspect the captured application and **Source** for its actual construction code. Screenshots retain their recorded capture version; they are not a claim of completed visual redesign.

## layout

\<a id="gallery.component.buttonboxwidgetclass"\>\</a\>

### `xm.buttonboxwidgetclass`
- Class: `xmButtonBoxWidgetClass`
- Example: `gallery.source.buttonboxwidgetclass`
- Interaction: `gallery.interaction.buttonboxwidgetclass`
- Screenshot: `gallery.screenshot.buttonboxwidgetclass`
- Capability: constructible

**Demo**

![xmButtonBoxWidgetClass in the component demo](<gallery-screenshots/xm-buttonboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmButtonBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ButtonBox.h>)

\<a id="gallery.component.bulletinboardwidgetclass"\>\</a\>

### `xm.bulletinboardwidgetclass`
- Class: `xmBulletinBoardWidgetClass`
- Example: `gallery.source.bulletinboardwidgetclass`
- Interaction: `gallery.interaction.bulletinboardwidgetclass`
- Screenshot: `gallery.screenshot.bulletinboardwidgetclass`
- Capability: constructible

**Demo**

![xmBulletinBoardWidgetClass in the component demo](<gallery-screenshots/xm-bulletinboardwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmBulletinBoardWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/BulletinB.h>)

\<a id="gallery.component.columnwidgetclass"\>\</a\>

### `xm.columnwidgetclass`
- Class: `xmColumnWidgetClass`
- Example: `gallery.source.columnwidgetclass`
- Interaction: `gallery.interaction.columnwidgetclass`
- Screenshot: `gallery.screenshot.columnwidgetclass`
- Capability: constructible

**Demo**

![xmColumnWidgetClass in the component demo](<gallery-screenshots/xm-columnwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmColumnWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
const char *captions[] = {"Document", "Status", "Owner"};
const char *values[] = {"Quarterly report", "Draft", "Design team"};
unsigned int i;
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
for (i = 0; i < XtNumber(captions); ++i) {
    XmString caption = XmStringCreateLocalized((char *)captions[i]);
    XtVaCreateManagedWidget("field", xmTextFieldWidgetClass, example,
        XmNentryLabelString, caption, XmNvalue, values[i], XmNcolumns, 28, NULL);
    XmStringFree(caption);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Column.h>)

\<a id="gallery.component.containerwidgetclass"\>\</a\>

### `xm.containerwidgetclass`
- Class: `xmContainerWidgetClass`
- Example: `gallery.source.containerwidgetclass`
- Interaction: `gallery.interaction.containerwidgetclass`
- Screenshot: `gallery.screenshot.containerwidgetclass`
- Capability: constructible

**Demo**

![xmContainerWidgetClass in the component demo](<gallery-screenshots/xm-containerwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmContainerWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget folder;
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 520, XmNheight, 240, XmNlayoutType, XmOUTLINE,
    XmNentryViewType, XmSMALL_ICON, NULL);
label = XmStringCreateLocalized((char *)"Documents");
folder = XtVaCreateManagedWidget("folder", xmIconGadgetClass, example,
    XmNlabelString, label, XmNoutlineState, XmEXPANDED, NULL);
gallery_bind_icon(folder,XmNsmallIconPixmap,"action_open");
const char *names[] = {"Quarterly report", "Meeting notes"};
unsigned int i;
for (i = 0; i < XtNumber(names); ++i) {
    XmString caption = XmStringCreateLocalized((char *)names[i]);
    Widget item=XtVaCreateManagedWidget("document", xmIconGadgetClass, example,
        XmNlabelString, caption, XmNentryParent, folder, NULL);
    gallery_bind_icon(item,XmNsmallIconPixmap,"action_document");
    XmStringFree(caption);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Container.h>)

\<a id="gallery.component.displayclass"\>\</a\>

### `xm.displayclass`
- Class: `xmDisplayClass`
- Example: `gallery.source.displayclass`
- Interaction: `gallery.interaction.displayclass`
- Screenshot: `gallery.screenshot.displayclass`
- Capability: inventory-only

**Demo**

![xmDisplayClass in the component demo](<gallery-screenshots/xm-displayclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* 
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
*/ 

#ifndef _XmDisplay_h
#define _XmDisplay_h

#include <Xm/Xm.h>
#include <X11/Shell.h>
#include <Xm/DragC.h>
#include <Xm/DropSMgr.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef XmIsDisplay
#define XmIsDisplay(w) (XtIsSubclass(w, xmDisplayClass))
#endif /* XmIsXmDisplay */

enum {
	XmDRAG_NONE,
	XmDRAG_DROP_ONLY,
	XmDRAG_PREFER_PREREGISTER,
	XmDRAG_PREREGISTER,
	XmDRAG_PREFER_DYNAMIC,
	XmDRAG_DYNAMIC,
	XmDRAG_PREFER_RECEIVER
};

/* Class record constants */

typedef struct _XmDisplayRec *XmDisplay;
typedef struct _XmDisplayClassRec *XmDisplayClass;
externalref 	WidgetClass xmDisplayClass;

#define XmGetDisplay(w) XmGetXmDisplay(XtDisplayOfObject(w))

/********    Public Function Declarations    ********/

extern Widget XmGetDragContext( 
                        Widget w,
                        Time time) ;
extern Widget XmGetXmDisplay( 
                        Display *display) ;

/*
 * Set or clear a process-local scale override for this display.  The
 * override is intended for deterministic test tools and developer controls;
 * it is not written to the X resource database.  A finite positive value is
 * accepted.  If the value changes, realized Motif objects receive one
 * same-thread scale transaction before the normal resize/repaint pass.
 * Toolkit-owned defaults that participate in that transaction saturate at
 * their documented Dimension limit, while explicit application pixel
 * resources are unaffected.
 */
extern Boolean XmSetDisplayScaleOverride(
                        Display *display,
                        double scale);
extern Boolean XmGetDisplayScaleOverride(
                        Display *display,
                        double *scale_return);
/* Effective widget scale: override, monitor scale, Xft.dpi, then 1.0.
 * Values below one are clamped to one, matching toolkit default dimensions. */
extern Boolean XmGetWidgetScale(Widget widget, double *scale_return);

extern Boolean XmClearDisplayScaleOverride(
                        Display *display);

/********    End Public Function Declarations    ********/

#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmDisplay_h */


```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Display.h>)

\<a id="gallery.component.dragcontextclass"\>\</a\>

### `xm.dragcontextclass`
- Class: `xmDragContextClass`
- Example: `gallery.source.dragcontextclass`
- Interaction: `gallery.interaction.dragcontextclass`
- Screenshot: `gallery.screenshot.dragcontextclass`
- Capability: inventory-only

**Demo**

![xmDragContextClass in the component demo](<gallery-screenshots/xm-dragcontextclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* 
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
*/ 

#ifndef _XmDragController_h
#define _XmDragController_h

#include <Xm/Xm.h>
#include <Xm/Display.h>

#ifdef __cplusplus
extern "C" {
#endif


/* defines for the dragFinish completionStatus field */

#define XmHELP			2

/*
 * Some global stuff that will go into Xm.h
 */
typedef unsigned int	XmID;

/***********************************************************************
 *
 * DragContext
 *
 ***********************************************************************/

#ifndef XmIsDragContext
#define XmIsDragContext(w) XtIsSubclass(w,xmDragContextClass)
#endif /* XmIsDragContext */

#ifndef _XA_MOTIF_DROP
#define _XA_MOTIF_DROP "_MOTIF_DROP"
#define _XA_DRAG_FAILURE "_MOTIF_DRAG_FAILURE"
#define _XA_DRAG_SUCCESS "_MOTIF_DRAG_SUCCESS"
#endif /* _XA_MOTIF_DROP */


/* enums used for the message_type in client messages */

enum{	XmTOP_LEVEL_ENTER,		XmTOP_LEVEL_LEAVE,
	XmDRAG_MOTION,			XmDROP_SITE_ENTER,
	XmDROP_SITE_LEAVE,		XmDROP_START,
	XmDROP_FINISH,			XmDRAG_DROP_FINISH,
	XmOPERATION_CHANGED
	} ;

/* enums for completionStatus */
enum{	XmDROP,				XmDROP_HELP,
	XmDROP_CANCEL,			XmDROP_INTERRUPT
	} ;

/* values for operation */
#define	XmDROP_NOOP	0L
#define XmDROP_MOVE 	(1L << 0)
#define XmDROP_COPY	(1L << 1)
#define XmDROP_LINK	(1L << 2)

enum{	XmMOVE = XmDROP_MOVE,		XmCOPY = XmDROP_COPY, 
	XmLINK = XmDROP_LINK,		XmOTHER
	} ;

enum{	XmBLEND_ALL,			XmBLEND_STATE_SOURCE,
	XmBLEND_JUST_SOURCE,		XmBLEND_NONE
	} ;

enum{  	XmDROP_FAILURE,			XmDROP_SUCCESS
	} ;


/* enums used for the public callback reason */

enum{	XmCR_TOP_LEVEL_ENTER,		XmCR_TOP_LEVEL_LEAVE,
	XmCR_DRAG_MOTION,		XmCR_DROP_SITE_ENTER,
	XmCR_DROP_SITE_LEAVE,		XmCR_DROP_START,
	XmCR_DROP_FINISH,		XmCR_DRAG_DROP_FINISH,
	XmCR_OPERATION_CHANGED,

	_XmNUMBER_DND_CB_REASONS
	} ;


/* Class record constants */
typedef struct _XmDragContextClassRec	*XmDragContextClass;
typedef struct _XmDragContextRec	*XmDragContext;
externalref WidgetClass xmDragContextClass;

typedef struct _XmAnyICCCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
}XmAnyICCCallbackStruct, *XmAnyICCCallback;

typedef struct _XmTopLevelEnterCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    Screen		*screen;
    /*
     * the window field is different if this is an outbound or inbound
     * callback. Outbound == reciever, Inbound == initiator.
     */
    Window		window;
    Position		x, y;
    unsigned char	dragProtocolStyle;
    Atom		iccHandle;
}XmTopLevelEnterCallbackStruct, *XmTopLevelEnterCallback;

typedef struct _XmTopLevelLeaveCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    Screen		*screen;
    Window		window;
}XmTopLevelLeaveCallbackStruct, *XmTopLevelLeaveCallback;

/* 
 * this message is sent from the receiver to the initiator to
 * indicate that the motion message with the associated timestamp has
 * caused a drop-site to be entered
 */
typedef struct _XmDropSiteEnterCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    unsigned char	operation;
    unsigned char	operations;
    unsigned char	dropSiteStatus;
    Position		x, y;
}XmDropSiteEnterCallbackStruct, *XmDropSiteEnterCallback;

/* 
 * this message is sent from the receiver to the initiator to
 * indicate that the motion message with the associated timestamp has
 * caused a drop-site to be left
 */
typedef struct _XmDropSiteLeaveCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
}XmDropSiteLeaveCallbackStruct, *XmDropSiteLeaveCallback;

typedef struct _XmDragMotionCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    unsigned char	operation;
    unsigned char	operations;
    unsigned char	dropSiteStatus;
    Position		x, y;
}XmDragMotionCallbackStruct, *XmDragMotionCallback;

typedef struct _XmOperationChangedCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    unsigned char	operation;
    unsigned char	operations;
    unsigned char	dropSiteStatus;
}XmOperationChangedCallbackStruct, *XmOperationChangedCallback;

typedef struct _XmDropStartCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    unsigned char	operation;
    unsigned char	operations;
    unsigned char	dropSiteStatus;
    unsigned char	dropAction;
    Position		x, y;
    Window		window;
    Atom		iccHandle;
}XmDropStartCallbackStruct, *XmDropStartCallback;

typedef struct _XmDropFinishCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
    unsigned char	operation;
    unsigned char	operations;
    unsigned char	dropSiteStatus;
    unsigned char	dropAction;
    unsigned char	completionStatus;
}XmDropFinishCallbackStruct, *XmDropFinishCallback;

typedef struct _XmDragDropFinishCallbackStruct{
    int          	reason;
    XEvent          	*event;
    Time            	timeStamp;
}XmDragDropFinishCallbackStruct, *XmDragDropFinishCallback;


/********    Public Function Declarations    ********/

extern Widget XmDragStart( 
                        Widget w,
                        XEvent *event,
                        ArgList args,
                        Cardinal numArgs) ;
extern void XmDragCancel( 
                        Widget dragContext) ;
extern Boolean XmTargetsAreCompatible( 
                        Display *dpy,
                        Atom *exportTargets,
                        Cardinal numExportTargets,
                        Atom *importTargets,
                        Cardinal numImportTargets) ;

/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _DragController_h */
/* DON'T ADD STUFF AFTER THIS #endif */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DragC.h>)

\<a id="gallery.component.dragiconobjectclass"\>\</a\>

### `xm.dragiconobjectclass`
- Class: `xmDragIconObjectClass`
- Example: `gallery.source.dragiconobjectclass`
- Interaction: `gallery.interaction.dragiconobjectclass`
- Screenshot: `gallery.screenshot.dragiconobjectclass`
- Capability: inventory-only

**Demo**

![xmDragIconObjectClass in the component demo](<gallery-screenshots/xm-dragiconobjectclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* 
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
*/ 
#ifndef _XmDragIcon_h
#define _XmDragIcon_h

#include <Xm/Xm.h>

#ifdef __cplusplus
extern "C" {
#endif


#define XmIsDragIconObjectClass(w) (XtIsSubclass(w, xmDragIconObjectClass))

enum {
	XmATTACH_NORTH_WEST,
	XmATTACH_NORTH,
	XmATTACH_NORTH_EAST,
	XmATTACH_EAST,
	XmATTACH_SOUTH_EAST,
	XmATTACH_SOUTH,
	XmATTACH_SOUTH_WEST,
	XmATTACH_WEST,
	XmATTACH_CENTER,
	XmATTACH_HOT
};

typedef struct _XmDragIconRec *XmDragIconObject;
typedef struct _XmDragIconClassRec *XmDragIconObjectClass;
externalref WidgetClass xmDragIconObjectClass;


/********    Public Function Declarations    ********/

extern Widget XmCreateDragIcon( 
                        Widget parent,
                        String name,
                        ArgList argList,
                        Cardinal argCount) ;

/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmDragIcon_h */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DragIcon.h>)

\<a id="gallery.component.dragovershellwidgetclass"\>\</a\>

### `xm.dragovershellwidgetclass`
- Class: `xmDragOverShellWidgetClass`
- Example: `gallery.source.dragovershellwidgetclass`
- Interaction: `gallery.interaction.dragovershellwidgetclass`
- Screenshot: `gallery.screenshot.dragovershellwidgetclass`
- Capability: constructible

**Demo**

![xmDragOverShellWidgetClass in the component demo](<gallery-screenshots/xm-dragovershellwidgetclass.png>)

**Source**

Actual gallery factory for xmDragOverShellWidgetClass. The gallery host supplies the function arguments. Helpers are defined in gallery\_examples.c.

```c
Widget
gallery_create_drag_source_example(Widget parent, XtCallbackProc callback,
                                   XtPointer client_data)
{
    Widget source = XtVaCreateManagedWidget(
        "dragSource", xmDrawingAreaWidgetClass, parent,
        XmNwidth, 320, XmNheight, 80, NULL);
    sample_label(source, "dragHint", "Press and drag from this area");
    if (callback)
        XtAddCallback(source, XmNinputCallback, callback, client_data);
    return source;
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DragOverS.h>)

\<a id="gallery.component.drawnbuttonwidgetclass"\>\</a\>

### `xm.drawnbuttonwidgetclass`
- Class: `xmDrawnButtonWidgetClass`
- Example: `gallery.source.drawnbuttonwidgetclass`
- Interaction: `gallery.interaction.drawnbuttonwidgetclass`
- Screenshot: `gallery.screenshot.drawnbuttonwidgetclass`
- Capability: constructible

**Demo**

![xmDrawnButtonWidgetClass in the component demo](<gallery-screenshots/xm-drawnbuttonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDrawnButtonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Open document");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNlabelString, label, NULL);
if (class == xmIconButtonWidgetClass) gallery_bind_icon(example,XmNpixmap,"action_open");
else if (class == xmIconGadgetClass) gallery_bind_icon(example,XmNlargeIconPixmap,"action_document");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DrawnB.h>)

\<a id="gallery.component.formwidgetclass"\>\</a\>

### `xm.formwidgetclass`
- Class: `xmFormWidgetClass`
- Example: `gallery.source.formwidgetclass`
- Interaction: `gallery.interaction.formwidgetclass`
- Screenshot: `gallery.screenshot.formwidgetclass`
- Capability: constructible

**Demo**

![xmFormWidgetClass in the component demo](<gallery-screenshots/xm-formwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmFormWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Form.h>)

\<a id="gallery.component.framewidgetclass"\>\</a\>

### `xm.framewidgetclass`
- Class: `xmFrameWidgetClass`
- Example: `gallery.source.framewidgetclass`
- Interaction: `gallery.interaction.framewidgetclass`
- Screenshot: `gallery.screenshot.framewidgetclass`
- Capability: constructible

**Demo**

![xmFrameWidgetClass in the component demo](<gallery-screenshots/xm-framewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmFrameWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Frame.h>)

\<a id="gallery.component.gadgetclass"\>\</a\>

### `xm.gadgetclass`
- Class: `xmGadgetClass`
- Example: `gallery.source.gadgetclass`
- Interaction: `gallery.interaction.gadgetclass`
- Screenshot: `gallery.screenshot.gadgetclass`
- Capability: inventory-only

**Demo**

![xmGadgetClass in the component demo](<gallery-screenshots/xm-gadgetclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* $XConsortium: Gadget.h /main/5 1995/07/15 20:51:03 drk $ */
/*
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
 */
/*
 * HISTORY
 */
#ifndef _XmGadget_h
#define _XmGadget_h

#include <Xm/Xm.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef XmIsGadget
#define XmIsGadget(w) XtIsSubclass(w, xmGadgetClass)
#endif /* XmIsGadget */

externalref WidgetClass xmGadgetClass;

typedef struct _XmGadgetClassRec * XmGadgetClass;
typedef struct _XmGadgetRec      * XmGadget;


/********    Public Function Declarations    ********/


/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmGadget_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Gadget.h>)

\<a id="gallery.component.mainwindowwidgetclass"\>\</a\>

### `xm.mainwindowwidgetclass`
- Class: `xmMainWindowWidgetClass`
- Example: `gallery.source.mainwindowwidgetclass`
- Interaction: `gallery.interaction.mainwindowwidgetclass`
- Screenshot: `gallery.screenshot.mainwindowwidgetclass`
- Capability: constructible

**Demo**

![xmMainWindowWidgetClass in the component demo](<gallery-screenshots/xm-mainwindowwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmMainWindowWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/MainW.h>)

\<a id="gallery.component.managerwidgetclass"\>\</a\>

### `xm.managerwidgetclass`
- Class: `xmManagerWidgetClass`
- Example: `gallery.source.managerwidgetclass`
- Interaction: `gallery.interaction.managerwidgetclass`
- Screenshot: `gallery.screenshot.managerwidgetclass`
- Capability: inventory-only

**Demo**

![xmManagerWidgetClass in the component demo](<gallery-screenshots/xm-managerwidgetclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* $XConsortium: Manager.h /main/5 1995/07/15 20:52:43 drk $ */
/*
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
 */
/*
 * HISTORY
 */
#ifndef _XmManager_h
#define _XmManager_h

#include <Xm/Xm.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef XmIsManager
#define XmIsManager(w) XtIsSubclass(w, xmManagerWidgetClass)
#endif /* XmIsManager */

externalref WidgetClass xmManagerWidgetClass;

typedef struct _XmManagerClassRec * XmManagerWidgetClass;
typedef struct _XmManagerRec      * XmManagerWidget;


/********    Public Function Declarations    ********/


/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmManager_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Manager.h>)

\<a id="gallery.component.treeviewwidgetclass"\>\</a\>

### `xm.treeviewwidgetclass`
- Class: `xmTreeViewWidgetClass`
- Example: `gallery.source.treeviewwidgetclass`
- Interaction: `gallery.interaction.treeviewwidgetclass`
- Screenshot: `gallery.screenshot.treeviewwidgetclass`
- Capability: constructible

**Demo**

![xmTreeViewWidgetClass in the component demo](<gallery-screenshots/xm-treeviewwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTreeViewWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
static const XmTreeViewNode nodes[] = {
    {(XtPointer)"root", NULL, "Project", True, True},
    {(XtPointer)"src", (XtPointer)"root", "Source", True, True},
    {(XtPointer)"gallery", (XtPointer)"src", "Gallery", False, False},
    {(XtPointer)"docs", (XtPointer)"root", "Documentation", False, False}
};
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNtreeViewVisibleRows, 5, NULL);
XmTreeViewSetNodes(example, nodes, XtNumber(nodes));
XmTreeViewSetSelectedId(example, (XtPointer)"gallery", False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/TreeView.h>)

\<a id="gallery.component.dividerwidgetclass"\>\</a\>

### `xm.dividerwidgetclass`
- Class: `xmDividerWidgetClass`
- Example: `gallery.source.dividerwidgetclass`
- Interaction: `gallery.interaction.dividerwidgetclass`
- Screenshot: `gallery.screenshot.dividerwidgetclass`
- Capability: constructible

**Demo**

![xmDividerWidgetClass in the component demo](<gallery-screenshots/xm-dividerwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDividerWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Presentation");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNdividerLabel, label, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Divider.h>)

\<a id="gallery.component.formsectionwidgetclass"\>\</a\>

### `xm.formsectionwidgetclass`
- Class: `xmFormSectionWidgetClass`
- Example: `gallery.source.formsectionwidgetclass`
- Interaction: `gallery.interaction.formsectionwidgetclass`
- Screenshot: `gallery.screenshot.formsectionwidgetclass`
- Capability: constructible

**Demo**

![xmFormSectionWidgetClass in the component demo](<gallery-screenshots/xm-formsectionwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmFormSectionWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/FormSection.h>)

\<a id="gallery.component.rowactionswidgetclass"\>\</a\>

### `xm.rowactionswidgetclass`
- Class: `xmRowActionsWidgetClass`
- Example: `gallery.source.rowactionswidgetclass`
- Interaction: `gallery.interaction.rowactionswidgetclass`
- Screenshot: `gallery.screenshot.rowactionswidgetclass`
- Capability: constructible

**Demo**

![xmRowActionsWidgetClass in the component demo](<gallery-screenshots/xm-rowactionswidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmRowActionsWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
    XmString captions[3], shortcuts[3];
    const char *names[] = {"Open document", "Save changes", "Export PDF"};
    const char *keys[] = {"Ctrl+O", "Ctrl+S", "Ctrl+E"};
    XmCommandPaletteItem commands[3];
    XmRowActionItem actions[3];
    unsigned int i;
    example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
    for (i = 0; i < 3; ++i) {
        captions[i] = XmStringCreateLocalized((char *)names[i]);
        shortcuts[i] = XmStringCreateLocalized((char *)keys[i]);
        commands[i] = (XmCommandPaletteItem){names[i], captions[i], shortcuts[i], NULL};
        actions[i] = (XmRowActionItem){names[i], captions[i], shortcuts[i], NULL};
    }
    if (class == xmCommandPaletteWidgetClass) {
        XmCommandPaletteSetItems(example, commands, 3); XmCommandPaletteShow(example);
} else {
        XmRowActionsSetItems(example, actions, 3); XmRowActionsReveal(example, True);
    }
    for (i = 0; i < 3; ++i) { XmStringFree(captions[i]); XmStringFree(shortcuts[i]); }
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/RowActions.h>)

\<a id="gallery.component.statusbarwidgetclass"\>\</a\>

### `xm.statusbarwidgetclass`
- Class: `xmStatusBarWidgetClass`
- Example: `gallery.source.statusbarwidgetclass`
- Interaction: `gallery.interaction.statusbarwidgetclass`
- Screenshot: `gallery.screenshot.statusbarwidgetclass`
- Capability: constructible

**Demo**

![xmStatusBarWidgetClass in the component demo](<gallery-screenshots/xm-statusbarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmStatusBarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmStatusBarItem item = {0};
label = XmStringCreateLocalized((char *)"All changes saved");
item.id = "save"; item.label = label; item.kind = XmSTATUS_BAR_ITEM_TEXT;
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmStatusBarSetItems(example, &item, 1);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/StatusBar.h>)

\<a id="gallery.component.toolbarwidgetclass"\>\</a\>

### `xm.toolbarwidgetclass`
- Class: `xmToolbarWidgetClass`
- Example: `gallery.source.toolbarwidgetclass`
- Interaction: `gallery.interaction.toolbarwidgetclass`
- Screenshot: `gallery.screenshot.toolbarwidgetclass`
- Capability: constructible

**Demo**

![xmToolbarWidgetClass in the component demo](<gallery-screenshots/xm-toolbarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmToolbarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmToolbarAction actions[4];
XmString labels[4];
XmString shortcuts[4];
labels[0] = XmStringCreateLocalized((char *)"Open");
labels[1] = XmStringCreateLocalized((char *)"Save");
labels[2] = XmStringCreateLocalized((char *)"Print");
labels[3] = XmStringCreateLocalized((char *)"Undo");
shortcuts[0] = XmStringCreateLocalized((char *)"Ctrl+O");
shortcuts[1] = XmStringCreateLocalized((char *)"Ctrl+S");
shortcuts[2] = XmStringCreateLocalized((char *)"Ctrl+P");
shortcuts[3] = XmStringCreateLocalized((char *)"Ctrl+Z");
actions[0] = (XmToolbarAction){"open", labels[0], shortcuts[0], False, 0, NULL};
actions[1] = (XmToolbarAction){"save", labels[1], shortcuts[1], False, 0, NULL};
actions[2] = (XmToolbarAction){"print", labels[2], shortcuts[2], True, 5, NULL};
actions[3] = (XmToolbarAction){"undo", labels[3], shortcuts[3], True, 4, NULL};
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmToolbarSetActions(example, actions, 4);
{
    static const char *const icons[]={"action_open","action_save","action_print","action_undo"};
    static const Boolean overflow_modes[] = {False, True};
    for (Cardinal i = 0; i < XtNumber(icons); ++i) {
        for (Cardinal mode = 0; mode < XtNumber(overflow_modes); ++mode) {
            Widget button = XmToolbarGetActionButton(example, i,
                                                     overflow_modes[mode]);
            if (!button) continue;
            /* Rasterize transparent image pixels against the actual
             * normal/pressed surface, not the toolbar's background. */
            gallery_bind_icon(button, XmNlabelPixmap, icons[i]);
            gallery_bind_icon(button, XmNarmPixmap, icons[i]);
            gallery_bind_icon(button, XmNlabelInsensitivePixmap, icons[i]);
            XtVaSetValues(button, XmNlabelType, XmPIXMAP, NULL);
        }
    }
}
if (callback)
    XtAddCallback(example, XmNtoolbarActivateCallback, callback, client_data);
XmStringFree(labels[0]); XmStringFree(labels[1]);
XmStringFree(labels[2]); XmStringFree(labels[3]);
XmStringFree(shortcuts[0]); XmStringFree(shortcuts[1]);
XmStringFree(shortcuts[2]); XmStringFree(shortcuts[3]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Toolbar.h>)

\<a id="gallery.component.sidebarwidgetclass"\>\</a\>

### `xm.sidebarwidgetclass`
- Class: `xmSidebarWidgetClass`
- Example: `gallery.source.sidebarwidgetclass`
- Interaction: `gallery.interaction.sidebarwidgetclass`
- Screenshot: `gallery.screenshot.sidebarwidgetclass`
- Capability: constructible

**Demo**

![xmSidebarWidgetClass in the component demo](<gallery-screenshots/xm-sidebarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSidebarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget content;
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
if (class == xmDisclosureWidgetClass) {
    label = XmStringCreateLocalized((char *)"Document options");
    XtVaSetValues(example, XmNlabelString, label, NULL);
}
content = class == xmDisclosureWidgetClass ? XmDisclosureGetContent(example) : XmSidebarGetContent(example);
sample_label(content, "sectionTitle", class == xmDisclosureWidgetClass ?
    "Backup settings" : "Document options");
sample_label(content, "explanation", "Expand or collapse\nthis group of settings.");
XmString caption = XmStringCreateLocalized((char *)"Keep a backup copy");
XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, content,
    XmNlabelString, caption, XmNset, True, NULL);
XmStringFree(caption);
if (class == xmDisclosureWidgetClass) XmDisclosureSetExpanded(example, True, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Sidebar.h>)

\<a id="gallery.component.notebookwidgetclass"\>\</a\>

### `xm.notebookwidgetclass`
- Class: `xmNotebookWidgetClass`
- Example: `gallery.source.notebookwidgetclass`
- Interaction: `gallery.interaction.notebookwidgetclass`
- Screenshot: `gallery.screenshot.notebookwidgetclass`
- Capability: constructible

**Demo**

![xmNotebookWidgetClass in the component demo](<gallery-screenshots/xm-notebookwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmNotebookWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
unsigned int i;
const char *names[] = {"Overview", "Details", "Activity"};
const char *contents[] = {"Project overview\n\nRelated pages in one place.",
    "Document details\n\nSwitch pages with the tabs.",
    "Recent activity\n\nCreated document\nSaved changes\nExported report"};
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
for (i = 0; i < 3; ++i) {
    XmString value = XmStringCreateLocalized((char *)contents[i]);
    XtVaCreateManagedWidget("page", xmLabelWidgetClass, example,
        XmNnotebookChildType, XmPAGE, XmNpageNumber, (int)i + 1,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)names[i]);
    XtVaCreateManagedWidget("tab", xmPushButtonWidgetClass, example,
        XmNnotebookChildType, XmMAJOR_TAB, XmNpageNumber, (int)i + 1,
        XmNlabelString, value, NULL);
    XmStringFree(value);
}
XtVaSetValues(example, XmNcurrentPageNumber, 1, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Notebook.h>)

\<a id="gallery.component.panedwindowwidgetclass"\>\</a\>

### `xm.panedwindowwidgetclass`
- Class: `xmPanedWindowWidgetClass`
- Example: `gallery.source.panedwindowwidgetclass`
- Interaction: `gallery.interaction.panedwindowwidgetclass`
- Screenshot: `gallery.screenshot.panedwindowwidgetclass`
- Capability: constructible

**Demo**

![xmPanedWindowWidgetClass in the component demo](<gallery-screenshots/xm-panedwindowwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmPanedWindowWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/PanedW.h>)

\<a id="gallery.component.panedwidgetclass"\>\</a\>

### `xm.panedwidgetclass`
- Class: `xmPanedWidgetClass`
- Example: `gallery.source.panedwidgetclass`
- Interaction: `gallery.interaction.panedwidgetclass`
- Screenshot: `gallery.screenshot.panedwidgetclass`
- Capability: constructible

**Demo**

![xmPanedWidgetClass in the component demo](<gallery-screenshots/xm-panedwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmPanedWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Paned.h>)

\<a id="gallery.component.primitivewidgetclass"\>\</a\>

### `xm.primitivewidgetclass`
- Class: `xmPrimitiveWidgetClass`
- Example: `gallery.source.primitivewidgetclass`
- Interaction: `gallery.interaction.primitivewidgetclass`
- Screenshot: `gallery.screenshot.primitivewidgetclass`
- Capability: inventory-only

**Demo**

![xmPrimitiveWidgetClass in the component demo](<gallery-screenshots/xm-primitivewidgetclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* $XConsortium: Primitive.h /main/5 1995/07/15 20:54:22 drk $ */
/*
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
 */
/*
 * HISTORY
 */
#ifndef _XmPrimitive_h
#define _XmPrimitive_h

#include <Xm/Xm.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef XmIsPrimitive
#define XmIsPrimitive(w) XtIsSubclass(w, xmPrimitiveWidgetClass)
#endif /* XmIsPrimitive */

externalref WidgetClass xmPrimitiveWidgetClass;

typedef struct _XmPrimitiveClassRec * XmPrimitiveWidgetClass;
typedef struct _XmPrimitiveRec      * XmPrimitiveWidget;


/********    Public Function Declarations    ********/


/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmPrimitive_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Primitive.h>)

\<a id="gallery.component.printshellwidgetclass"\>\</a\>

### `xm.printshellwidgetclass`
- Class: `xmPrintShellWidgetClass`
- Example: `gallery.source.printshellwidgetclass`
- Interaction: `gallery.interaction.printshellwidgetclass`
- Screenshot: `gallery.screenshot.printshellwidgetclass`
- Capability: constructible

**Demo**

![xmPrintShellWidgetClass in the component demo](<gallery-screenshots/xm-printshellwidgetclass.png>)

**Source**

Actual gallery factory for xmPrintShellWidgetClass. The gallery host supplies the function arguments. Helpers are defined in gallery\_examples.c.

```c
Widget
gallery_create_shell_example(Widget parent, WidgetClass class,
                             const char *name)
{
    if (class == xmDialogShellWidgetClass) {
        Widget owner = parent;
        while (owner && !XtIsShell(owner)) owner = XtParent(owner);
        if (!owner) return NULL;
        Widget shell = XtVaCreatePopupShell((char *)name, class, owner,
            XmNtitle, "Dialog Shell example", XmNtransientFor, owner,
            XmNallowShellResize, True, XmNdeleteResponse, XmDO_NOTHING, NULL);
        Widget content = XtVaCreateWidget("dialogContent", xmFormWidgetClass, shell,
            XmNdefaultPosition, True, XmNautoUnmanage, False,
            XmNmarginWidth, 24, XmNmarginHeight, 24, NULL);
        XmString title = XmStringCreateLocalized("Dialog Shell example");
        Widget heading = XtVaCreateManagedWidget("dialogHeading", xmLabelWidgetClass, content,
            XmNlabelString, title, XmNappearanceRole, XmAPPEARANCE_ROLE_SECTION,
            XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM,
            XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(title);
        XmString message = XmStringCreateLocalized(
            "This window contains a managed dialog.\nClose it and open it again from the gallery.");
        Widget body = XtVaCreateManagedWidget("dialogMessage", xmLabelWidgetClass, content,
            XmNlabelString, message, XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, heading, XmNtopOffset, 12,
            XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(message);
        XmString label = XmStringCreateLocalized("Close");
        Widget close = XtVaCreateManagedWidget("closeExample", xmPushButtonWidgetClass, content,
            XmNlabelString, label, XmNtopAttachment, XmATTACH_WIDGET,
            XmNtopWidget, body, XmNtopOffset, 16,
            XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL);
        XmStringFree(label);
        XtVaSetValues(content, XmNdefaultButton, close, XmNcancelButton, close,
                      XmNinitialFocus, close, NULL);
        XtAddCallback(close, XmNactivateCallback, close_shell_example, content);
        XmAddWMProtocolCallback(shell, XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False),
                                close_shell_example, content);
        return shell;
    }
    Arg args[2];
    XtSetArg(args[0], XmNwidth, 240);
    XtSetArg(args[1], XmNheight, 96);
    Widget shell = XtCreatePopupShell((char *)name, class, parent, args, 2);
    XmString label = XmStringCreateLocalized((char *)"Popup shell example");
    if (class == xmMenuShellWidgetClass) {
        Widget menu = XtVaCreateWidget(
            "popupContent", xmRowColumnWidgetClass, shell,
            XmNrowColumnType, XmMENU_POPUP, NULL);
        XtVaCreateManagedWidget("popupAction", xmPushButtonWidgetClass, menu,
                                XmNlabelString, label, NULL);
    } else {
        XtVaCreateManagedWidget("popupContent", xmLabelWidgetClass, shell,
                                XmNlabelString, label, NULL);
    }
    XmStringFree(label);
    return shell;
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Print.h>)

\<a id="gallery.component.rowcolumnwidgetclass"\>\</a\>

### `xm.rowcolumnwidgetclass`
- Class: `xmRowColumnWidgetClass`
- Example: `gallery.source.rowcolumnwidgetclass`
- Interaction: `gallery.interaction.rowcolumnwidgetclass`
- Screenshot: `gallery.screenshot.rowcolumnwidgetclass`
- Capability: constructible

**Demo**

![xmRowColumnWidgetClass in the component demo](<gallery-screenshots/xm-rowcolumnwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmRowColumnWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/RowColumn.h>)

\<a id="gallery.component.screenclass"\>\</a\>

### `xm.screenclass`
- Class: `xmScreenClass`
- Example: `gallery.source.screenclass`
- Interaction: `gallery.interaction.screenclass`
- Screenshot: `gallery.screenshot.screenclass`
- Capability: inventory-only

**Demo**

![xmScreenClass in the component demo](<gallery-screenshots/xm-screenclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* 
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
*/ 

#ifndef _XmScreen_h
#define _XmScreen_h

#include <Xm/Xm.h>
#ifdef __cplusplus
extern "C" {
#endif

#ifndef XmIsScreen
#define XmIsScreen(w) (XtIsSubclass(w, xmScreenClass))
#endif /* XmIsScreen */

/* Class record constants */

typedef struct _XmScreenRec *XmScreen;
typedef struct _XmScreenClassRec *XmScreenClass;
externalref 	WidgetClass xmScreenClass;


/********    Public Function Declarations    ********/

typedef void (*XmScreenColorProc) (Screen * screen, 
				   XColor *bg_color, XColor *fg_color,
				   XColor *sel_color, XColor *ts_color, 
				   XColor *bs_color);
typedef Status (*XmAllocColorProc) (Display *display,
				    Colormap colormap,
				    XColor *screen_in_out);
extern Widget XmGetXmScreen( 
                        Screen *screen) ;
/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmScreen_h */

```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Screen.h>)

\<a id="gallery.component.scrolledwindowwidgetclass"\>\</a\>

### `xm.scrolledwindowwidgetclass`
- Class: `xmScrolledWindowWidgetClass`
- Example: `gallery.source.scrolledwindowwidgetclass`
- Interaction: `gallery.interaction.scrolledwindowwidgetclass`
- Screenshot: `gallery.screenshot.scrolledwindowwidgetclass`
- Capability: constructible

**Demo**

![xmScrolledWindowWidgetClass in the component demo](<gallery-screenshots/xm-scrolledwindowwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmScrolledWindowWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ScrolledW.h>)

\<a id="gallery.component.selectionboxwidgetclass"\>\</a\>

### `xm.selectionboxwidgetclass`
- Class: `xmSelectionBoxWidgetClass`
- Example: `gallery.source.selectionboxwidgetclass`
- Interaction: `gallery.interaction.selectionboxwidgetclass`
- Screenshot: `gallery.screenshot.selectionboxwidgetclass`
- Capability: constructible

**Demo**

![xmSelectionBoxWidgetClass in the component demo](<gallery-screenshots/xm-selectionboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSelectionBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString values[3];
values[0] = XmStringCreateLocalized((char *)"Open document");
values[1] = XmStringCreateLocalized((char *)"Save changes");
values[2] = XmStringCreateLocalized((char *)"Export report");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    class == xmCommandWidgetClass ? XmNhistoryItems : XmNlistItems, values,
    class == xmCommandWidgetClass ? XmNhistoryItemCount : XmNlistItemCount, 3,
    class == xmCommandWidgetClass ? XmNhistoryVisibleItemCount : XmNlistVisibleItemCount, 3, NULL);
XmStringFree(values[0]); XmStringFree(values[1]); XmStringFree(values[2]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/SelectioB.h>)

\<a id="gallery.component.separatorgadgetclass"\>\</a\>

### `xm.separatorgadgetclass`
- Class: `xmSeparatorGadgetClass`
- Example: `gallery.source.separatorgadgetclass`
- Interaction: `gallery.interaction.separatorgadgetclass`
- Screenshot: `gallery.screenshot.separatorgadgetclass`
- Capability: constructible

**Demo**

![xmSeparatorGadgetClass in the component demo](<gallery-screenshots/xm-separatorgadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSeparatorGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
sample_label(parent, "above", "Document settings");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNy, 40, XmNwidth, 360, XmNheight, 12, NULL);
Widget below = sample_label(parent, "below", "Export options");
XtVaSetValues(below, XmNy, 68, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/SeparatoG.h>)

\<a id="gallery.component.separatorwidgetclass"\>\</a\>

### `xm.separatorwidgetclass`
- Class: `xmSeparatorWidgetClass`
- Example: `gallery.source.separatorwidgetclass`
- Interaction: `gallery.interaction.separatorwidgetclass`
- Screenshot: `gallery.screenshot.separatorwidgetclass`
- Capability: constructible

**Demo**

![xmSeparatorWidgetClass in the component demo](<gallery-screenshots/xm-separatorwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSeparatorWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
sample_label(parent, "above", "Document settings");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNy, 40, XmNwidth, 360, XmNheight, 12, NULL);
Widget below = sample_label(parent, "below", "Export options");
XtVaSetValues(below, XmNy, 68, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Separator.h>)

\<a id="gallery.component.tabboxwidgetclass"\>\</a\>

### `xm.tabboxwidgetclass`
- Class: `xmTabBoxWidgetClass`
- Example: `gallery.source.tabboxwidgetclass`
- Interaction: `gallery.interaction.tabboxwidgetclass`
- Screenshot: `gallery.screenshot.tabboxwidgetclass`
- Capability: constructible

**Demo**

![xmTabBoxWidgetClass in the component demo](<gallery-screenshots/xm-tabboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTabBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmTabbedStackList tabs = XmTabbedStackListCreate();
const char *names[] = {"Overview", "Details", "Activity"};
unsigned int i;
for (i = 0; i < 3; ++i) {
    XmString value = XmStringCreateLocalized((char *)names[i]);
    XmTabbedStackListSimpleAppend(tabs, value);
    XmStringFree(value);
}

example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNtabList, tabs, NULL);
XmTabbedStackListFree(tabs);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/TabBox.h>)

\<a id="gallery.component.tabstackwidgetclass"\>\</a\>

### `xm.tabstackwidgetclass`
- Class: `xmTabStackWidgetClass`
- Example: `gallery.source.tabstackwidgetclass`
- Interaction: `gallery.interaction.tabstackwidgetclass`
- Screenshot: `gallery.screenshot.tabstackwidgetclass`
- Capability: constructible

**Demo**

![xmTabStackWidgetClass in the component demo](<gallery-screenshots/xm-tabstackwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTabStackWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
/* TabStack is a manager: an empty instance is only a frame.  Build
 * three real tab pages so the gallery shows the widget's defining
 * interaction rather than metadata or a placeholder label. */
XmString tab_labels[3];
XmString page_text;
Widget page;
tab_labels[0] = XmStringCreateLocalized((char *)"Overview");
tab_labels[1] = XmStringCreateLocalized((char *)"Details");
tab_labels[2] = XmStringCreateLocalized((char *)"Activity");
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
page_text = XmStringCreateLocalized((char *)"Overview content");
page = XtVaCreateManagedWidget("overviewPage", xmLabelWidgetClass,
                              example, XmNtabLabelString, tab_labels[0],
                              XmNlabelString, page_text, NULL);
XmStringFree(page_text);
(void)page;
page_text = XmStringCreateLocalized((char *)"Details content");
page = XtVaCreateManagedWidget("detailsPage", xmLabelWidgetClass,
                              example, XmNtabLabelString, tab_labels[1],
                              XmNlabelString, page_text, NULL);
XmStringFree(page_text);
(void)page;
page_text = XmStringCreateLocalized((char *)"Activity content");
page = XtVaCreateManagedWidget("activityPage", xmLabelWidgetClass,
                              example, XmNtabLabelString, tab_labels[2],
                              XmNlabelString, page_text, NULL);
XmStringFree(page_text);
(void)page;
XmStringFree(tab_labels[0]); XmStringFree(tab_labels[1]);
XmStringFree(tab_labels[2]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/TabStack.h>)

## feedback-dialogs

\<a id="gallery.component.colorselectorwidgetclass"\>\</a\>

### `xm.colorselectorwidgetclass`
- Class: `xmColorSelectorWidgetClass`
- Example: `gallery.source.colorselectorwidgetclass`
- Interaction: `gallery.interaction.colorselectorwidgetclass`
- Screenshot: `gallery.screenshot.colorselectorwidgetclass`
- Capability: constructible

**Demo**

![xmColorSelectorWidgetClass in the component demo](<gallery-screenshots/xm-colorselectorwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmColorSelectorWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
/* These legacy composites require an initial allocation before their
 * internal panes can negotiate usable child geometry. */
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 720, XmNheight, 340, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ColorS.h>)

\<a id="gallery.component.infobarwidgetclass"\>\</a\>

### `xm.infobarwidgetclass`
- Class: `xmInfoBarWidgetClass`
- Example: `gallery.source.infobarwidgetclass`
- Interaction: `gallery.interaction.infobarwidgetclass`
- Screenshot: `gallery.screenshot.infobarwidgetclass`
- Capability: constructible

**Demo**

![xmInfoBarWidgetClass in the component demo](<gallery-screenshots/xm-infobarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmInfoBarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNinfoMessage, (char *)"Changes saved",
                                  XmNinfoActionLabel, (char *)"Undo",
                                  NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/InfoBar.h>)

\<a id="gallery.component.chipwidgetclass"\>\</a\>

### `xm.chipwidgetclass`
- Class: `xmChipWidgetClass`
- Example: `gallery.source.chipwidgetclass`
- Interaction: `gallery.interaction.chipwidgetclass`
- Screenshot: `gallery.screenshot.chipwidgetclass`
- Capability: constructible

**Demo**

![xmChipWidgetClass in the component demo](<gallery-screenshots/xm-chipwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmChipWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Filter: active");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNchipLabel, label,
                                  XmNchipRemovable, True, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Chip.h>)

\<a id="gallery.component.badgewidgetclass"\>\</a\>

### `xm.badgewidgetclass`
- Class: `xmBadgeWidgetClass`
- Example: `gallery.source.badgewidgetclass`
- Interaction: `gallery.interaction.badgewidgetclass`
- Screenshot: `gallery.screenshot.badgewidgetclass`
- Capability: constructible

**Demo**

![xmBadgeWidgetClass in the component demo](<gallery-screenshots/xm-badgewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmBadgeWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Notifications");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNbadgeLabel, label,
                                  XmNbadgeCount, 3, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Badge.h>)

\<a id="gallery.component.avatarwidgetclass"\>\</a\>

### `xm.avatarwidgetclass`
- Class: `xmAvatarWidgetClass`
- Example: `gallery.source.avatarwidgetclass`
- Interaction: `gallery.interaction.avatarwidgetclass`
- Screenshot: `gallery.screenshot.avatarwidgetclass`
- Capability: constructible

**Demo**

![xmAvatarWidgetClass in the component demo](<gallery-screenshots/xm-avatarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmAvatarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"CK");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNavatarInitials, label, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Avatar.h>)

\<a id="gallery.component.emptystatewidgetclass"\>\</a\>

### `xm.emptystatewidgetclass`
- Class: `xmEmptyStateWidgetClass`
- Example: `gallery.source.emptystatewidgetclass`
- Interaction: `gallery.interaction.emptystatewidgetclass`
- Screenshot: `gallery.screenshot.emptystatewidgetclass`
- Capability: constructible

**Demo**

![xmEmptyStateWidgetClass in the component demo](<gallery-screenshots/xm-emptystatewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmEmptyStateWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Nothing selected yet");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNemptyStateMessage, label, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/EmptyState.h>)

\<a id="gallery.component.skeletonwidgetclass"\>\</a\>

### `xm.skeletonwidgetclass`
- Class: `xmSkeletonWidgetClass`
- Example: `gallery.source.skeletonwidgetclass`
- Interaction: `gallery.interaction.skeletonwidgetclass`
- Screenshot: `gallery.screenshot.skeletonwidgetclass`
- Capability: constructible

**Demo**

![xmSkeletonWidgetClass in the component demo](<gallery-screenshots/xm-skeletonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSkeletonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNwidth, 360, XmNheight, 64, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Skeleton.h>)

\<a id="gallery.component.numberboxwidgetclass"\>\</a\>

### `xm.numberboxwidgetclass`
- Class: `xmNumberBoxWidgetClass`
- Example: `gallery.source.numberboxwidgetclass`
- Interaction: `gallery.interaction.numberboxwidgetclass`
- Screenshot: `gallery.screenshot.numberboxwidgetclass`
- Capability: constructible

**Demo**

![xmNumberBoxWidgetClass in the component demo](<gallery-screenshots/xm-numberboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmNumberBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    parent = XtVaCreateManagedWidget("fieldLayout", xmRowColumnWidgetClass, parent,
        XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
        XmNadjustLast, False, XmNentryAlignment, XmALIGNMENT_BEGINNING, NULL);
    sample_label(parent, "fieldLabel",
        class == xmNumberBoxWidgetClass ? "Quantity" : "Document title");
}
```

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmNumberBoxSetRange(example, 0, 100, False);
XmNumberBoxSetValue(example, 42, False);
```

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    sample_label(parent, "fieldHelp", "Edit the value to see its change notification.");
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/NumberBox.h>)

\<a id="gallery.component.progressbarwidgetclass"\>\</a\>

### `xm.progressbarwidgetclass`
- Class: `xmProgressBarWidgetClass`
- Example: `gallery.source.progressbarwidgetclass`
- Interaction: `gallery.interaction.progressbarwidgetclass`
- Screenshot: `gallery.screenshot.progressbarwidgetclass`
- Capability: constructible

**Demo**

![xmProgressBarWidgetClass in the component demo](<gallery-screenshots/xm-progressbarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmProgressBarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNwidth, 360, NULL);
XmProgressBarSetRange(example, 0, 100, False);
XmProgressBarSetValue(example, 68, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ProgressBar.h>)

\<a id="gallery.component.progressringwidgetclass"\>\</a\>

### `xm.progressringwidgetclass`
- Class: `xmProgressRingWidgetClass`
- Example: `gallery.source.progressringwidgetclass`
- Interaction: `gallery.interaction.progressringwidgetclass`
- Screenshot: `gallery.screenshot.progressringwidgetclass`
- Capability: constructible

**Demo**

![xmProgressRingWidgetClass in the component demo](<gallery-screenshots/xm-progressringwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmProgressRingWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmProgressRingSetRange(example, 0, 100, False);
XmProgressRingSetValue(example, 68, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ProgressRing.h>)

## commands-navigation

\<a id="gallery.component.combinationbox2widgetclass"\>\</a\>

### `xm.combinationbox2widgetclass`
- Class: `xmCombinationBox2WidgetClass`
- Example: `gallery.source.combinationbox2widgetclass`
- Interaction: `gallery.interaction.combinationbox2widgetclass`
- Screenshot: `gallery.screenshot.combinationbox2widgetclass`
- Capability: constructible

**Demo**

![xmCombinationBox2WidgetClass in the component demo](<gallery-screenshots/xm-combinationbox2widgetclass.png>)

**Source**

Actual gallery excerpt: class = xmCombinationBox2WidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString values[3];
values[0] = XmStringCreateLocalized((char *)"Draft");
values[1] = XmStringCreateLocalized((char *)"Reviewed");
values[2] = XmStringCreateLocalized((char *)"Published");
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmListAddItems(XmDropDownGetList(example), values, 3, 1);
XmTextFieldSetString(XmDropDownGetText(example), "Draft");
label = XmStringCreateLocalized((char *)"Status");
XtVaSetValues(XmDropDownGetLabel(example), XmNlabelString, label, NULL);
XmStringFree(values[0]); XmStringFree(values[1]); XmStringFree(values[2]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ComboBox2.h>)

\<a id="gallery.component.disclosurewidgetclass"\>\</a\>

### `xm.disclosurewidgetclass`
- Class: `xmDisclosureWidgetClass`
- Example: `gallery.source.disclosurewidgetclass`
- Interaction: `gallery.interaction.disclosurewidgetclass`
- Screenshot: `gallery.screenshot.disclosurewidgetclass`
- Capability: constructible

**Demo**

![xmDisclosureWidgetClass in the component demo](<gallery-screenshots/xm-disclosurewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDisclosureWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget content;
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
if (class == xmDisclosureWidgetClass) {
    label = XmStringCreateLocalized((char *)"Document options");
    XtVaSetValues(example, XmNlabelString, label, NULL);
}
content = class == xmDisclosureWidgetClass ? XmDisclosureGetContent(example) : XmSidebarGetContent(example);
sample_label(content, "sectionTitle", class == xmDisclosureWidgetClass ?
    "Backup settings" : "Document options");
sample_label(content, "explanation", "Expand or collapse\nthis group of settings.");
XmString caption = XmStringCreateLocalized((char *)"Keep a backup copy");
XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, content,
    XmNlabelString, caption, XmNset, True, NULL);
XmStringFree(caption);
if (class == xmDisclosureWidgetClass) XmDisclosureSetExpanded(example, True, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Disclosure.h>)

\<a id="gallery.component.cascadebuttonwidgetclass"\>\</a\>

### `xm.cascadebuttonwidgetclass`
- Class: `xmCascadeButtonWidgetClass`
- Example: `gallery.source.cascadebuttonwidgetclass`
- Interaction: `gallery.interaction.cascadebuttonwidgetclass`
- Screenshot: `gallery.screenshot.cascadebuttonwidgetclass`
- Capability: constructible

**Demo**

![xmCascadeButtonWidgetClass in the component demo](<gallery-screenshots/xm-cascadebuttonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmCascadeButtonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget bar = parent;
unsigned char type = XmWORK_AREA;
if (XmIsRowColumn(parent)) XtVaGetValues(parent, XmNrowColumnType, &type, NULL);
if (type != XmMENU_BAR) {
    bar = XmCreateMenuBar(parent, "fileMenuBar", NULL, 0);
    XtManageChild(bar);
}
Widget menu = XmCreatePulldownMenu(bar, "fileMenu", NULL, 0);
const char *actions[] = {"Open document", "Save changes", "Close document"};
unsigned int i;
for (i = 0; i < XtNumber(actions); ++i) {
    XmString value = XmStringCreateLocalized((char *)actions[i]);
    Widget item = XtVaCreateManagedWidget("action", xmPushButtonWidgetClass,
        menu, XmNlabelString, value, NULL);
    XmStringFree(value);
    if (callback) XtAddCallback(item, XmNactivateCallback, callback, client_data);
}
label = XmStringCreateLocalized((char *)"File");
example = XtVaCreateManagedWidget((char *)name, class, bar,
    XmNlabelString, label, XmNsubMenuId, menu, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/CascadeB.h>)

\<a id="gallery.component.cascadebuttongadgetclass"\>\</a\>

### `xm.cascadebuttongadgetclass`
- Class: `xmCascadeButtonGadgetClass`
- Example: `gallery.source.cascadebuttongadgetclass`
- Interaction: `gallery.interaction.cascadebuttongadgetclass`
- Screenshot: `gallery.screenshot.cascadebuttongadgetclass`
- Capability: constructible

**Demo**

![xmCascadeButtonGadgetClass in the component demo](<gallery-screenshots/xm-cascadebuttongadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmCascadeButtonGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget bar = parent;
unsigned char type = XmWORK_AREA;
if (XmIsRowColumn(parent)) XtVaGetValues(parent, XmNrowColumnType, &type, NULL);
if (type != XmMENU_BAR) {
    bar = XmCreateMenuBar(parent, "fileMenuBar", NULL, 0);
    XtManageChild(bar);
}
Widget menu = XmCreatePulldownMenu(bar, "fileMenu", NULL, 0);
const char *actions[] = {"Open document", "Save changes", "Close document"};
unsigned int i;
for (i = 0; i < XtNumber(actions); ++i) {
    XmString value = XmStringCreateLocalized((char *)actions[i]);
    Widget item = XtVaCreateManagedWidget("action", xmPushButtonWidgetClass,
        menu, XmNlabelString, value, NULL);
    XmStringFree(value);
    if (callback) XtAddCallback(item, XmNactivateCallback, callback, client_data);
}
label = XmStringCreateLocalized((char *)"File");
example = XtVaCreateManagedWidget((char *)name, class, bar,
    XmNlabelString, label, XmNsubMenuId, menu, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/CascadeBG.h>)

\<a id="gallery.component.comboboxwidgetclass"\>\</a\>

### `xm.comboboxwidgetclass`
- Class: `xmComboBoxWidgetClass`
- Example: `gallery.source.comboboxwidgetclass`
- Interaction: `gallery.interaction.comboboxwidgetclass`
- Screenshot: `gallery.screenshot.comboboxwidgetclass`
- Capability: constructible

**Demo**

![xmComboBoxWidgetClass in the component demo](<gallery-screenshots/xm-comboboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmComboBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString rows[3];
rows[0] = XmStringCreateLocalized((char *)"Alpha");
rows[1] = XmStringCreateLocalized((char *)"Beta");
rows[2] = XmStringCreateLocalized((char *)"Gamma");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNitems, rows, XmNitemCount, 3,
                                  XmNvisibleItemCount, 3, NULL);
XmStringFree(rows[0]); XmStringFree(rows[1]); XmStringFree(rows[2]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ComboBox.h>)

\<a id="gallery.component.commandwidgetclass"\>\</a\>

### `xm.commandwidgetclass`
- Class: `xmCommandWidgetClass`
- Example: `gallery.source.commandwidgetclass`
- Interaction: `gallery.interaction.commandwidgetclass`
- Screenshot: `gallery.screenshot.commandwidgetclass`
- Capability: constructible

**Demo**

![xmCommandWidgetClass in the component demo](<gallery-screenshots/xm-commandwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmCommandWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString values[3];
values[0] = XmStringCreateLocalized((char *)"Open document");
values[1] = XmStringCreateLocalized((char *)"Save changes");
values[2] = XmStringCreateLocalized((char *)"Export report");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    class == xmCommandWidgetClass ? XmNhistoryItems : XmNlistItems, values,
    class == xmCommandWidgetClass ? XmNhistoryItemCount : XmNlistItemCount, 3,
    class == xmCommandWidgetClass ? XmNhistoryVisibleItemCount : XmNlistVisibleItemCount, 3, NULL);
XmStringFree(values[0]); XmStringFree(values[1]); XmStringFree(values[2]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Command.h>)

\<a id="gallery.component.dialogshellwidgetclass"\>\</a\>

### `xm.dialogshellwidgetclass`
- Class: `xmDialogShellWidgetClass`
- Example: `gallery.source.dialogshellwidgetclass`
- Interaction: `gallery.interaction.dialogshellwidgetclass`
- Screenshot: `gallery.screenshot.dialogshellwidgetclass`
- Capability: constructible

**Demo**

![xmDialogShellWidgetClass in the component demo](<gallery-screenshots/xm-dialogshellwidgetclass.png>)

**Source**

Actual gallery factory for xmDialogShellWidgetClass. The gallery host supplies the function arguments. Helpers are defined in gallery\_examples.c.

```c
Widget
gallery_create_shell_example(Widget parent, WidgetClass class,
                             const char *name)
{
    if (class == xmDialogShellWidgetClass) {
        Widget owner = parent;
        while (owner && !XtIsShell(owner)) owner = XtParent(owner);
        if (!owner) return NULL;
        Widget shell = XtVaCreatePopupShell((char *)name, class, owner,
            XmNtitle, "Dialog Shell example", XmNtransientFor, owner,
            XmNallowShellResize, True, XmNdeleteResponse, XmDO_NOTHING, NULL);
        Widget content = XtVaCreateWidget("dialogContent", xmFormWidgetClass, shell,
            XmNdefaultPosition, True, XmNautoUnmanage, False,
            XmNmarginWidth, 24, XmNmarginHeight, 24, NULL);
        XmString title = XmStringCreateLocalized("Dialog Shell example");
        Widget heading = XtVaCreateManagedWidget("dialogHeading", xmLabelWidgetClass, content,
            XmNlabelString, title, XmNappearanceRole, XmAPPEARANCE_ROLE_SECTION,
            XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM,
            XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(title);
        XmString message = XmStringCreateLocalized(
            "This window contains a managed dialog.\nClose it and open it again from the gallery.");
        Widget body = XtVaCreateManagedWidget("dialogMessage", xmLabelWidgetClass, content,
            XmNlabelString, message, XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, heading, XmNtopOffset, 12,
            XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(message);
        XmString label = XmStringCreateLocalized("Close");
        Widget close = XtVaCreateManagedWidget("closeExample", xmPushButtonWidgetClass, content,
            XmNlabelString, label, XmNtopAttachment, XmATTACH_WIDGET,
            XmNtopWidget, body, XmNtopOffset, 16,
            XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL);
        XmStringFree(label);
        XtVaSetValues(content, XmNdefaultButton, close, XmNcancelButton, close,
                      XmNinitialFocus, close, NULL);
        XtAddCallback(close, XmNactivateCallback, close_shell_example, content);
        XmAddWMProtocolCallback(shell, XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False),
                                close_shell_example, content);
        return shell;
    }
    Arg args[2];
    XtSetArg(args[0], XmNwidth, 240);
    XtSetArg(args[1], XmNheight, 96);
    Widget shell = XtCreatePopupShell((char *)name, class, parent, args, 2);
    XmString label = XmStringCreateLocalized((char *)"Popup shell example");
    if (class == xmMenuShellWidgetClass) {
        Widget menu = XtVaCreateWidget(
            "popupContent", xmRowColumnWidgetClass, shell,
            XmNrowColumnType, XmMENU_POPUP, NULL);
        XtVaCreateManagedWidget("popupAction", xmPushButtonWidgetClass, menu,
                                XmNlabelString, label, NULL);
    } else {
        XtVaCreateManagedWidget("popupContent", xmLabelWidgetClass, shell,
                                XmNlabelString, label, NULL);
    }
    XmStringFree(label);
    return shell;
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DialogS.h>)

\<a id="gallery.component.fileselectionboxwidgetclass"\>\</a\>

### `xm.fileselectionboxwidgetclass`
- Class: `xmFileSelectionBoxWidgetClass`
- Example: `gallery.source.fileselectionboxwidgetclass`
- Interaction: `gallery.interaction.fileselectionboxwidgetclass`
- Screenshot: `gallery.screenshot.fileselectionboxwidgetclass`
- Capability: constructible

**Demo**

![xmFileSelectionBoxWidgetClass in the component demo](<gallery-screenshots/xm-fileselectionboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmFileSelectionBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString directory = XmStringCreateLocalized((char *)"./demos/programs/ckmotif-gallery/");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNdirectory, directory, XmNpathMode, XmPATH_MODE_RELATIVE,
    XmNlistVisibleItemCount, 5, NULL);
XmStringFree(directory);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/FileSB.h>)

\<a id="gallery.component.grabshellwidgetclass"\>\</a\>

### `xm.grabshellwidgetclass`
- Class: `xmGrabShellWidgetClass`
- Example: `gallery.source.grabshellwidgetclass`
- Interaction: `gallery.interaction.grabshellwidgetclass`
- Screenshot: `gallery.screenshot.grabshellwidgetclass`
- Capability: constructible

**Demo**

![xmGrabShellWidgetClass in the component demo](<gallery-screenshots/xm-grabshellwidgetclass.png>)

**Source**

Actual gallery factory for xmGrabShellWidgetClass. The gallery host supplies the function arguments. Helpers are defined in gallery\_examples.c.

```c
Widget
gallery_create_shell_example(Widget parent, WidgetClass class,
                             const char *name)
{
    if (class == xmDialogShellWidgetClass) {
        Widget owner = parent;
        while (owner && !XtIsShell(owner)) owner = XtParent(owner);
        if (!owner) return NULL;
        Widget shell = XtVaCreatePopupShell((char *)name, class, owner,
            XmNtitle, "Dialog Shell example", XmNtransientFor, owner,
            XmNallowShellResize, True, XmNdeleteResponse, XmDO_NOTHING, NULL);
        Widget content = XtVaCreateWidget("dialogContent", xmFormWidgetClass, shell,
            XmNdefaultPosition, True, XmNautoUnmanage, False,
            XmNmarginWidth, 24, XmNmarginHeight, 24, NULL);
        XmString title = XmStringCreateLocalized("Dialog Shell example");
        Widget heading = XtVaCreateManagedWidget("dialogHeading", xmLabelWidgetClass, content,
            XmNlabelString, title, XmNappearanceRole, XmAPPEARANCE_ROLE_SECTION,
            XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM,
            XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(title);
        XmString message = XmStringCreateLocalized(
            "This window contains a managed dialog.\nClose it and open it again from the gallery.");
        Widget body = XtVaCreateManagedWidget("dialogMessage", xmLabelWidgetClass, content,
            XmNlabelString, message, XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, heading, XmNtopOffset, 12,
            XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(message);
        XmString label = XmStringCreateLocalized("Close");
        Widget close = XtVaCreateManagedWidget("closeExample", xmPushButtonWidgetClass, content,
            XmNlabelString, label, XmNtopAttachment, XmATTACH_WIDGET,
            XmNtopWidget, body, XmNtopOffset, 16,
            XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL);
        XmStringFree(label);
        XtVaSetValues(content, XmNdefaultButton, close, XmNcancelButton, close,
                      XmNinitialFocus, close, NULL);
        XtAddCallback(close, XmNactivateCallback, close_shell_example, content);
        XmAddWMProtocolCallback(shell, XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False),
                                close_shell_example, content);
        return shell;
    }
    Arg args[2];
    XtSetArg(args[0], XmNwidth, 240);
    XtSetArg(args[1], XmNheight, 96);
    Widget shell = XtCreatePopupShell((char *)name, class, parent, args, 2);
    XmString label = XmStringCreateLocalized((char *)"Popup shell example");
    if (class == xmMenuShellWidgetClass) {
        Widget menu = XtVaCreateWidget(
            "popupContent", xmRowColumnWidgetClass, shell,
            XmNrowColumnType, XmMENU_POPUP, NULL);
        XtVaCreateManagedWidget("popupAction", xmPushButtonWidgetClass, menu,
                                XmNlabelString, label, NULL);
    } else {
        XtVaCreateManagedWidget("popupContent", xmLabelWidgetClass, shell,
                                XmNlabelString, label, NULL);
    }
    XmStringFree(label);
    return shell;
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/GrabShell.h>)

\<a id="gallery.component.menushellwidgetclass"\>\</a\>

### `xm.menushellwidgetclass`
- Class: `xmMenuShellWidgetClass`
- Example: `gallery.source.menushellwidgetclass`
- Interaction: `gallery.interaction.menushellwidgetclass`
- Screenshot: `gallery.screenshot.menushellwidgetclass`
- Capability: constructible

**Demo**

![xmMenuShellWidgetClass in the component demo](<gallery-screenshots/xm-menushellwidgetclass.png>)

**Source**

Actual gallery factory for xmMenuShellWidgetClass. The gallery host supplies the function arguments. Helpers are defined in gallery\_examples.c.

```c
Widget
gallery_create_shell_example(Widget parent, WidgetClass class,
                             const char *name)
{
    if (class == xmDialogShellWidgetClass) {
        Widget owner = parent;
        while (owner && !XtIsShell(owner)) owner = XtParent(owner);
        if (!owner) return NULL;
        Widget shell = XtVaCreatePopupShell((char *)name, class, owner,
            XmNtitle, "Dialog Shell example", XmNtransientFor, owner,
            XmNallowShellResize, True, XmNdeleteResponse, XmDO_NOTHING, NULL);
        Widget content = XtVaCreateWidget("dialogContent", xmFormWidgetClass, shell,
            XmNdefaultPosition, True, XmNautoUnmanage, False,
            XmNmarginWidth, 24, XmNmarginHeight, 24, NULL);
        XmString title = XmStringCreateLocalized("Dialog Shell example");
        Widget heading = XtVaCreateManagedWidget("dialogHeading", xmLabelWidgetClass, content,
            XmNlabelString, title, XmNappearanceRole, XmAPPEARANCE_ROLE_SECTION,
            XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM,
            XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(title);
        XmString message = XmStringCreateLocalized(
            "This window contains a managed dialog.\nClose it and open it again from the gallery.");
        Widget body = XtVaCreateManagedWidget("dialogMessage", xmLabelWidgetClass, content,
            XmNlabelString, message, XmNalignment, XmALIGNMENT_BEGINNING,
            XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, heading, XmNtopOffset, 12,
            XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL);
        XmStringFree(message);
        XmString label = XmStringCreateLocalized("Close");
        Widget close = XtVaCreateManagedWidget("closeExample", xmPushButtonWidgetClass, content,
            XmNlabelString, label, XmNtopAttachment, XmATTACH_WIDGET,
            XmNtopWidget, body, XmNtopOffset, 16,
            XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL);
        XmStringFree(label);
        XtVaSetValues(content, XmNdefaultButton, close, XmNcancelButton, close,
                      XmNinitialFocus, close, NULL);
        XtAddCallback(close, XmNactivateCallback, close_shell_example, content);
        XmAddWMProtocolCallback(shell, XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False),
                                close_shell_example, content);
        return shell;
    }
    Arg args[2];
    XtSetArg(args[0], XmNwidth, 240);
    XtSetArg(args[1], XmNheight, 96);
    Widget shell = XtCreatePopupShell((char *)name, class, parent, args, 2);
    XmString label = XmStringCreateLocalized((char *)"Popup shell example");
    if (class == xmMenuShellWidgetClass) {
        Widget menu = XtVaCreateWidget(
            "popupContent", xmRowColumnWidgetClass, shell,
            XmNrowColumnType, XmMENU_POPUP, NULL);
        XtVaCreateManagedWidget("popupAction", xmPushButtonWidgetClass, menu,
                                XmNlabelString, label, NULL);
    } else {
        XtVaCreateManagedWidget("popupContent", xmLabelWidgetClass, shell,
                                XmNlabelString, label, NULL);
    }
    XmStringFree(label);
    return shell;
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/MenuShell.h>)

\<a id="gallery.component.messageboxwidgetclass"\>\</a\>

### `xm.messageboxwidgetclass`
- Class: `xmMessageBoxWidgetClass`
- Example: `gallery.source.messageboxwidgetclass`
- Interaction: `gallery.interaction.messageboxwidgetclass`
- Screenshot: `gallery.screenshot.messageboxwidgetclass`
- Capability: constructible

**Demo**

![xmMessageBoxWidgetClass in the component demo](<gallery-screenshots/xm-messageboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmMessageBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Your changes have been saved.");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNmessageString, label, XmNdialogType, XmDIALOG_INFORMATION, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/MessageB.h>)

\<a id="gallery.component.flyoutwidgetclass"\>\</a\>

### `xm.flyoutwidgetclass`
- Class: `xmFlyoutWidgetClass`
- Example: `gallery.source.flyoutwidgetclass`
- Interaction: `gallery.interaction.flyoutwidgetclass`
- Screenshot: `gallery.screenshot.flyoutwidgetclass`
- Capability: constructible

**Demo**

![xmFlyoutWidgetClass in the component demo](<gallery-screenshots/xm-flyoutwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmFlyoutWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString caption = XmStringCreateLocalized((char *)(class == xmFlyoutWidgetClass ? "Show details" : "Show keyboard tip"));
/* Popup handles stay unmanaged. Only the trigger participates in this
 * compact owner layout, so popup placement follows the button bounds. */
Widget owner = XtVaCreateManagedWidget("popupAnchor", xmRowColumnWidgetClass, parent,
    XmNorientation, XmVERTICAL, XmNmarginWidth, 0, XmNmarginHeight, 0,
    XmNspacing, 0, NULL);
Widget trigger = XtVaCreateManagedWidget("showPopup", xmPushButtonWidgetClass, owner,
    XmNlabelString, caption, NULL);
XmStringFree(caption);
example = XtVaCreateWidget((char *)name, class, owner, NULL);
if (class == xmFlyoutWidgetClass)
    XtVaSetValues(example, XmNflyoutText, "Document details\nSaved locally and ready to export.", NULL);
if (class == xmTeachingTipWidgetClass) {
    XmString title = XmStringCreateLocalized((char *)"Move with the keyboard");
    XmString body = XmStringCreateLocalized((char *)"Press Tab to move forward and Shift+Tab to move back.");
    XtVaSetValues(example, XmNteachingTipTitle, title, XmNteachingTipText, body,
        XmNteachingTipDelay, 0, NULL);
    XmStringFree(title); XmStringFree(body);
}
XtAddCallback(trigger, XmNactivateCallback, show_popup_example, example);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Flyout.h>)

\<a id="gallery.component.teachingtipwidgetclass"\>\</a\>

### `xm.teachingtipwidgetclass`
- Class: `xmTeachingTipWidgetClass`
- Example: `gallery.source.teachingtipwidgetclass`
- Interaction: `gallery.interaction.teachingtipwidgetclass`
- Screenshot: `gallery.screenshot.teachingtipwidgetclass`
- Capability: constructible

**Demo**

![xmTeachingTipWidgetClass in the component demo](<gallery-screenshots/xm-teachingtipwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTeachingTipWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString caption = XmStringCreateLocalized((char *)(class == xmFlyoutWidgetClass ? "Show details" : "Show keyboard tip"));
/* Popup handles stay unmanaged. Only the trigger participates in this
 * compact owner layout, so popup placement follows the button bounds. */
Widget owner = XtVaCreateManagedWidget("popupAnchor", xmRowColumnWidgetClass, parent,
    XmNorientation, XmVERTICAL, XmNmarginWidth, 0, XmNmarginHeight, 0,
    XmNspacing, 0, NULL);
Widget trigger = XtVaCreateManagedWidget("showPopup", xmPushButtonWidgetClass, owner,
    XmNlabelString, caption, NULL);
XmStringFree(caption);
example = XtVaCreateWidget((char *)name, class, owner, NULL);
if (class == xmFlyoutWidgetClass)
    XtVaSetValues(example, XmNflyoutText, "Document details\nSaved locally and ready to export.", NULL);
if (class == xmTeachingTipWidgetClass) {
    XmString title = XmStringCreateLocalized((char *)"Move with the keyboard");
    XmString body = XmStringCreateLocalized((char *)"Press Tab to move forward and Shift+Tab to move back.");
    XtVaSetValues(example, XmNteachingTipTitle, title, XmNteachingTipText, body,
        XmNteachingTipDelay, 0, NULL);
    XmStringFree(title); XmStringFree(body);
}
XtAddCallback(trigger, XmNactivateCallback, show_popup_example, example);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/TeachingTip.h>)

\<a id="gallery.component.breadcrumbbarwidgetclass"\>\</a\>

### `xm.breadcrumbbarwidgetclass`
- Class: `xmBreadcrumbBarWidgetClass`
- Example: `gallery.source.breadcrumbbarwidgetclass`
- Interaction: `gallery.interaction.breadcrumbbarwidgetclass`
- Screenshot: `gallery.screenshot.breadcrumbbarwidgetclass`
- Capability: constructible

**Demo**

![xmBreadcrumbBarWidgetClass in the component demo](<gallery-screenshots/xm-breadcrumbbarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmBreadcrumbBarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmBreadcrumbSegment segments[3] = {
    {"Home", (XtPointer)"home"},
    {"Components", (XtPointer)"components"},
    {"Current", (XtPointer)"current"}
};
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmBreadcrumbBarSetSegments(example, segments, 3);
XmBreadcrumbBarSetCurrentIndex(example, 2, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/BreadcrumbBar.h>)

\<a id="gallery.component.linkwidgetclass"\>\</a\>

### `xm.linkwidgetclass`
- Class: `xmLinkWidgetClass`
- Example: `gallery.source.linkwidgetclass`
- Interaction: `gallery.interaction.linkwidgetclass`
- Screenshot: `gallery.screenshot.linkwidgetclass`
- Capability: constructible

**Demo**

![xmLinkWidgetClass in the component demo](<gallery-screenshots/xm-linkwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmLinkWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Open documentation");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlinkLabel, label,
                                  XmNlinkTarget, (char *)"docs", NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Link.h>)

\<a id="gallery.component.toastwidgetclass"\>\</a\>

### `xm.toastwidgetclass`
- Class: `xmToastWidgetClass`
- Example: `gallery.source.toastwidgetclass`
- Interaction: `gallery.interaction.toastwidgetclass`
- Screenshot: `gallery.screenshot.toastwidgetclass`
- Capability: constructible

**Demo**

![xmToastWidgetClass in the component demo](<gallery-screenshots/xm-toastwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmToastWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Document saved successfully");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNtoastMessage, label,
                                  XmNtoastTimeout, 0, NULL);
XmToastShow(example);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Toast.h>)

\<a id="gallery.component.commandpalettewidgetclass"\>\</a\>

### `xm.commandpalettewidgetclass`
- Class: `xmCommandPaletteWidgetClass`
- Example: `gallery.source.commandpalettewidgetclass`
- Interaction: `gallery.interaction.commandpalettewidgetclass`
- Screenshot: `gallery.screenshot.commandpalettewidgetclass`
- Capability: constructible

**Demo**

![xmCommandPaletteWidgetClass in the component demo](<gallery-screenshots/xm-commandpalettewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmCommandPaletteWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
    XmString captions[3], shortcuts[3];
    const char *names[] = {"Open document", "Save changes", "Export PDF"};
    const char *keys[] = {"Ctrl+O", "Ctrl+S", "Ctrl+E"};
    XmCommandPaletteItem commands[3];
    XmRowActionItem actions[3];
    unsigned int i;
    example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
    for (i = 0; i < 3; ++i) {
        captions[i] = XmStringCreateLocalized((char *)names[i]);
        shortcuts[i] = XmStringCreateLocalized((char *)keys[i]);
        commands[i] = (XmCommandPaletteItem){names[i], captions[i], shortcuts[i], NULL};
        actions[i] = (XmRowActionItem){names[i], captions[i], shortcuts[i], NULL};
    }
    if (class == xmCommandPaletteWidgetClass) {
        XmCommandPaletteSetItems(example, commands, 3); XmCommandPaletteShow(example);
} else {
        XmRowActionsSetItems(example, actions, 3); XmRowActionsReveal(example, True);
    }
    for (i = 0; i < 3; ++i) { XmStringFree(captions[i]); XmStringFree(shortcuts[i]); }
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/CommandPalette.h>)

## text-input

\<a id="gallery.component.fontselectorwidgetclass"\>\</a\>

### `xm.fontselectorwidgetclass`
- Class: `xmFontSelectorWidgetClass`
- Example: `gallery.source.fontselectorwidgetclass`
- Interaction: `gallery.interaction.fontselectorwidgetclass`
- Screenshot: `gallery.screenshot.fontselectorwidgetclass`
- Capability: constructible

**Demo**

![xmFontSelectorWidgetClass in the component demo](<gallery-screenshots/xm-fontselectorwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmFontSelectorWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
/* These legacy composites require an initial allocation before their
 * internal panes can negotiate usable child geometry. */
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 720, XmNheight, 340, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/FontS.h>)

\<a id="gallery.component.datafieldwidgetclass"\>\</a\>

### `xm.datafieldwidgetclass`
- Class: `xmDataFieldWidgetClass`
- Example: `gallery.source.datafieldwidgetclass`
- Interaction: `gallery.interaction.datafieldwidgetclass`
- Screenshot: `gallery.screenshot.datafieldwidgetclass`
- Capability: constructible

**Demo**

![xmDataFieldWidgetClass in the component demo](<gallery-screenshots/xm-datafieldwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDataFieldWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    parent = XtVaCreateManagedWidget("fieldLayout", xmRowColumnWidgetClass, parent,
        XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
        XmNadjustLast, False, XmNentryAlignment, XmALIGNMENT_BEGINNING, NULL);
    sample_label(parent, "fieldLabel",
        class == xmNumberBoxWidgetClass ? "Quantity" : "Document title");
}
```

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNvalue, (char *)"Editable sample text",
                                  XmNcolumns, 28, NULL);
```

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    sample_label(parent, "fieldHelp", "Edit the value to see its change notification.");
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DataF.h>)

\<a id="gallery.component.labelwidgetclass"\>\</a\>

### `xm.labelwidgetclass`
- Class: `xmLabelWidgetClass`
- Example: `gallery.source.labelwidgetclass`
- Interaction: `gallery.interaction.labelwidgetclass`
- Screenshot: `gallery.screenshot.labelwidgetclass`
- Capability: constructible

**Demo**

![xmLabelWidgetClass in the component demo](<gallery-screenshots/xm-labelwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmLabelWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Apply changes");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, label, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Label.h>)

\<a id="gallery.component.labelgadgetclass"\>\</a\>

### `xm.labelgadgetclass`
- Class: `xmLabelGadgetClass`
- Example: `gallery.source.labelgadgetclass`
- Interaction: `gallery.interaction.labelgadgetclass`
- Screenshot: `gallery.screenshot.labelgadgetclass`
- Capability: constructible

**Demo**

![xmLabelGadgetClass in the component demo](<gallery-screenshots/xm-labelgadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmLabelGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Apply changes");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, label, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/LabelG.h>)

\<a id="gallery.component.iconlabelwidgetclass"\>\</a\>

### `xm.iconlabelwidgetclass`
- Class: `xmIconLabelWidgetClass`
- Example: `gallery.source.iconlabelwidgetclass`
- Interaction: `gallery.interaction.iconlabelwidgetclass`
- Screenshot: `gallery.screenshot.iconlabelwidgetclass`
- Capability: constructible

**Demo**

![xmIconLabelWidgetClass in the component demo](<gallery-screenshots/xm-iconlabelwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmIconLabelWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Recent document");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNiconLabelLabel, label, NULL);
gallery_bind_icon(example,XmNiconLabelPixmap,"action_document");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/IconLabel.h>)

\<a id="gallery.component.searchboxwidgetclass"\>\</a\>

### `xm.searchboxwidgetclass`
- Class: `xmSearchBoxWidgetClass`
- Example: `gallery.source.searchboxwidgetclass`
- Interaction: `gallery.interaction.searchboxwidgetclass`
- Screenshot: `gallery.screenshot.searchboxwidgetclass`
- Capability: constructible

**Demo**

![xmSearchBoxWidgetClass in the component demo](<gallery-screenshots/xm-searchboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSearchBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Find a document");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNsearchPlaceholder, label, XmNcolumns, 28, NULL);
XmSearchBoxSetString(example, "Motif");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/SearchBox.h>)

\<a id="gallery.component.promptwidgetclass"\>\</a\>

### `xm.promptwidgetclass`
- Class: `xmPromptWidgetClass`
- Example: `gallery.source.promptwidgetclass`
- Interaction: `gallery.interaction.promptwidgetclass`
- Screenshot: `gallery.screenshot.promptwidgetclass`
- Capability: constructible

**Demo**

![xmPromptWidgetClass in the component demo](<gallery-screenshots/xm-promptwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmPromptWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Choose a component to inspect");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNpromptText, label, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Prompt.h>)

\<a id="gallery.component.autosuggestboxwidgetclass"\>\</a\>

### `xm.autosuggestboxwidgetclass`
- Class: `xmAutoSuggestBoxWidgetClass`
- Example: `gallery.source.autosuggestboxwidgetclass`
- Interaction: `gallery.interaction.autosuggestboxwidgetclass`
- Screenshot: `gallery.screenshot.autosuggestboxwidgetclass`
- Capability: constructible

**Demo**

![xmAutoSuggestBoxWidgetClass in the component demo](<gallery-screenshots/xm-autosuggestboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmAutoSuggestBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
static Boolean gallery_suggestion_matches(const char *label, const char *query)
{
    if (!*query) return True;
    for (; *label; ++label) {
        size_t i = 0;
        while (query[i] && label[i] &&
               tolower((unsigned char)query[i]) == tolower((unsigned char)label[i])) ++i;
        if (!query[i]) return True;
    }
    return False;
}
static void gallery_suggestions(Widget widget, XtPointer closure, XtPointer data)
{
    static const char *const names[] = {"Open document", "Open folder", "Open recent"};
    static const char *const ids[] = {"document", "folder", "recent"};
    XmAutoSuggestCallbackStruct *query = data;
    XmAutoSuggestItem items[3];
    Cardinal count = 0;
    (void)closure;
    for (Cardinal i = 0; i < XtNumber(names); ++i) {
        if (!gallery_suggestion_matches(names[i], query->query)) continue;
        items[count].id = ids[i];
        items[count].label = XmStringCreateLocalized((char *)names[i]);
        items[count].user_data = NULL;
        ++count;
    }
    XmAutoSuggestBoxSetSuggestions(widget, items, count, query->generation);
    for (Cardinal i = 0; i < count; ++i) XmStringFree(items[i].label);
}
```

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XtAddCallback(example, XmNautoSuggestQueryChangedCallback, gallery_suggestions, NULL);
XmSearchBoxSetString(XmAutoSuggestBoxGetSearchField(example), "Open");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/AutoSuggestBox.h>)

\<a id="gallery.component.textwidgetclass"\>\</a\>

### `xm.textwidgetclass`
- Class: `xmTextWidgetClass`
- Example: `gallery.source.textwidgetclass`
- Interaction: `gallery.interaction.textwidgetclass`
- Screenshot: `gallery.screenshot.textwidgetclass`
- Capability: constructible

**Demo**

![xmTextWidgetClass in the component demo](<gallery-screenshots/xm-textwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTextWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    parent = XtVaCreateManagedWidget("fieldLayout", xmRowColumnWidgetClass, parent,
        XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
        XmNadjustLast, False, XmNentryAlignment, XmALIGNMENT_BEGINNING, NULL);
    sample_label(parent, "fieldLabel",
        class == xmNumberBoxWidgetClass ? "Quantity" : "Document title");
}
```

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNvalue, (char *)"Editable sample text",
                                  XmNcolumns, 28, NULL);
```

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    sample_label(parent, "fieldHelp", "Edit the value to see its change notification.");
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Text.h>)

\<a id="gallery.component.textfieldwidgetclass"\>\</a\>

### `xm.textfieldwidgetclass`
- Class: `xmTextFieldWidgetClass`
- Example: `gallery.source.textfieldwidgetclass`
- Interaction: `gallery.interaction.textfieldwidgetclass`
- Screenshot: `gallery.screenshot.textfieldwidgetclass`
- Capability: constructible

**Demo**

![xmTextFieldWidgetClass in the component demo](<gallery-screenshots/xm-textfieldwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTextFieldWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    parent = XtVaCreateManagedWidget("fieldLayout", xmRowColumnWidgetClass, parent,
        XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
        XmNadjustLast, False, XmNentryAlignment, XmALIGNMENT_BEGINNING, NULL);
    sample_label(parent, "fieldLabel",
        class == xmNumberBoxWidgetClass ? "Quantity" : "Document title");
}
```

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNvalue, (char *)"Editable sample text",
                                  XmNcolumns, 28, NULL);
```

```c
if (class == xmTextFieldWidgetClass || class == xmDataFieldWidgetClass ||
    class == xmTextWidgetClass || class == xmNumberBoxWidgetClass) {
    sample_label(parent, "fieldHelp", "Edit the value to see its change notification.");
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/TextF.h>)

## data-views

\<a id="gallery.component.hierarchywidgetclass"\>\</a\>

### `xm.hierarchywidgetclass`
- Class: `xmHierarchyWidgetClass`
- Example: `gallery.source.hierarchywidgetclass`
- Interaction: `gallery.interaction.hierarchywidgetclass`
- Screenshot: `gallery.screenshot.hierarchywidgetclass`
- Capability: inventory-only

**Demo**

![xmHierarchyWidgetClass in the component demo](<gallery-screenshots/xm-hierarchywidgetclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/*
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
 * 
 */

#ifndef _XmHierarchy_h
#define _XmHierarchy_h

#if defined(VMS) || defined(__VMS)
#include <X11/apienvset.h>
#endif

#include <Xm/Ext.h>

/************************************************************
*	INCLUDE FILES
*************************************************************/

/************************************************************
*	TYPEDEFS AND DEFINES
*************************************************************/

#if defined(__cplusplus)
extern "C" {
#endif

typedef struct _XmHierarchyClassRec	*XmHierarchyWidgetClass;
typedef struct _XmHierarchyRec		*XmHierarchyWidget;

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

/************************************************************
*	MACROS
*************************************************************/

/************************************************************
*	GLOBAL FUNCTION DECLARATIONS
*************************************************************/

/*	Function Name: XmHierarchyOpenAllAncestors
 *	Description: This function opens all ancestors of the given node.
 *	Arguments: nw - the node (widget) that will be changed.
 *	Returns: none
 */

void XmHierarchyOpenAllAncestors(Widget);

WidgetList XmHierarchyGetChildNodes(Widget);

extern WidgetClass xmHierarchyWidgetClass;

#if defined(__cplusplus)
}
#endif

#endif /* _Hierarchy_h */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Hierarchy.h>)

\<a id="gallery.component.ext18listwidgetclass"\>\</a\>

### `xm.ext18listwidgetclass`
- Class: `xmExt18ListWidgetClass`
- Example: `gallery.source.ext18listwidgetclass`
- Interaction: `gallery.interaction.ext18listwidgetclass`
- Screenshot: `gallery.screenshot.ext18listwidgetclass`
- Capability: constructible

**Demo**

![xmExt18ListWidgetClass in the component demo](<gallery-screenshots/xm-ext18listwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmExt18ListWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
GalleryListData *data = (GalleryListData *)XtCalloc(1, sizeof(*data));
const char *columns[] = {"Document", "Status", "Pages"};
const char *values[3][3] = {{"Quarterly report", "Saved", "12"},
    {"Meeting notes", "Draft", "3"}, {"Project brief", "Reviewed", "8"}};
XmString titles[3];
unsigned int row, column;
if (!data) return NULL;
for (column = 0; column < 3; ++column) titles[column] = XmStringCreateLocalized((char *)columns[column]);
for (row = 0; row < 3; ++row) {
    data->rows[row].values = data->values[row];
    for (column = 0; column < 3; ++column)
        data->values[row][column] = XmStringCreateLocalized((char *)values[row][column]);
}
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 540, XmNheight, 240, XmNnumRows, 3, XmNnumColumns, 3,
    XmNentryData, data->rows, XmNcolumnTitles, titles,
    XmNfirstColumnPixmaps, False, NULL);
XtAddCallback(example, XmNdestroyCallback, free_list_data, data);
for (column = 0; column < 3; ++column) XmStringFree(titles[column]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Ext18List.h>)

\<a id="gallery.component.multilistwidgetclass"\>\</a\>

### `xm.multilistwidgetclass`
- Class: `xmMultiListWidgetClass`
- Example: `gallery.source.multilistwidgetclass`
- Interaction: `gallery.interaction.multilistwidgetclass`
- Screenshot: `gallery.screenshot.multilistwidgetclass`
- Capability: constructible

**Demo**

![xmMultiListWidgetClass in the component demo](<gallery-screenshots/xm-multilistwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmMultiListWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
GalleryListData *data = (GalleryListData *)XtCalloc(1, sizeof(*data));
const char *columns[] = {"Document", "Status", "Pages"};
const char *values[3][3] = {{"Quarterly report", "Saved", "12"},
    {"Meeting notes", "Draft", "3"}, {"Project brief", "Reviewed", "8"}};
XmString titles[3];
unsigned int row, column;
if (!data) return NULL;
for (column = 0; column < 3; ++column) titles[column] = XmStringCreateLocalized((char *)columns[column]);
for (row = 0; row < 3; ++row) {
    data->rows[row].values = data->values[row];
    for (column = 0; column < 3; ++column)
        data->values[row][column] = XmStringCreateLocalized((char *)values[row][column]);
}
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 540, XmNheight, 240, XmNnumRows, 3, XmNnumColumns, 3,
    XmNentryData, data->rows, XmNcolumnTitles, titles,
    XmNfirstColumnPixmaps, False, NULL);
XtAddCallback(example, XmNdestroyCallback, free_list_data, data);
for (column = 0; column < 3; ++column) XmStringFree(titles[column]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/MultiList.h>)

\<a id="gallery.component.iconboxwidgetclass"\>\</a\>

### `xm.iconboxwidgetclass`
- Class: `xmIconBoxWidgetClass`
- Example: `gallery.source.iconboxwidgetclass`
- Interaction: `gallery.interaction.iconboxwidgetclass`
- Screenshot: `gallery.screenshot.iconboxwidgetclass`
- Capability: constructible

**Demo**

![xmIconBoxWidgetClass in the component demo](<gallery-screenshots/xm-iconboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmIconBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
const char *titles[] = {"Documents", "Pictures", "Archive"};
unsigned int i;
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
for (i = 0; i < 3; ++i) {
    XmString caption = XmStringCreateLocalized((char *)titles[i]);
    static const char *const icons[]={"action_document","action_picture","action_archive"};
    Widget item=XtVaCreateManagedWidget(titles[i], xmIconButtonWidgetClass, example,
        XmNlabelString, caption, XmNcellX, i, XmNcellY, 0, NULL);
    gallery_bind_icon(item,XmNpixmap,icons[i]);
    XmStringFree(caption);
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/IconBox.h>)

\<a id="gallery.component.outlinewidgetclass"\>\</a\>

### `xm.outlinewidgetclass`
- Class: `xmOutlineWidgetClass`
- Example: `gallery.source.outlinewidgetclass`
- Interaction: `gallery.interaction.outlinewidgetclass`
- Screenshot: `gallery.screenshot.outlinewidgetclass`
- Capability: constructible

**Demo**

![xmOutlineWidgetClass in the component demo](<gallery-screenshots/xm-outlinewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmOutlineWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget root;
XmString caption = XmStringCreateLocalized((char *)"Documents");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 480, XmNheight, 220, NULL);
root = XtVaCreateManagedWidget("documents", xmPushButtonWidgetClass, example,
    XmNlabelString, caption, XmNnodeState, XmAlwaysOpen, NULL);
XmStringFree(caption);
caption = XmStringCreateLocalized((char *)"Quarterly report");
XtVaCreateManagedWidget("report", xmPushButtonWidgetClass, example,
    XmNlabelString, caption, XmNparentNode, root, XmNnodeState, XmAlwaysOpen, NULL);
XmStringFree(caption);
caption = XmStringCreateLocalized((char *)"Meeting notes");
XtVaCreateManagedWidget("notes", xmPushButtonWidgetClass, example,
    XmNlabelString, caption, XmNparentNode, root, XmNnodeState, XmAlwaysOpen, NULL);
XmStringFree(caption);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Outline.h>)

\<a id="gallery.component.treewidgetclass"\>\</a\>

### `xm.treewidgetclass`
- Class: `xmTreeWidgetClass`
- Example: `gallery.source.treewidgetclass`
- Interaction: `gallery.interaction.treewidgetclass`
- Screenshot: `gallery.screenshot.treewidgetclass`
- Capability: constructible

**Demo**

![xmTreeWidgetClass in the component demo](<gallery-screenshots/xm-treewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTreeWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
Widget root;
XmString caption = XmStringCreateLocalized((char *)"Documents");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 480, XmNheight, 220, NULL);
root = XtVaCreateManagedWidget("documents", xmPushButtonWidgetClass, example,
    XmNlabelString, caption, XmNnodeState, XmAlwaysOpen, NULL);
XmStringFree(caption);
caption = XmStringCreateLocalized((char *)"Quarterly report");
XtVaCreateManagedWidget("report", xmPushButtonWidgetClass, example,
    XmNlabelString, caption, XmNparentNode, root, XmNnodeState, XmAlwaysOpen, NULL);
XmStringFree(caption);
caption = XmStringCreateLocalized((char *)"Meeting notes");
XtVaCreateManagedWidget("notes", xmPushButtonWidgetClass, example,
    XmNlabelString, caption, XmNparentNode, root, XmNnodeState, XmAlwaysOpen, NULL);
XmStringFree(caption);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Tree.h>)

\<a id="gallery.component.calendarwidgetclass"\>\</a\>

### `xm.calendarwidgetclass`
- Class: `xmCalendarWidgetClass`
- Example: `gallery.source.calendarwidgetclass`
- Interaction: `gallery.interaction.calendarwidgetclass`
- Screenshot: `gallery.screenshot.calendarwidgetclass`
- Capability: constructible

**Demo**

![xmCalendarWidgetClass in the component demo](<gallery-screenshots/xm-calendarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmCalendarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmCalendarDate date = {2026, 10, 25};
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  NULL);
XmCalendarSetDate(example, &date, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Calendar.h>)

\<a id="gallery.component.datepickerwidgetclass"\>\</a\>

### `xm.datepickerwidgetclass`
- Class: `xmDatePickerWidgetClass`
- Example: `gallery.source.datepickerwidgetclass`
- Interaction: `gallery.interaction.datepickerwidgetclass`
- Screenshot: `gallery.screenshot.datepickerwidgetclass`
- Capability: constructible

**Demo**

![xmDatePickerWidgetClass in the component demo](<gallery-screenshots/xm-datepickerwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDatePickerWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmDatePickerDate date = {2026, 10, 25};
example = XtVaCreateManagedWidget((char *)name, class, parent,
    NULL);
XmDatePickerSetDate(example, &date, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DatePicker.h>)

\<a id="gallery.component.timepickerwidgetclass"\>\</a\>

### `xm.timepickerwidgetclass`
- Class: `xmTimePickerWidgetClass`
- Example: `gallery.source.timepickerwidgetclass`
- Interaction: `gallery.interaction.timepickerwidgetclass`
- Screenshot: `gallery.screenshot.timepickerwidgetclass`
- Capability: constructible

**Demo**

![xmTimePickerWidgetClass in the component demo](<gallery-screenshots/xm-timepickerwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmTimePickerWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmTimePickerValue value = {14, 30, 0};
example = XtVaCreateManagedWidget((char *)name, class, parent,
    NULL);
XmTimePickerSetValue(example, &value, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/TimePicker.h>)

\<a id="gallery.component.datagridwidgetclass"\>\</a\>

### `xm.datagridwidgetclass`
- Class: `xmDataGridWidgetClass`
- Example: `gallery.source.datagridwidgetclass`
- Interaction: `gallery.interaction.datagridwidgetclass`
- Screenshot: `gallery.screenshot.datagridwidgetclass`
- Capability: constructible

**Demo**

![xmDataGridWidgetClass in the component demo](<gallery-screenshots/xm-datagridwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDataGridWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
static const char *const values0[] = {"Button", "Enabled", "Ready"};
static const char *const values1[] = {"Slider", "Enabled", "65%"};
static const char *const values2[] = {"Dialog", "Preview", "Open"};
static const XmDataGridColumn columns[] = {
    {(XtPointer)"component", "Component", False, 0},
    {(XtPointer)"state", "State", False, 0},
    {(XtPointer)"value", "Value", False, 0}
};
static const XmDataGridRow rows[] = {
    {(XtPointer)"button", values0},
    {(XtPointer)"slider", values1},
    {(XtPointer)"dialog", values2}
};
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNdataGridVisibleRows, 4, NULL);
XmDataGridSetModel(example, columns, XtNumber(columns), rows,
                   XtNumber(rows));
XmDataGridSetSelectedCell(example, (XtPointer)"slider",
                          (XtPointer)"value", False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DataGrid.h>)

## buttons-selection

\<a id="gallery.component.arrowbuttonwidgetclass"\>\</a\>

### `xm.arrowbuttonwidgetclass`
- Class: `xmArrowButtonWidgetClass`
- Example: `gallery.source.arrowbuttonwidgetclass`
- Interaction: `gallery.interaction.arrowbuttonwidgetclass`
- Screenshot: `gallery.screenshot.arrowbuttonwidgetclass`
- Capability: constructible

**Demo**

![xmArrowButtonWidgetClass in the component demo](<gallery-screenshots/xm-arrowbuttonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmArrowButtonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNarrowDirection, XmARROW_RIGHT, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ArrowB.h>)

\<a id="gallery.component.arrowbuttongadgetclass"\>\</a\>

### `xm.arrowbuttongadgetclass`
- Class: `xmArrowButtonGadgetClass`
- Example: `gallery.source.arrowbuttongadgetclass`
- Interaction: `gallery.interaction.arrowbuttongadgetclass`
- Screenshot: `gallery.screenshot.arrowbuttongadgetclass`
- Capability: constructible

**Demo**

![xmArrowButtonGadgetClass in the component demo](<gallery-screenshots/xm-arrowbuttongadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmArrowButtonGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNarrowDirection, XmARROW_RIGHT, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ArrowBG.h>)

\<a id="gallery.component.iconbuttonwidgetclass"\>\</a\>

### `xm.iconbuttonwidgetclass`
- Class: `xmIconButtonWidgetClass`
- Example: `gallery.source.iconbuttonwidgetclass`
- Interaction: `gallery.interaction.iconbuttonwidgetclass`
- Screenshot: `gallery.screenshot.iconbuttonwidgetclass`
- Capability: constructible

**Demo**

![xmIconButtonWidgetClass in the component demo](<gallery-screenshots/xm-iconbuttonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmIconButtonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Open document");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNlabelString, label, NULL);
if (class == xmIconButtonWidgetClass) gallery_bind_icon(example,XmNpixmap,"action_open");
else if (class == xmIconGadgetClass) gallery_bind_icon(example,XmNlargeIconPixmap,"action_document");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/IconButton.h>)

\<a id="gallery.component.listwidgetclass"\>\</a\>

### `xm.listwidgetclass`
- Class: `xmListWidgetClass`
- Example: `gallery.source.listwidgetclass`
- Interaction: `gallery.interaction.listwidgetclass`
- Screenshot: `gallery.screenshot.listwidgetclass`
- Capability: constructible

**Demo**

![xmListWidgetClass in the component demo](<gallery-screenshots/xm-listwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmListWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString rows[3];
rows[0] = XmStringCreateLocalized((char *)"First item");
rows[1] = XmStringCreateLocalized((char *)"Second item");
rows[2] = XmStringCreateLocalized((char *)"Third item");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNitems, rows, XmNitemCount, 3,
                                  XmNvisibleItemCount, 3, NULL);
XmStringFree(rows[0]); XmStringFree(rows[1]); XmStringFree(rows[2]);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/List.h>)

\<a id="gallery.component.colorpickerwidgetclass"\>\</a\>

### `xm.colorpickerwidgetclass`
- Class: `xmColorPickerWidgetClass`
- Example: `gallery.source.colorpickerwidgetclass`
- Interaction: `gallery.interaction.colorpickerwidgetclass`
- Screenshot: `gallery.screenshot.colorpickerwidgetclass`
- Capability: constructible

**Demo**

![xmColorPickerWidgetClass in the component demo](<gallery-screenshots/xm-colorpickerwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmColorPickerWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmColorPickerSetValue(example, 0x3478d4ffUL, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ColorPicker.h>)

\<a id="gallery.component.segmentedcontrolwidgetclass"\>\</a\>

### `xm.segmentedcontrolwidgetclass`
- Class: `xmSegmentedControlWidgetClass`
- Example: `gallery.source.segmentedcontrolwidgetclass`
- Interaction: `gallery.interaction.segmentedcontrolwidgetclass`
- Screenshot: `gallery.screenshot.segmentedcontrolwidgetclass`
- Capability: constructible

**Demo**

![xmSegmentedControlWidgetClass in the component demo](<gallery-screenshots/xm-segmentedcontrolwidgetclass.png>)

**Source**

Actual gallery factory for xmSegmentedControlWidgetClass. The gallery host supplies the function arguments. Helpers are defined in gallery\_examples.c.

```c
Widget
gallery_create_segmented_control_example(Widget parent, const char *name,
                                         XtCallbackProc callback,
                                         XtPointer client_data)
{
    XmString labels[3];
    XmSegmentedControlItem items[3];
    Widget example;
    labels[0] = XmStringCreateLocalized((char *)"Overview");
    labels[1] = XmStringCreateLocalized((char *)"Details");
    labels[2] = XmStringCreateLocalized((char *)"Activity");
    items[0] = (XmSegmentedControlItem){"overview", labels[0], XmUNSPECIFIED_PIXMAP, True};
    items[1] = (XmSegmentedControlItem){"details", labels[1], XmUNSPECIFIED_PIXMAP, True};
    items[2] = (XmSegmentedControlItem){"activity", labels[2], XmUNSPECIFIED_PIXMAP, True};
    example = XtVaCreateManagedWidget((char *)name,
                                      xmSegmentedControlWidgetClass, parent, NULL);
    if (!XmSegmentedControlSetItems(example, items, 3)) {
        XtDestroyWidget(example);
        example = NULL;
    } else {
        XmSegmentedControlSetSelectedIndex(example, 0, False);
        if (callback)
            XtAddCallback(example, XmNSegmentedSelectionCallback,
                          callback, client_data);
    }
    XmStringFree(labels[0]);
    XmStringFree(labels[1]);
    XmStringFree(labels[2]);
    return example;
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/SegmentedControl.h>)

\<a id="gallery.component.ratingcontrolwidgetclass"\>\</a\>

### `xm.ratingcontrolwidgetclass`
- Class: `xmRatingControlWidgetClass`
- Example: `gallery.source.ratingcontrolwidgetclass`
- Interaction: `gallery.interaction.ratingcontrolwidgetclass`
- Screenshot: `gallery.screenshot.ratingcontrolwidgetclass`
- Capability: constructible

**Demo**

![xmRatingControlWidgetClass in the component demo](<gallery-screenshots/xm-ratingcontrolwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmRatingControlWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmRatingControlSetValue(example, 4, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/RatingControl.h>)

\<a id="gallery.component.pushbuttonwidgetclass"\>\</a\>

### `xm.pushbuttonwidgetclass`
- Class: `xmPushButtonWidgetClass`
- Example: `gallery.source.pushbuttonwidgetclass`
- Interaction: `gallery.interaction.pushbuttonwidgetclass`
- Screenshot: `gallery.screenshot.pushbuttonwidgetclass`
- Capability: constructible

**Demo**

![xmPushButtonWidgetClass in the component demo](<gallery-screenshots/xm-pushbuttonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmPushButtonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Apply changes");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, label, NULL);
```

```c
if (class == xmPushButtonWidgetClass || class == xmPushButtonGadgetClass ||
    class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
    XmString alternate = XmStringCreateLocalized((char *)"Unavailable");
    Dimension height, disabled_height, gap;
    XmGetAppearanceSpacing(XtDisplay(parent), XmAPPEARANCE_SPACING_MEDIUM, &gap);
    XtVaGetValues(example, XmNheight, &height, NULL);
    Widget disabled = XtVaCreateManagedWidget("disabledState", class, parent,
        XmNlabelString, alternate, XmNsensitive, False,
        XmNy, height + gap, NULL);
    XtVaGetValues(disabled, XmNheight, &disabled_height, NULL);
    XmStringFree(alternate);
    if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
        alternate = XmStringCreateLocalized((char *)"Selected option");
        Widget selected = XtVaCreateManagedWidget("selectedState", class, parent,
            XmNlabelString, alternate, XmNset, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(selected, XmNvalueChangedCallback, callback, client_data);
        XmStringFree(alternate);
    } else {
        alternate = XmStringCreateLocalized((char *)"Default action");
        Widget primary = XtVaCreateManagedWidget("defaultState", class, parent,
            XmNlabelString, alternate, XmNshowAsDefault, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(primary, XmNactivateCallback, callback, client_data);
        XmStringFree(alternate);
    }
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/PushB.h>)

\<a id="gallery.component.pushbuttongadgetclass"\>\</a\>

### `xm.pushbuttongadgetclass`
- Class: `xmPushButtonGadgetClass`
- Example: `gallery.source.pushbuttongadgetclass`
- Interaction: `gallery.interaction.pushbuttongadgetclass`
- Screenshot: `gallery.screenshot.pushbuttongadgetclass`
- Capability: constructible

**Demo**

![xmPushButtonGadgetClass in the component demo](<gallery-screenshots/xm-pushbuttongadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmPushButtonGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Apply changes");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, label, NULL);
```

```c
if (class == xmPushButtonWidgetClass || class == xmPushButtonGadgetClass ||
    class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
    XmString alternate = XmStringCreateLocalized((char *)"Unavailable");
    Dimension height, disabled_height, gap;
    XmGetAppearanceSpacing(XtDisplay(parent), XmAPPEARANCE_SPACING_MEDIUM, &gap);
    XtVaGetValues(example, XmNheight, &height, NULL);
    Widget disabled = XtVaCreateManagedWidget("disabledState", class, parent,
        XmNlabelString, alternate, XmNsensitive, False,
        XmNy, height + gap, NULL);
    XtVaGetValues(disabled, XmNheight, &disabled_height, NULL);
    XmStringFree(alternate);
    if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
        alternate = XmStringCreateLocalized((char *)"Selected option");
        Widget selected = XtVaCreateManagedWidget("selectedState", class, parent,
            XmNlabelString, alternate, XmNset, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(selected, XmNvalueChangedCallback, callback, client_data);
        XmStringFree(alternate);
    } else {
        alternate = XmStringCreateLocalized((char *)"Default action");
        Widget primary = XtVaCreateManagedWidget("defaultState", class, parent,
            XmNlabelString, alternate, XmNshowAsDefault, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(primary, XmNactivateCallback, callback, client_data);
        XmStringFree(alternate);
    }
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/PushBG.h>)

\<a id="gallery.component.simplespinboxwidgetclass"\>\</a\>

### `xm.simplespinboxwidgetclass`
- Class: `xmSimpleSpinBoxWidgetClass`
- Example: `gallery.source.simplespinboxwidgetclass`
- Interaction: `gallery.interaction.simplespinboxwidgetclass`
- Screenshot: `gallery.screenshot.simplespinboxwidgetclass`
- Capability: constructible

**Demo**

![xmSimpleSpinBoxWidgetClass in the component demo](<gallery-screenshots/xm-simplespinboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSimpleSpinBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
if (class == xmSimpleSpinBoxWidgetClass)
    XtVaSetValues(example, XmNspinBoxChildType, XmNUMERIC,
        XmNminimumValue, 0, XmNmaximumValue, 100, XmNposition, 7,
        XmNcolumns, 6, NULL);
if (class == xmSpinBoxWidgetClass)
    XtVaCreateManagedWidget("quantity", xmTextFieldWidgetClass, example,
        XmNspinBoxChildType, XmNUMERIC, XmNminimumValue, 0,
        XmNmaximumValue, 100, XmNposition, 7, XmNcolumns, 6, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/SSpinB.h>)

\<a id="gallery.component.scalewidgetclass"\>\</a\>

### `xm.scalewidgetclass`
- Class: `xmScaleWidgetClass`
- Example: `gallery.source.scalewidgetclass`
- Interaction: `gallery.interaction.scalewidgetclass`
- Screenshot: `gallery.screenshot.scalewidgetclass`
- Capability: constructible

**Demo**

![xmScaleWidgetClass in the component demo](<gallery-screenshots/xm-scalewidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmScaleWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNorientation, XmHORIZONTAL, XmNminimum, 0, XmNmaximum, 100,
                                  XmNvalue, 65, XmNwidth, 320,
                                  XmNheight, 48, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Scale.h>)

\<a id="gallery.component.spinnerwidgetclass"\>\</a\>

### `xm.spinnerwidgetclass`
- Class: `xmSpinnerWidgetClass`
- Example: `gallery.source.spinnerwidgetclass`
- Interaction: `gallery.interaction.spinnerwidgetclass`
- Screenshot: `gallery.screenshot.spinnerwidgetclass`
- Capability: constructible

**Demo**

![xmSpinnerWidgetClass in the component demo](<gallery-screenshots/xm-spinnerwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSpinnerWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmSpinnerSetActive(example, True, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Spinner.h>)

\<a id="gallery.component.stepperwidgetclass"\>\</a\>

### `xm.stepperwidgetclass`
- Class: `xmStepperWidgetClass`
- Example: `gallery.source.stepperwidgetclass`
- Interaction: `gallery.interaction.stepperwidgetclass`
- Screenshot: `gallery.screenshot.stepperwidgetclass`
- Capability: constructible

**Demo**

![xmStepperWidgetClass in the component demo](<gallery-screenshots/xm-stepperwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmStepperWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
XmStepperSetRange(example, 0, 100, False);
XmStepperSetValue(example, 7, False);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Stepper.h>)

\<a id="gallery.component.scrollbarwidgetclass"\>\</a\>

### `xm.scrollbarwidgetclass`
- Class: `xmScrollBarWidgetClass`
- Example: `gallery.source.scrollbarwidgetclass`
- Interaction: `gallery.interaction.scrollbarwidgetclass`
- Screenshot: `gallery.screenshot.scrollbarwidgetclass`
- Capability: constructible

**Demo**

![xmScrollBarWidgetClass in the component demo](<gallery-screenshots/xm-scrollbarwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmScrollBarWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNorientation, XmHORIZONTAL, XmNminimum, 0, XmNmaximum, 100,
                                  XmNvalue, 65, XmNwidth, 320,
                                  XmNheight, 48, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ScrollBar.h>)

\<a id="gallery.component.spinboxwidgetclass"\>\</a\>

### `xm.spinboxwidgetclass`
- Class: `xmSpinBoxWidgetClass`
- Example: `gallery.source.spinboxwidgetclass`
- Interaction: `gallery.interaction.spinboxwidgetclass`
- Screenshot: `gallery.screenshot.spinboxwidgetclass`
- Capability: constructible

**Demo**

![xmSpinBoxWidgetClass in the component demo](<gallery-screenshots/xm-spinboxwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmSpinBoxWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
example = XtVaCreateManagedWidget((char *)name, class, parent, NULL);
if (class == xmSimpleSpinBoxWidgetClass)
    XtVaSetValues(example, XmNspinBoxChildType, XmNUMERIC,
        XmNminimumValue, 0, XmNmaximumValue, 100, XmNposition, 7,
        XmNcolumns, 6, NULL);
if (class == xmSpinBoxWidgetClass)
    XtVaCreateManagedWidget("quantity", xmTextFieldWidgetClass, example,
        XmNspinBoxChildType, XmNUMERIC, XmNminimumValue, 0,
        XmNmaximumValue, 100, XmNposition, 7, XmNcolumns, 6, NULL);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/SpinB.h>)

\<a id="gallery.component.togglebuttonwidgetclass"\>\</a\>

### `xm.togglebuttonwidgetclass`
- Class: `xmToggleButtonWidgetClass`
- Example: `gallery.source.togglebuttonwidgetclass`
- Interaction: `gallery.interaction.togglebuttonwidgetclass`
- Screenshot: `gallery.screenshot.togglebuttonwidgetclass`
- Capability: constructible

**Demo**

![xmToggleButtonWidgetClass in the component demo](<gallery-screenshots/xm-togglebuttonwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmToggleButtonWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
/* Keep the familiar check-box indicator visible. */
label = XmStringCreateLocalized((char *)"Enable notifications");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, label,
                                  XmNindicatorOn, True, NULL);
```

```c
if (class == xmPushButtonWidgetClass || class == xmPushButtonGadgetClass ||
    class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
    XmString alternate = XmStringCreateLocalized((char *)"Unavailable");
    Dimension height, disabled_height, gap;
    XmGetAppearanceSpacing(XtDisplay(parent), XmAPPEARANCE_SPACING_MEDIUM, &gap);
    XtVaGetValues(example, XmNheight, &height, NULL);
    Widget disabled = XtVaCreateManagedWidget("disabledState", class, parent,
        XmNlabelString, alternate, XmNsensitive, False,
        XmNy, height + gap, NULL);
    XtVaGetValues(disabled, XmNheight, &disabled_height, NULL);
    XmStringFree(alternate);
    if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
        alternate = XmStringCreateLocalized((char *)"Selected option");
        Widget selected = XtVaCreateManagedWidget("selectedState", class, parent,
            XmNlabelString, alternate, XmNset, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(selected, XmNvalueChangedCallback, callback, client_data);
        XmStringFree(alternate);
    } else {
        alternate = XmStringCreateLocalized((char *)"Default action");
        Widget primary = XtVaCreateManagedWidget("defaultState", class, parent,
            XmNlabelString, alternate, XmNshowAsDefault, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(primary, XmNactivateCallback, callback, client_data);
        XmStringFree(alternate);
    }
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ToggleB.h>)

\<a id="gallery.component.toggleswitchwidgetclass"\>\</a\>

### `xm.toggleswitchwidgetclass`
- Class: `xmToggleSwitchWidgetClass`
- Example: `gallery.source.toggleswitchwidgetclass`
- Interaction: `gallery.interaction.toggleswitchwidgetclass`
- Screenshot: `gallery.screenshot.toggleswitchwidgetclass`
- Capability: constructible

**Demo**

![xmToggleSwitchWidgetClass in the component demo](<gallery-screenshots/xm-toggleswitchwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmToggleSwitchWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
XmString title_label = XmStringCreateLocalized((char *)"Kitchen lights");

example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, title_label,
                                  XmNset, False, NULL);
XmStringFree(title_label);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ToggleSwitch.h>)

\<a id="gallery.component.togglebuttongadgetclass"\>\</a\>

### `xm.togglebuttongadgetclass`
- Class: `xmToggleButtonGadgetClass`
- Example: `gallery.source.togglebuttongadgetclass`
- Interaction: `gallery.interaction.togglebuttongadgetclass`
- Screenshot: `gallery.screenshot.togglebuttongadgetclass`
- Capability: constructible

**Demo**

![xmToggleButtonGadgetClass in the component demo](<gallery-screenshots/xm-togglebuttongadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmToggleButtonGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
/* Keep the familiar check-box indicator visible. */
label = XmStringCreateLocalized((char *)"Enable notifications");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNlabelString, label,
                                  XmNindicatorOn, True, NULL);
```

```c
if (class == xmPushButtonWidgetClass || class == xmPushButtonGadgetClass ||
    class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
    XmString alternate = XmStringCreateLocalized((char *)"Unavailable");
    Dimension height, disabled_height, gap;
    XmGetAppearanceSpacing(XtDisplay(parent), XmAPPEARANCE_SPACING_MEDIUM, &gap);
    XtVaGetValues(example, XmNheight, &height, NULL);
    Widget disabled = XtVaCreateManagedWidget("disabledState", class, parent,
        XmNlabelString, alternate, XmNsensitive, False,
        XmNy, height + gap, NULL);
    XtVaGetValues(disabled, XmNheight, &disabled_height, NULL);
    XmStringFree(alternate);
    if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) {
        alternate = XmStringCreateLocalized((char *)"Selected option");
        Widget selected = XtVaCreateManagedWidget("selectedState", class, parent,
            XmNlabelString, alternate, XmNset, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(selected, XmNvalueChangedCallback, callback, client_data);
        XmStringFree(alternate);
    } else {
        alternate = XmStringCreateLocalized((char *)"Default action");
        Widget primary = XtVaCreateManagedWidget("defaultState", class, parent,
            XmNlabelString, alternate, XmNshowAsDefault, True,
            XmNy, height + disabled_height + 2 * gap, NULL);
        if (callback) XtAddCallback(primary, XmNactivateCallback, callback, client_data);
        XmStringFree(alternate);
    }
}
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/ToggleBG.h>)

## media

\<a id="gallery.component.drawingareawidgetclass"\>\</a\>

### `xm.drawingareawidgetclass`
- Class: `xmDrawingAreaWidgetClass`
- Example: `gallery.source.drawingareawidgetclass`
- Interaction: `gallery.interaction.drawingareawidgetclass`
- Screenshot: `gallery.screenshot.drawingareawidgetclass`
- Capability: constructible

**Demo**

![xmDrawingAreaWidgetClass in the component demo](<gallery-screenshots/xm-drawingareawidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDrawingAreaWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
const char *days[] = {"Mon", "Tue", "Wed", "Thu", "Fri"};
unsigned int i;
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNwidth, 360, XmNheight, 210, NULL);
Widget title = sample_label(example, "chartTitle", "Weekly activity");
XtVaSetValues(title, XmNx, 24, XmNy, 10, NULL);
for (i = 0; i < XtNumber(days); ++i) {
    Widget day = sample_label(example, "day", days[i]);
    XtVaSetValues(day, XmNx, 28 + i * 64, XmNy, 160, NULL);
}
XtAddCallback(example, XmNexposeCallback, draw_activity, NULL);
if (callback) XtAddCallback(example, XmNinputCallback, callback, client_data);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DrawingA.h>)

\<a id="gallery.component.dropsitemanagerobjectclass"\>\</a\>

### `xm.dropsitemanagerobjectclass`
- Class: `xmDropSiteManagerObjectClass`
- Example: `gallery.source.dropsitemanagerobjectclass`
- Interaction: `gallery.interaction.dropsitemanagerobjectclass`
- Screenshot: `gallery.screenshot.dropsitemanagerobjectclass`
- Capability: inventory-only

**Demo**

![xmDropSiteManagerObjectClass in the component demo](<gallery-screenshots/xm-dropsitemanagerobjectclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* 
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
*/ 
#ifndef _XmDropSMgr_h
#define _XmDropSMgr_h

#include <Xm/Xm.h>
#include <Xm/DragC.h>

#ifdef __cplusplus
extern "C" {
#endif


#define XmCR_DROP_SITE_LEAVE_MESSAGE  1
#define XmCR_DROP_SITE_ENTER_MESSAGE  2
#define XmCR_DROP_SITE_MOTION_MESSAGE 3
#define XmCR_DROP_MESSAGE             4

#define XmNO_DROP_SITE 		1
#define XmINVALID_DROP_SITE	2
#define XmVALID_DROP_SITE	3

/* begin fix for CR 5754 */
/* documented values are XmDROP_SITE_VALID and XmDROP_SITE_INVALID.
   However, we can't just throw out the incorrect Xm[IN]VALID_DROP_SITE
   now since people have probably started using them. Instead, we just
   define the correct values using the incorrect ones.
*/

#define XmDROP_SITE_INVALID XmINVALID_DROP_SITE
#define XmDROP_SITE_VALID XmVALID_DROP_SITE

/* end fix for CR 5754 */

enum { XmDRAG_UNDER_NONE, XmDRAG_UNDER_PIXMAP,
    XmDRAG_UNDER_SHADOW_IN, XmDRAG_UNDER_SHADOW_OUT,
    XmDRAG_UNDER_HIGHLIGHT };

enum { XmDROP_SITE_SIMPLE, XmDROP_SITE_COMPOSITE,
    XmDROP_SITE_SIMPLE_CLIP_ONLY = 128,
    XmDROP_SITE_COMPOSITE_CLIP_ONLY };

enum { XmABOVE, XmBELOW };

enum { XmDROP_SITE_ACTIVE, XmDROP_SITE_INACTIVE, XmDROP_SITE_IGNORE };

typedef struct _XmDragProcCallbackStruct {
    int				reason;
    XEvent *		event;
    Time			timeStamp;
	Widget			dragContext;
    Position		x, y;
    unsigned char	dropSiteStatus;
    unsigned char	operation;
    unsigned char	operations;
	Boolean			animate;
} XmDragProcCallbackStruct, * XmDragProcCallback;

typedef struct _XmDropProcCallbackStruct {
    int				reason;
    XEvent *		event;
    Time			timeStamp;
	Widget			dragContext;
    Position		x, y;
    unsigned char	dropSiteStatus;
    unsigned char	operation;
    unsigned char	operations;
	unsigned char	dropAction;
} XmDropProcCallbackStruct, * XmDropProcCallback;


typedef struct _XmDropSiteVisualsRec {
	Pixel	background;
	Pixel	foreground;
	Pixel	topShadowColor;
	Pixmap	topShadowPixmap;
	Pixel	bottomShadowColor;
	Pixmap	bottomShadowPixmap;
	Dimension	shadowThickness;
	Pixel	highlightColor;
	Pixmap	highlightPixmap;
	Dimension	highlightThickness;
	Dimension	borderWidth;
} XmDropSiteVisualsRec, * XmDropSiteVisuals;


/* DropSite Widget */

externalref WidgetClass xmDropSiteManagerObjectClass;

typedef struct _XmDropSiteManagerClassRec *XmDropSiteManagerObjectClass;
typedef struct _XmDropSiteManagerRec *XmDropSiteManagerObject;

#ifndef XmIsDropSiteManager
#define XmIsDropSiteManager(w)  XtIsSubclass((w), xmDropSiteManagerObjectClass)
#endif /* XmIsDropSite */

/********    Public Function Declarations    ********/

extern void XmDropSiteRegister( 
                        Widget widget,
                        ArgList args,
                        Cardinal argCount) ;
extern void XmDropSiteUnregister( 
                        Widget widget) ;
extern Boolean XmDropSiteRegistered(
                          Widget widget) ;
extern void XmDropSiteStartUpdate( 
                        Widget refWidget) ;
extern void XmDropSiteUpdate( 
                        Widget enclosingWidget,
                        ArgList args,
                        Cardinal argCount) ;
extern void XmDropSiteEndUpdate( 
                        Widget refWidget) ;
extern void XmDropSiteRetrieve( 
                        Widget enclosingWidget,
                        ArgList args,
                        Cardinal argCount) ;
extern int XmDropSiteQueryStackingOrder( 
                        Widget widget,
                        Widget *parent_rtn,
                        Widget **children_rtn,
                        Cardinal *num_children_rtn) ;
extern void XmDropSiteConfigureStackingOrder( 
                        Widget widget,
                        Widget sibling,
                        Cardinal stack_mode) ;
extern XmDropSiteVisuals XmDropSiteGetActiveVisuals( 
                        Widget widget) ;

/********    End Public Function Declarations    ********/

#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmDropSMgr_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DropSMgr.h>)

\<a id="gallery.component.droptransferobjectclass"\>\</a\>

### `xm.droptransferobjectclass`
- Class: `xmDropTransferObjectClass`
- Example: `gallery.source.droptransferobjectclass`
- Interaction: `gallery.interaction.droptransferobjectclass`
- Screenshot: `gallery.screenshot.droptransferobjectclass`
- Capability: inventory-only

**Demo**

![xmDropTransferObjectClass in the component demo](<gallery-screenshots/xm-droptransferobjectclass.png>)

**Source**

This is a service or abstract class, not a standalone control. The Demo tab explains its role in the toolkit.

```h
/* 
 * Motif
 *
 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
 *
 * These libraries and programs are free software; you can
 * redistribute them and/or modify them under the terms of the GNU
 * Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * These libraries and programs are distributed in the hope that
 * they will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with these librararies and programs; if not, write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301 USA
*/ 

#ifndef _XmDropTrans_h
#define _XmDropTrans_h

#include <Xm/Xm.h>

#ifdef __cplusplus
extern "C" {
#endif

#define XmTRANSFER_FAILURE 0
#define XmTRANSFER_SUCCESS 1

externalref WidgetClass xmDropTransferObjectClass;

typedef struct _XmDropTransferClassRec * XmDropTransferObjectClass;
typedef struct _XmDropTransferRec      * XmDropTransferObject;

#ifndef XmIsDropTransfer
#define XmIsDropTransfer(w) \
	XtIsSubclass((w), xmDropTransferObjectClass)
#endif /* XmIsDropTransfer */

typedef struct _XmDropTransferEntryRec {
	XtPointer	client_data;
	Atom		target;
} XmDropTransferEntryRec, * XmDropTransferEntry;

/********    Public Function Declarations    ********/

extern Widget XmDropTransferStart( 
                        Widget refWidget,
                        ArgList args,
                        Cardinal argCount) ;
extern void XmDropTransferAdd( 
                        Widget widget,
                        XmDropTransferEntry transfers,
                        Cardinal num_transfers) ;

/********    End Public Function Declarations    ********/


#ifdef __cplusplus
}  /* Close scope of 'extern "C"' declaration which encloses file. */
#endif

#endif /* _XmDropTrans_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DropTrans.h>)

\<a id="gallery.component.icongadgetclass"\>\</a\>

### `xm.icongadgetclass`
- Class: `xmIconGadgetClass`
- Example: `gallery.source.icongadgetclass`
- Interaction: `gallery.interaction.icongadgetclass`
- Screenshot: `gallery.screenshot.icongadgetclass`
- Capability: constructible

**Demo**

![xmIconGadgetClass in the component demo](<gallery-screenshots/xm-icongadgetclass.png>)

**Source**

Actual gallery excerpt: class = xmIconGadgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Open document");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNlabelString, label, NULL);
if (class == xmIconButtonWidgetClass) gallery_bind_icon(example,XmNpixmap,"action_open");
else if (class == xmIconGadgetClass) gallery_bind_icon(example,XmNlargeIconPixmap,"action_document");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/IconG.h>)

\<a id="gallery.component.iconheaderclass"\>\</a\>

### `xm.iconheaderclass`
- Class: `xmIconHeaderClass`
- Example: `gallery.source.iconheaderclass`
- Interaction: `gallery.interaction.iconheaderclass`
- Screenshot: `gallery.screenshot.iconheaderclass`
- Capability: constructible

**Demo**

![xmIconHeaderClass in the component demo](<gallery-screenshots/xm-iconheaderclass.png>)

**Source**

Actual gallery excerpt: class = xmIconHeaderClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Open document");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNlabelString, label, NULL);
if (class == xmIconButtonWidgetClass) gallery_bind_icon(example,XmNpixmap,"action_open");
else if (class == xmIconGadgetClass) gallery_bind_icon(example,XmNlargeIconPixmap,"action_document");
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/IconH.h>)

\<a id="gallery.component.drophighlightwidgetclass"\>\</a\>

### `xm.drophighlightwidgetclass`
- Class: `xmDropHighlightWidgetClass`
- Example: `gallery.source.drophighlightwidgetclass`
- Interaction: `gallery.interaction.drophighlightwidgetclass`
- Screenshot: `gallery.screenshot.drophighlightwidgetclass`
- Capability: constructible

**Demo**

![xmDropHighlightWidgetClass in the component demo](<gallery-screenshots/xm-drophighlightwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmDropHighlightWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Drop a document here");
example = XtVaCreateManagedWidget((char *)name, class, parent,
    XmNdropHighlightLabel, label, NULL);
XmDropHighlightSetState(example, XmDROP_HIGHLIGHT_VALID);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/DropHighlight.h>)
