#include <Xm/Xm.h>
#include <XmL/Tree.h>
main(argc, argv)
int argc;
char *argv[];
{
XtAppContext app;
Widget shell, tree;
Pixmap pixmap, pixmask;
XmString str;
shell = XtAppInitialize(&app, "Tree1", NULL, 0,
&argc, argv, NULL, NULL, 0);
tree = XtVaCreateManagedWidget("tree",
xmlTreeWidgetClass, shell,
XmNvisibleRows, 10,
XmNwidth, 250,
NULL);
XtVaSetValues(tree,
XmNlayoutFrozen, True,
NULL);
pixmap = XmUNSPECIFIED_PIXMAP;
pixmask = XmUNSPECIFIED_PIXMAP;
str = XmStringCreateSimple("Root");
XmLTreeAddRow(tree, 0, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Level 1 Parent");
XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("1st Child of Level 1 Parent");
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("2nd Child of Level 1 Parent");
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Level 2 Parent");
XmLTreeAddRow(tree, 2, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Child of Level 2 Parent");
XmLTreeAddRow(tree, 3, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Level 1 Parent");
XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Child of Level 1 Parent");
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
XtVaSetValues(tree,
XmNlayoutFrozen, False,
NULL);
XtRealizeWidget(shell);
XtAppMainLoop(app);
}