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/Form.h>
52 #include <Xm/DrawnB.h>
53 #include <XmL/XmL.h>
54
55 main(argc, argv)
56 int argc;
57 char *argv[];
58 {
59 XtAppContext app;
60 Widget shell, form, button[
4][
5];
61 int i, j;
62 static int types[
5] =
63 {
64 XmDRAWNB_ARROW,
65 XmDRAWNB_ARROWLINE,
66 XmDRAWNB_DOUBLEARROW,
67 XmDRAWNB_SQUARE,
68 XmDRAWNB_DOUBLEBAR
69 };
70 static int dirs[
4] =
71 {
72 XmDRAWNB_RIGHT,
73 XmDRAWNB_LEFT,
74 XmDRAWNB_UP,
75 XmDRAWNB_DOWN
76 };
77
78 shell = XtAppInitialize(&app,
"Grid1",
NULL,
0,
79 &argc, argv,
NULL,
NULL,
0);
80
81 form = XtVaCreateManagedWidget(
"form",
82 xmFormWidgetClass, shell,
83 XmNfractionBase,
5,
84 XmNshadowThickness,
0,
85 NULL);
86
87 for (i =
0 ; i <
4; i++)
88 for (j =
0; j <
5; j++)
89 {
90 button[i][j] = XtVaCreateManagedWidget(
"drawnB",
91 xmDrawnButtonWidgetClass, form,
92 XmNtopAttachment, XmATTACH_POSITION,
93 XmNtopPosition, i,
94 XmNbottomAttachment, XmATTACH_POSITION,
95 XmNbottomPosition, i +
1,
96 XmNleftAttachment, XmATTACH_POSITION,
97 XmNleftPosition, j,
98 XmNrightAttachment, XmATTACH_POSITION,
99 XmNrightPosition, j +
1,
100 XmNwidth,
30,
101 XmNheight,
30,
102 NULL);
103 XmLDrawnButtonSetType(button[i][j], types[j], dirs[i]);
104 }
105
106 XtRealizeWidget(shell);
107 XtAppMainLoop(app);
108 }
109
110