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 printf ("dragCallback\n");
8 }
9
valueChangedCallback(Widget w,XtPointer clientData,XtPointer callData)10 void valueChangedCallback(Widget w, XtPointer clientData, XtPointer callData)
11 {
12 printf ("valueChangedCallback\n");
13 }
14
15 int
main(int argc,char ** argv)16 main(int argc, char **argv)
17 {
18 Widget toplevel, one;
19 XtAppContext app;
20 unsigned int maximum;
21 XmString str;
22
23 XtSetLanguageProc(NULL, NULL, NULL);
24
25 toplevel = XtVaAppInitialize(&app, "Scale", NULL, 0, &argc, argv, NULL, NULL);
26
27 str = XmStringCreateLtoR("Test Scale", XmFONTLIST_DEFAULT_TAG);
28 one = XtVaCreateManagedWidget("sb", xmScaleWidgetClass, toplevel,
29 XmNorientation, XmHORIZONTAL,
30 XmNscaleWidth, 100,
31 XmNtitleString, str,
32 NULL);
33
34 XtAddCallback(one, XmNdragCallback, dragCallback, NULL);
35 XtAddCallback(one, XmNvalueChangedCallback, valueChangedCallback, NULL);
36
37 XtRealizeWidget(toplevel);
38
39 XtVaGetValues(one, XmNmaximum, &maximum, NULL);
40
41 printf ("one.maximum = %u\n", maximum);
42
43
44 {
45 static XtWidgetGeometry Expected[] = {
46 CWWidth | CWHeight , 50, 50, 100, 40, 0,0,0, /* sb */
47 CWWidth | CWHeight | CWX | CWY, 0, 19, 64, 17, 0,0,0, /* Title */
48 CWWidth | CWHeight | CWX | CWY, 0, 0, 100, 19, 0,0,0, /* Scrollbar */
49 };
50 PrintDetails(toplevel,Expected);
51 };
52 LessTifTestMainLoop(toplevel);
53
54 exit(0);
55 }
56