1 /* $Header: /cvsroot/lesstif/lesstif/test/Xm/mainw/test11.c,v 1.8 2002/05/03 12:03:41 amai Exp $ */
2 
3 #include <stdlib.h>
4 
5 #include <Xm/Xm.h>
6 #include <Xm/MainW.h>
7 #include <Xm/RowColumn.h>
8 #include <Xm/PushB.h>
9 #include <Xm/Label.h>
10 #include <Xm/DrawingA.h>
11 #include <Xm/ScrollBar.h>
12 #include <Xm/Form.h>
13 #include <Xm/Frame.h>
14 
15 #include "../../common/Test.h"
16 
17 #define LABEL_SIZE 100
18 
19 static char *FallBack[] = {
20 		"*.geometrySlop: 1",
21 		NULL
22 };
23 
24 int
main(int argc,char * argv[])25 main(int argc, char *argv[])
26 {
27 	XtAppContext app;
28 	Widget top;
29 	Widget mainw;
30 	Widget buttons;
31 	Widget quitbutton;
32 	Widget nextbutton;
33 	Widget prevbutton;
34 	Widget basebutton;
35 	Widget spacerlabel;
36 	Widget timingbutton;
37 	Widget draw;
38 	Widget hscroll;
39 	Widget vscroll;
40 	Widget status;
41 	Widget infoframe;
42 	Widget csrframe;
43 	Widget mkrframe;
44 	Widget difframe;
45 	Widget infolabel;
46 	Widget csrlabel;
47 	Widget mkrlabel;
48 	Widget diflabel;
49 
50 	/*initialise the toolkit */
51 
52 	top = XtVaAppInitialize(&app, "VCD", NULL, 0, &argc, argv, FallBack, NULL);
53 
54 
55 
56 
57 
58 
59 	mainw = XtVaCreateManagedWidget("mainw", xmMainWindowWidgetClass, top,
60 
61 				       XmNheight, 400,
62 
63 				       XmNwidth, 600,
64 
65 
66 				       NULL);
67 
68 
69 
70 	buttons = XtVaCreateManagedWidget("buttons", xmRowColumnWidgetClass, mainw,
71 
72 					  XmNorientation, XmHORIZONTAL,
73 
74 
75 					  XmNheight, LABEL_SIZE / 2,
76 
77 					  NULL);
78 
79 
80 	/*create the buttons to go in the 'buttons' widget       */
81 
82 	quitbutton = XtVaCreateManagedWidget("Quit", xmPushButtonWidgetClass, buttons,
83 
84 					     NULL);
85 
86 
87 
88 	nextbutton = XtVaCreateManagedWidget("NextEdge", xmPushButtonWidgetClass, buttons,
89 
90 					     NULL);
91 
92 
93 
94 	prevbutton = XtVaCreateManagedWidget("Prev Edge", xmPushButtonWidgetClass, buttons,
95 
96 					     NULL);
97 
98 
99 
100 	basebutton = XtVaCreateManagedWidget("Base->Marker", xmPushButtonWidgetClass, buttons,
101 
102 					     NULL);
103 
104 
105 
106 	spacerlabel = XtVaCreateManagedWidget("spacerlabel", xmLabelWidgetClass, buttons,
107 
108 					      NULL);
109 
110 
111 
112 	timingbutton = XtVaCreateManagedWidget("Timing Spread", xmPushButtonWidgetClass, buttons,
113 
114 					       NULL);
115 
116 
117 	/*work area widget */
118 
119 	draw = XtVaCreateManagedWidget("drawing area", xmDrawingAreaWidgetClass, mainw,
120 
121 				       NULL);
122 
123 
124 
125 	/*create some scrollbars */
126 
127 	hscroll = XtVaCreateManagedWidget("hscroll", xmScrollBarWidgetClass, mainw,
128 
129 					  XmNorientation, XmHORIZONTAL,
130 
131 					  XmNmaximum, 10000,
132 
133 					  XmNminimum, 0,
134 
135 					  XmNsliderSize, 1000,
136 
137 
138 					  XmNpageIncrement, 1,
139 
140 					  XmNincrement, 1,
141 
142 					  NULL);
143 
144 
145 
146 
147 	vscroll = XtVaCreateManagedWidget("vscroll", xmScrollBarWidgetClass, mainw,
148 
149 
150 					  XmNorientation, XmVERTICAL,
151 
152 					  XmNmaximum, 10000,
153 
154 
155 					  XmNminimum, 0,
156 
157 					  XmNsliderSize, 1000,
158 
159 					  XmNincrement, 1,
160 
161 
162 					  XmNpageIncrement, 1,
163 
164 					  NULL);
165 
166 
167 	/*container for info boxes
168 	  note: each label widget is contained within it's own frame
169 	  widget (just to look nice) */
170 
171 	status = XtVaCreateManagedWidget("status",
172 					 xmFormWidgetClass, mainw,
173 
174 					 XmNorientation, XmHORIZONTAL,
175 
176 
177 /*
178    XmNheight,LABEL_SIZE,
179  */
180 
181 					 NULL);
182 
183 
184 
185 	infoframe = XtVaCreateManagedWidget("infoframe", xmFrameWidgetClass, status,
186 
187 					  XmNleftAttachment, XmATTACH_POSITION,
188 
189 					    XmNleftPosition, 1,
190 
191 
192 					    XmNtopAttachment, XmATTACH_POSITION,
193 
194 					    XmNtopPosition, 2,
195 
196 
197 					XmNbottomAttachment, XmATTACH_POSITION,
198 
199 					    XmNbottomPosition, 48,
200 
201 
202 					 XmNrightAttachment, XmATTACH_POSITION,
203 
204 					    XmNrightPosition, 99,
205 
206 
207 					    NULL);
208 
209 
210 
211 	csrframe = XtVaCreateManagedWidget("csrframe", xmFrameWidgetClass, status,
212 
213 					   XmNleftAttachment, XmATTACH_POSITION,
214 
215 
216 					   XmNleftPosition, 1,
217 
218 					   XmNtopAttachment, XmATTACH_POSITION,
219 
220 
221 					   XmNtopPosition, 52,
222 
223 					XmNbottomAttachment, XmATTACH_POSITION,
224 
225 
226 					   XmNbottomPosition, 98,
227 
228 					 XmNrightAttachment, XmATTACH_POSITION,
229 
230 
231 					   XmNrightPosition, 33,
232 
233 					   NULL);
234 
235 
236 
237 	mkrframe = XtVaCreateManagedWidget("mkrframe", xmFrameWidgetClass, status,
238 
239 					   XmNleftAttachment, XmATTACH_POSITION,
240 
241 					   XmNleftPosition, 34,
242 
243 					   XmNtopAttachment, XmATTACH_POSITION,
244 
245 					   XmNtopPosition, 52,
246 
247 
248 					XmNbottomAttachment, XmATTACH_POSITION,
249 
250 					   XmNbottomPosition, 98,
251 
252 
253 					 XmNrightAttachment, XmATTACH_POSITION,
254 
255 					   XmNrightPosition, 66,
256 
257 
258 					   NULL);
259 
260 
261 
262 	difframe = XtVaCreateManagedWidget("difframe", xmFrameWidgetClass, status,
263 
264 					   XmNleftAttachment, XmATTACH_POSITION,
265 
266 
267 					   XmNleftPosition, 67,
268 
269 					   XmNtopAttachment, XmATTACH_POSITION,
270 
271 
272 					   XmNtopPosition, 52,
273 
274 					XmNbottomAttachment, XmATTACH_POSITION,
275 
276 
277 					   XmNbottomPosition, 98,
278 
279 					 XmNrightAttachment, XmATTACH_POSITION,
280 
281 
282 					   XmNrightPosition, 99,
283 
284 					   NULL);
285 
286 
287 
288 	infolabel = XtVaCreateManagedWidget("infolabel", xmLabelWidgetClass, infoframe,
289 
290 
291 					    XmNalignment, XmALIGNMENT_BEGINNING,
292 
293 
294 					    XmNisAligned, TRUE,
295 
296 					    NULL);
297 
298 
299 
300 	csrlabel = XtVaCreateManagedWidget("csrlabel", xmLabelWidgetClass, csrframe,
301 
302 
303 					   XmNalignment, XmALIGNMENT_BEGINNING,
304 
305 
306 					   XmNisAligned, TRUE,
307 
308 					   NULL);
309 
310 
311 
312 
313 
314 	mkrlabel = XtVaCreateManagedWidget("mkrlabel", xmLabelWidgetClass, mkrframe,
315 
316 
317 					   XmNalignment, XmALIGNMENT_BEGINNING,
318 
319 
320 					   XmNisAligned, TRUE,
321 
322 					   NULL);
323 
324 
325 
326 	diflabel = XtVaCreateManagedWidget("diflabel", xmLabelWidgetClass, difframe,
327 
328 
329 					   XmNalignment, XmALIGNMENT_BEGINNING,
330 
331 
332 					   XmNisAligned, TRUE,
333 
334 					   NULL);
335 
336 
337 
338 	XmMainWindowSetAreas(mainw,
339 
340 			     buttons,
341 
342 			     status,	/*<--this widget appears too high,
343 					  underneath 'buttons' widget
344 					  until resized */
345 
346 			     hscroll,
347 
348 			     vscroll,
349 
350 
351 			     draw);
352 
353 
354 	XtRealizeWidget(top);
355 
356 {
357 static XtWidgetGeometry Expected[] = {
358    CWWidth | CWHeight            ,   56,   72,  600,  400, 0,0,0, /* mainw */
359    CWWidth | CWHeight | CWX | CWY,    0,    0,  600,   31, 0,0,0, /* buttons */
360    CWWidth | CWHeight | CWX | CWY,    3,    3,   36,   25, 0,0,0, /* Quit */
361    CWWidth | CWHeight | CWX | CWY,   42,    3,   60,   25, 0,0,0, /* NextEdge */
362    CWWidth | CWHeight | CWX | CWY,  105,    3,   66,   25, 0,0,0, /* Prev Edge */
363    CWWidth | CWHeight | CWX | CWY,  174,    3,   84,   25, 0,0,0, /* Base->Marker */
364    CWWidth | CWHeight | CWX | CWY,  261,    3,   70,   25, 0,0,0, /* spacerlabel */
365    CWWidth | CWHeight | CWX | CWY,  334,    3,   90,   25, 0,0,0, /* Timing Spread */
366    CWWidth | CWHeight | CWX | CWY,    0,   77,  581,  304, 0,0,0, /* drawing area */
367    CWWidth | CWHeight | CWX | CWY,    0,  385,  581,   15, 0,0,0, /* hscroll */
368    CWWidth | CWHeight | CWX | CWY,  585,   77,   15,  304, 0,0,0, /* vscroll */
369    CWWidth | CWHeight | CWX | CWY,    0,   31,  600,   46, 0,0,0, /* status */
370    CWWidth | CWHeight | CWX | CWY,    6,    1,  588,   21, 0,0,0, /* infoframe */
371    CWWidth | CWHeight | CWX | CWY,    2,    2,  584,   17, 0,0,0, /* infolabel */
372    CWWidth | CWHeight | CWX | CWY,    6,   24,  192,   21, 0,0,0, /* csrframe */
373    CWWidth | CWHeight | CWX | CWY,    2,    2,  188,   17, 0,0,0, /* csrlabel */
374    CWWidth | CWHeight | CWX | CWY,  204,   24,  192,   21, 0,0,0, /* mkrframe */
375    CWWidth | CWHeight | CWX | CWY,    2,    2,  188,   17, 0,0,0, /* mkrlabel */
376    CWWidth | CWHeight | CWX | CWY,  402,   24,  192,   21, 0,0,0, /* difframe */
377    CWWidth | CWHeight | CWX | CWY,    2,    2,  188,   17, 0,0,0, /* diflabel */
378 };
379 /* toplevel should be replaced with to correct applicationShell */
380 PrintDetails(top, Expected);
381 }
382   LessTifTestMainLoop(top);
383 
384    exit(0);
385 }
386