/* $Header: /cvsroot/lesstif/lesstif/test/Xm/scrolledwindow/test13.c,v 1.6 2001/06/18 14:22:06 amai Exp $ * This test is an interactive interface to control the resources * of a bunch of widgets. These widgets are really stolen out of * test12. */ #include #include #include #include #include #include #include #include #include #include #ifdef LESSTIF_VERSION #include #endif Widget toplevel, sw, ab; Dimension st; /* * These are the ScrolledWindow resources that can be set by sliders. */ struct x { char *name; int initial, min, max; } list [] = { { XmNwidth, 100, 0, 400 }, { XmNheight, 100, 0, 400 }, { XmNspacing, 3, 0, 20 }, { XmNshadowThickness, 5, 0, 20 }, }; char *fallback[] = { "*sw.background: green", "*sw.topShadowColor: red", "*sw.bottomShadowColor: blue", "*ab.background: yellow", "*ab.foreground: black", NULL }; void cb(Widget wid, XtPointer cld, XtPointer cad) { Dimension w,h,bw; static Boolean toggle=False; if ((toggle = !toggle)) { w=300; h=300; bw = 1; } else { w=100; h=100; bw = 10; } printf("scrolledW child: asking for %ix%i (bw %i) /",w,h,bw); XtVaSetValues(wid,XmNwidth,w,XmNheight,h,XmNborderWidth,bw,NULL); XtVaGetValues(wid,XmNwidth,&w,XmNheight,&h,XmNborderWidth,&bw,NULL); printf("got %ix%i (bw %i)\n",w,h,bw); } void Quit(Widget w, XtPointer client, XtPointer call) { exit(0); } void ChangePlacement(Widget w, XtPointer client, XtPointer call) { XtVaSetValues(sw, XmNscrollBarPlacement, (int)client, NULL); } void Change(Widget w, XtPointer client, XtPointer call) { int i = (int)client; XmScaleCallbackStruct *p = (XmScaleCallbackStruct *)call; XtVaSetValues(sw, list[i].name, p->value, NULL); } int main(int argc, char **argv) { XtAppContext app; Widget top, mb, form, fc, fp, quit, s, om, mp, w; int i; Arg arg; XmString xms; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv, fallback, NULL); form = XtVaCreateManagedWidget("form", xmFormWidgetClass, toplevel, XmNwidth, 500, XmNheight, 300, XmNresizePolicy, XmRESIZE_NONE, NULL); mb = XtVaCreateManagedWidget("mb", xmRowColumnWidgetClass, form, XmNrowColumnType, XmMENU_BAR, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_NONE, NULL); fp = XmCreatePulldownMenu(mb, "file pulldown", NULL, 0); fc = XtVaCreateManagedWidget("File", xmCascadeButtonWidgetClass, mb, XmNsubMenuId, fp, NULL); quit = XtVaCreateManagedWidget("Quit", xmPushButtonWidgetClass, fp, NULL); XtAddCallback(quit, XmNactivateCallback, Quit, NULL); /* Panel of scales */ top = mb; for (i=0; i