1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 #include <Xm/Xm.h>
51 #include <XmL/Tree.h>
52
53 main(argc, argv)
54 int argc;
55 char *argv[];
56 {
57 XtAppContext app;
58 Widget shell, tree;
59 Pixmap pixmap, pixmask;
60 XmString str;
61
62 shell = XtAppInitialize(&app,
"Tree1",
NULL,
0,
63 &argc, argv,
NULL,
NULL,
0);
64
65 tree = XtVaCreateManagedWidget(
"tree",
66 xmlTreeWidgetClass, shell,
67 XmNvisibleRows,
10,
68 XmNwidth,
250,
69 NULL);
70
71 XtVaSetValues(tree,
72 XmNlayoutFrozen, True,
73 NULL);
74
75 pixmap = XmUNSPECIFIED_PIXMAP;
76 pixmask = XmUNSPECIFIED_PIXMAP;
77
78 str = XmStringCreateSimple(
"Root");
79 XmLTreeAddRow(tree,
0, True, True, -
1, pixmap, pixmask, str);
80 XmStringFree(str);
81 str = XmStringCreateSimple(
"Level 1 Parent");
82 XmLTreeAddRow(tree,
1, True, True, -
1, pixmap, pixmask, str);
83 XmStringFree(str);
84 str = XmStringCreateSimple(
"1st Child of Level 1 Parent");
85 XmLTreeAddRow(tree,
2, False, False, -
1, pixmap, pixmask, str);
86 XmStringFree(str);
87 str = XmStringCreateSimple(
"2nd Child of Level 1 Parent");
88 XmLTreeAddRow(tree,
2, False, False, -
1, pixmap, pixmask, str);
89 XmStringFree(str);
90 str = XmStringCreateSimple(
"Level 2 Parent");
91 XmLTreeAddRow(tree,
2, True, True, -
1, pixmap, pixmask, str);
92 XmStringFree(str);
93 str = XmStringCreateSimple(
"Child of Level 2 Parent");
94 XmLTreeAddRow(tree,
3, False, False, -
1, pixmap, pixmask, str);
95 XmStringFree(str);
96 str = XmStringCreateSimple(
"Level 1 Parent");
97 XmLTreeAddRow(tree,
1, True, True, -
1, pixmap, pixmask, str);
98 XmStringFree(str);
99 str = XmStringCreateSimple(
"Child of Level 1 Parent");
100 XmLTreeAddRow(tree,
2, False, False, -
1, pixmap, pixmask, str);
101 XmStringFree(str);
102
103 XtVaSetValues(tree,
104 XmNlayoutFrozen, False,
105 NULL);
106
107 XtRealizeWidget(shell);
108 XtAppMainLoop(app);
109 }
110