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 <Xm/DrawnB.h>
52 #include <Xm/Form.h>
53 #include <Xm/Label.h>
54 #include <XmL/Folder.h>
55
56 main(argc, argv)
57 int argc;
58 char *argv[];
59 {
60 XtAppContext app;
61 Widget shell, form, folder, tab, folderForm;
62 XmString str;
63 char pageName[
20], tabName[
20];
64 int i;
65
66 shell = XtAppInitialize(&app,
"Folder2",
NULL,
0,
67 &argc, argv,
NULL,
NULL,
0);
68
69 form = XtVaCreateManagedWidget(
"form",
70 xmFormWidgetClass, shell,
71 XtVaTypedArg, XmNbackground, XmRString,
"#C0C0C0",
8,
72 XmNmarginWidth,
8,
73 XmNmarginHeight,
8,
74 XmNshadowThickness,
0,
75 NULL);
76
77 folder = XtVaCreateManagedWidget(
"folder",
78 xmlFolderWidgetClass, form,
79 XtVaTypedArg, XmNbackground, XmRString,
"#C0C0C0",
8,
80 XtVaTypedArg, XmNforeground, XmRString,
"black",
6,
81 XmNtabPlacement, XmFOLDER_RIGHT,
82 XmNmarginWidth,
10,
83 XmNtopAttachment, XmATTACH_FORM,
84 XmNbottomAttachment, XmATTACH_FORM,
85 XmNleftAttachment, XmATTACH_FORM,
86 XmNrightAttachment, XmATTACH_FORM,
87 NULL);
88
89 for (i =
0; i <
3; i++)
90 {
91 sprintf(pageName,
"Page %d", i);
92
93
94 sprintf(tabName,
"Tab %d", i);
95 str = XmStringCreateSimple(tabName);
96 tab = XtVaCreateManagedWidget(
"tab",
97 xmDrawnButtonWidgetClass, folder,
98 XtVaTypedArg, XmNbackground, XmRString,
"#C0C0C0",
8,
99 XtVaTypedArg, XmNforeground, XmRString,
"black",
6,
100 XmNlabelString, str,
101 XmNtabManagedName, pageName,
102 NULL);
103 XmStringFree(str);
104
105
106
107
108 folderForm = XtVaCreateManagedWidget(
"folderForm",
109 xmFormWidgetClass, folder,
110 XtVaTypedArg, XmNbackground, XmRString,
"#C0C0C0",
8,
111 XmNtabManagedName, pageName,
112 NULL);
113
114
115 XtVaCreateManagedWidget(pageName,
116 xmLabelWidgetClass, folderForm,
117 XtVaTypedArg, XmNbackground, XmRString,
"#C0C0C0",
8,
118 XtVaTypedArg, XmNforeground, XmRString,
"black",
6,
119 XmNmarginWidth,
100,
120 XmNmarginHeight,
80,
121 XmNtopAttachment, XmATTACH_FORM,
122 XmNbottomAttachment, XmATTACH_FORM,
123 XmNleftAttachment, XmATTACH_FORM,
124 XmNrightAttachment, XmATTACH_FORM,
125 NULL);
126 }
127
128 XtRealizeWidget(shell);
129 XtAppMainLoop(app);
130 }
131