1#include <stdlib.h> 2#include <stdio.h> 3#include <X11/StringDefs.h> 4#include <Xaw/Box.h> 5#include <Xaw/Label.h> 6#include <Xaw/Paned.h> 7#include <Xaw/Command.h> 8 9static void 10quit_cb(Widget w, XtPointer client_data, XtPointer call_data) 11{ 12 XtAppSetExitFlag(XtWidgetToApplicationContext(w)); 13} 14 15static void 16getnumsub_cb(Widget w, XtPointer client_data, XtPointer call_data) 17{ 18 Widget p=XtParent(w); 19 char buf[80]; 20 int min,max; 21 XawPanedGetMinMax(w,&min,&max); 22 23 sprintf(buf,"%d number\n%d min %d max\n",XawPanedGetNumSub(p),min,max); 24 XtVaSetValues(w,XtNlabel,buf,NULL); 25 26} 27static void 28refigure_cb(Widget w, XtPointer client_data, XtPointer call_data) 29{ 30 Widget p=XtParent(w); 31 XawPanedSetRefigureMode(p,False); 32} 33 34int main(int argc, char **argv) 35{ 36 Widget toplevel,pane,label,command; 37 XtAppContext app_con; 38 toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, 39 &argc, argv, NULL, 40 NULL, 0); 41 42 pane=XtVaCreateManagedWidget( "paned", panedWidgetClass, toplevel, 43 NULL); 44 45 label = XtVaCreateManagedWidget("Label", 46 labelWidgetClass, 47 pane, XtNlabel, "quick", NULL); 48 49 XawPanedAllowResize(label,False); 50 51 label = XtVaCreateManagedWidget("Label", 52 labelWidgetClass, 53 pane, XtNlabel, "brown", NULL); 54 55 label = XtVaCreateManagedWidget("Label", 56 labelWidgetClass, 57 pane, XtNlabel, "fox", NULL); 58 59 command = XtVaCreateManagedWidget("cmd", 60 commandWidgetClass, pane, 61 XtNlabel, "stop resize", 62 NULL); 63 64 XtAddCallback(command, XtNcallback,refigure_cb, NULL); 65 66 command = XtVaCreateManagedWidget("cmd", 67 commandWidgetClass, pane, 68 XtNlabel, "getnumsub", 69 NULL); 70 71 XtAddCallback(command, XtNcallback,getnumsub_cb, NULL); 72 XawPanedSetMinMax(command,50,100); 73 74 command = XtVaCreateManagedWidget("cmd", 75 commandWidgetClass, pane, 76 XtNlabel, "EXIT", 77 NULL); 78 XtAddCallback(command, XtNcallback, quit_cb, NULL); 79 80 XtRealizeWidget(toplevel); 81 82 XtAppMainLoop(app_con); 83 exit(0); 84} 85