1 #include <stdio.h>
2 #include <Xm/Xm.h>
3 #include <Xm/ScaleP.h>
4 
dragCallback(Widget w,XtPointer clientData,XtPointer callData)5 void dragCallback(Widget w, XtPointer clientData, XtPointer callData)
6 {
7     XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *)callData;
8 
9     printf ("dragCallback: %d\n", cbs->value);
10 }
11 
valueChangedCallback(Widget w,XtPointer clientData,XtPointer callData)12 void valueChangedCallback(Widget w, XtPointer clientData, XtPointer callData)
13 {
14     XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *)callData;
15 
16     printf ("valueChangedCallback: %d\n", cbs->value);
17 }
18 
19 int
main(int argc,char ** argv)20 main(int argc, char **argv)
21 {
22   Widget toplevel, one;
23   XtAppContext app;
24   unsigned int maximum;
25 
26   XtSetLanguageProc(NULL, NULL, NULL);
27 
28   toplevel = XtVaAppInitialize(&app, "Scale", NULL, 0, &argc, argv, NULL, NULL);
29 
30   one = XtVaCreateManagedWidget("sb", xmScaleWidgetClass, toplevel,
31                                 XmNorientation, XmVERTICAL,
32                                 XmNscaleHeight, 100,
33 				XmNshowValue, True,
34 				XmNprocessingDirection, XmMAX_ON_TOP,
35 				NULL);
36 
37   XtAddCallback(one, XmNdragCallback, dragCallback, NULL);
38   XtAddCallback(one, XmNvalueChangedCallback, valueChangedCallback, NULL);
39 
40   XtRealizeWidget(toplevel);
41 
42   XtVaGetValues(one, XmNmaximum, &maximum, NULL);
43 
44   printf ("one.maximum = %u\n", maximum);
45 
46 
47 {
48     static XtWidgetGeometry Expected[] = {
49    CWWidth | CWHeight            ,   50,   50,   39,  100, 0,0,0, /* sb */
50    CWWidth | CWHeight | CWX | CWY,   20,    0,   19,  100, 0,0,0, /* Scrollbar */
51     };
52     PrintDetails(toplevel,Expected);
53 };
54   LessTifTestMainLoop(toplevel);
55 
56   exit(0);
57 }
58