1 /* test for pushbutton callbacks */
2 
3 #include <Xm/Xm.h>
4 #include <Xm/PushB.h>
5 #include <stdio.h>
6 
7 void
activate_callback(Widget w,XtPointer client_data,XtPointer call_data)8 activate_callback(Widget w, XtPointer client_data, XtPointer call_data)
9 {
10     XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *)call_data;
11     printf ("Activated: click_count: %d\n", cbs->click_count);
12 }
13 
14 void
arm_callback(Widget w,XtPointer client_data,XtPointer call_data)15 arm_callback(Widget w, XtPointer client_data, XtPointer call_data)
16 {
17     printf ("Armed\n");
18 }
19 
20 void
disarm_callback(Widget w,XtPointer client_data,XtPointer call_data)21 disarm_callback(Widget w, XtPointer client_data, XtPointer call_data)
22 {
23     printf ("Disarmed\n");
24 }
25 
26 int
main(int argc,char ** argv)27 main(int argc, char **argv)
28 {
29   Widget toplevel, one;
30   XtAppContext app;
31 
32   XmString xmstr1 = XmStringCreateLtoR("Here Is A Label\nHere\nIs\nA\nLabel", XmFONTLIST_DEFAULT_TAG);
33 
34   XtSetLanguageProc(NULL, NULL, NULL);
35 
36   toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv, NULL, NULL);
37 
38   one = XtVaCreateManagedWidget("One",
39                                 xmPushButtonWidgetClass,
40                                 toplevel,
41 				XmNlabelString, xmstr1,
42 				XmNmultiClick, XmMULTICLICK_KEEP, NULL);
43 
44   XtAddCallback(one, XmNactivateCallback, activate_callback, NULL);
45   XtAddCallback(one, XmNarmCallback, arm_callback, NULL);
46   XtAddCallback(one, XmNdisarmCallback, disarm_callback, NULL);
47 
48   XtRealizeWidget(toplevel);
49 
50   {
51   static XtWidgetGeometry Expected[] = {
52   	CWWidth | CWHeight,		0,	0,	102,	77,	0,0,0,	/* Form */
53 };
54 
55   PrintDetails(toplevel, Expected);
56   }
57   LessTifTestMainLoop(toplevel);
58   /*
59   XtAppMainLoop(app);
60   */
61 
62   exit(0);
63 }
64