1 /* test for showAsDefault and defaultButtonShadowThickness resources */
2 
3 #include <Xm/Xm.h>
4 #include <Xm/PushBG.h>
5 #include <Xm/Form.h>
6 #include <stdio.h>
7 
8 static char *FallBack[] = {
9 		"*.geometrySlop: 1",
10 		NULL
11 };
12 
13 int
main(int argc,char ** argv)14 main(int argc, char **argv)
15 {
16   Widget toplevel, one, two;
17   XtAppContext app;
18   XmFontList fontlist;
19   XmString xmstr1;
20   Dimension w,i,s,l,t,h;
21 
22   XtSetLanguageProc(NULL, NULL, NULL);
23 
24   toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv, FallBack, NULL);
25 
26   fontlist = XmFontListAppendEntry(NULL,
27 			   XmFontListEntryCreate("MY_FONT",
28 						 XmFONT_IS_FONT,
29 						 XLoadQueryFont(XtDisplay(toplevel),
30  	                                         "-adobe-helvetica-bold-o-normal--17-0-75-75-p-*-iso8859-1")));
31 
32   xmstr1 = XmStringCreateLtoR("Here\nIs\nA\nDefault\nButton", "MY_FONT");
33 
34   two = XtVaCreateManagedWidget("Button1", xmFormWidgetClass,
35 				 toplevel, NULL);
36 
37   one = XtVaCreateManagedWidget("One",
38                                 xmPushButtonGadgetClass,
39                                 two,
40 				XmNfontList, fontlist,
41 				XmNlabelString, xmstr1,
42 				XmNshowAsDefault, 1,
43 				XmNdefaultButtonShadowThickness, 3,
44 				XmNtopAttachment, XmATTACH_FORM,
45 				XmNleftAttachment, XmATTACH_FORM,
46 				XmNrightAttachment, XmATTACH_FORM,
47 				XmNbottomAttachment, XmATTACH_FORM,
48 				NULL);
49 
50   XtRealizeWidget(toplevel);
51   XtVaGetValues(one,
52 		XmNhighlightThickness, &i,
53 		XmNshadowThickness, &s,
54 		XmNmarginWidth, &w,
55 		XmNmarginHeight, &h,
56 		XmNmarginLeft, &l,
57 		XmNmarginTop, &t,
58 		NULL);
59 
60 printf("highlight: %d shad: %d marWid: %d marHei: %d marLeft: %d marTop: %d\n",
61 	 i, s, w, h, l, t);
62 
63 /* Note: the following values are the result of
64  * querying the current geometry.
65  */
66 {
67 static XtWidgetGeometry Expected[] = {
68    CWWidth | CWHeight            ,    0,    0,   92,  122, 0,0,0, /* Button1 */
69    CWWidth | CWHeight | CWX | CWY,    0,    0,   92,  122, 0,0,0, /* One */
70 };
71 /* toplevel should be replaced with to correct applicationShell */
72 PrintDetails(toplevel, Expected);
73 }
74 LessTifTestMainLoop(toplevel);
75   exit(0);
76 }
77