Back to index

plt-scheme  4.2.1
xwScrollbar.c
Go to the documentation of this file.
00001 /* Generated by wbuild
00002  * (generator version 3.2)
00003  */
00004 #include <X11/IntrinsicP.h>
00005 #include <X11/StringDefs.h>
00006 #include <xwArrow.h>
00007 #include <xwSlider2.h>
00008 #include <stdio.h>
00009 #include <./xwScrollbarP.h>
00010 static void Scroll(
00011 #if NeedFunctionPrototypes
00012 Widget,XEvent*,String*,Cardinal*
00013 #endif
00014 );
00015 
00016 static XtActionsRec actionsList[] = {
00017 {"Scroll", Scroll},
00018 };
00019 static void _resolve_inheritance(
00020 #if NeedFunctionPrototypes
00021 WidgetClass
00022 #endif
00023 );
00024 static void initialize(
00025 #if NeedFunctionPrototypes
00026 Widget ,Widget,ArgList ,Cardinal *
00027 #endif
00028 );
00029 static void resize(
00030 #if NeedFunctionPrototypes
00031 Widget
00032 #endif
00033 );
00034 static void insert_child(
00035 #if NeedFunctionPrototypes
00036 Widget 
00037 #endif
00038 );
00039 static Boolean  set_values(
00040 #if NeedFunctionPrototypes
00041 Widget ,Widget ,Widget,ArgList ,Cardinal *
00042 #endif
00043 );
00044 static void scroll_response(
00045 #if NeedFunctionPrototypes
00046 Widget ,XtPointer ,XtPointer 
00047 #endif
00048 );
00049 static void up(
00050 #if NeedFunctionPrototypes
00051 Widget ,XtPointer ,XtPointer 
00052 #endif
00053 );
00054 static void down(
00055 #if NeedFunctionPrototypes
00056 Widget ,XtPointer ,XtPointer 
00057 #endif
00058 );
00059 static void thumbscroll(
00060 #if NeedFunctionPrototypes
00061 Widget ,XtPointer ,XtPointer 
00062 #endif
00063 );
00064 static void copy_background(
00065 #if NeedFunctionPrototypes
00066 Widget,int ,XrmValue *
00067 #endif
00068 );
00069 /*ARGSUSED*/
00070 #if NeedFunctionPrototypes
00071 static void up(Widget  arrow,XtPointer  client_data,XtPointer  call_data)
00072 #else
00073 static void up(arrow,client_data,call_data)Widget  arrow;XtPointer  client_data;XtPointer  call_data;
00074 #endif
00075 {
00076     Widget self = (Widget) client_data;
00077     XfwfScrollInfo info;
00078 
00079     XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info);
00080     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) {
00081        info.reason = XfwfSUp;
00082        info.flags = XFWF_VPOS;
00083        info.vpos = max(0.0, info.vpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00084     } else {
00085        info.reason = XfwfSLeft;
00086        info.flags = XFWF_HPOS;
00087        info.hpos = max(0.0, info.hpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00088     }
00089     XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, &info);
00090 }
00091 /*ARGSUSED*/
00092 #if NeedFunctionPrototypes
00093 static void down(Widget  arrow,XtPointer  client_data,XtPointer  call_data)
00094 #else
00095 static void down(arrow,client_data,call_data)Widget  arrow;XtPointer  client_data;XtPointer  call_data;
00096 #endif
00097 {
00098     Widget self = (Widget) client_data;
00099     XfwfScrollInfo info;
00100 
00101     XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info);
00102     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) {
00103        info.reason = XfwfSDown;
00104        info.flags = XFWF_VPOS;
00105        info.vpos = min(1.0, info.vpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00106     } else {
00107        info.reason = XfwfSRight;
00108        info.flags = XFWF_HPOS;
00109        info.hpos = min(1.0, info.hpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00110     }
00111     XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, &info);
00112 }
00113 /*ARGSUSED*/
00114 #if NeedFunctionPrototypes
00115 static void thumbscroll(Widget  w,XtPointer  client_data,XtPointer  call_data)
00116 #else
00117 static void thumbscroll(w,client_data,call_data)Widget  w;XtPointer  client_data;XtPointer  call_data;
00118 #endif
00119 {
00120     Widget self = (Widget) client_data;
00121     XfwfScrollInfo *info = (XfwfScrollInfo*) call_data;
00122 
00123     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical)
00124        info->flags &= XFWF_VPOS;
00125     else
00126        info->flags &= XFWF_HPOS;
00127     XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, info);
00128 }
00129 /*ARGSUSED*/
00130 #if NeedFunctionPrototypes
00131 static void copy_background(Widget self,int  offset,XrmValue * value)
00132 #else
00133 static void copy_background(self,offset,value)Widget self;int  offset;XrmValue * value;
00134 #endif
00135 {
00136     value->addr = (XtPointer) &((XfwfScrollbarWidget)self)->core.background_pixel;
00137 }
00138 
00139 static XtResource resources[] = {
00140 {XtNvertical,XtCVertical,XtRBoolean,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.vertical),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.vertical),XtRImmediate,(XtPointer)True },
00141 {XtNscrollCallback,XtCScrollCallback,XtRCallback,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.scrollCallback),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.scrollCallback),XtRImmediate,(XtPointer)NULL },
00142 {XtNscrollResponse,XtCScrollResponse,XtRXTCallbackProc,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.scrollResponse),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.scrollResponse),XtRImmediate,(XtPointer)scroll_response },
00143 {XtNinitialDelay,XtCInitialDelay,XtRCardinal,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.initialDelay),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.initialDelay),XtRImmediate,(XtPointer)500 },
00144 {XtNrepeatDelay,XtCRepeatDelay,XtRCardinal,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.repeatDelay),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.repeatDelay),XtRImmediate,(XtPointer)50 },
00145 {XtNincrement,XtCIncrement,XtRFloat,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.increment),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.increment),XtRString,(XtPointer)"0.05"},
00146 {XtNscrollbarForeground,XtCScrollbarForeground,XtRPixel,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.scrollbarForeground),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.scrollbarForeground),XtRCallProc,(XtPointer)copy_background },
00147 {XtNshadow,XtCShadow,XtRDimension,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.shadow),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.shadow),XtRImmediate,(XtPointer)2 },
00148 {XtNminsize,XtCMinsize,XtRDimension,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.minsize),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.minsize),XtRImmediate,(XtPointer)20 },
00149 {XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfScrollbarRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfScrollbarRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 },
00150 {XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfScrollbarRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfScrollbarRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfSunken },
00151 {XtNdrawgrayScrollbar,XtCDrawgrayScrollbar,XtRBoolean,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.drawgrayScrollbar),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.drawgrayScrollbar),XtRImmediate,(XtPointer)FALSE },
00152 {XtNegdeBar,XtCEgdeBar,XtRBoolean,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.egdeBar),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.egdeBar),XtRImmediate,(XtPointer)FALSE },
00153 };
00154 
00155 XfwfScrollbarClassRec xfwfScrollbarClassRec = {
00156 { /* core_class part */
00157 /* superclass        */  (WidgetClass) &xfwfBoardClassRec,
00158 /* class_name        */  "XfwfScrollbar",
00159 /* widget_size       */  sizeof(XfwfScrollbarRec),
00160 /* class_initialize  */  NULL,
00161 /* class_part_initialize*/  _resolve_inheritance,
00162 /* class_inited      */  FALSE,
00163 /* initialize        */  initialize,
00164 /* initialize_hook   */  NULL,
00165 /* realize           */  XtInheritRealize,
00166 /* actions           */  actionsList,
00167 /* num_actions       */  1,
00168 /* resources         */  resources,
00169 /* num_resources     */  13,
00170 /* xrm_class         */  NULLQUARK,
00171 /* compres_motion    */  True ,
00172 /* compress_exposure        */  XtExposeCompressMaximal ,
00173 /* compress_enterleave      */  True ,
00174 /* visible_interest  */  False ,
00175 /* destroy           */  NULL,
00176 /* resize            */  resize,
00177 /* expose            */  XtInheritExpose,
00178 /* set_values        */  set_values,
00179 /* set_values_hook   */  NULL,
00180 /* set_values_almost        */  XtInheritSetValuesAlmost,
00181 /* get_values+hook   */  NULL,
00182 /* accept_focus      */  XtInheritAcceptFocus,
00183 /* version           */  XtVersion,
00184 /* callback_private  */  NULL,
00185 /* tm_table          */  NULL,
00186 /* query_geometry    */  XtInheritQueryGeometry,
00187 /* display_acceleator       */  XtInheritDisplayAccelerator,
00188 /* extension         */  NULL 
00189 },
00190 { /* composite_class part */
00191 XtInheritGeometryManager,
00192 XtInheritChangeManaged,
00193 insert_child,
00194 XtInheritDeleteChild,
00195 NULL
00196 },
00197 { /* XfwfCommon_class part */
00198 XtInherit_compute_inside,
00199 XtInherit_total_frame_width,
00200 XtInherit__expose,
00201 XtInherit_highlight_border,
00202 XtInherit_unhighlight_border,
00203 XtInherit_hilite_callbacks,
00204 XtInherit_would_accept_focus,
00205 XtInherit_traverse,
00206 XtInherit_lighter_color,
00207 XtInherit_darker_color,
00208 XtInherit_set_color,
00209 /* traversal_trans */  NULL ,
00210 /* traversal_trans_small */  NULL ,
00211 /* travMode */  1 ,
00212 },
00213 { /* XfwfFrame_class part */
00214  /* dummy */  0
00215 },
00216 { /* XfwfBoard_class part */
00217 XtInherit_set_abs_location,
00218 },
00219 { /* XfwfScrollbar_class part */
00220 scroll_response,
00221 },
00222 };
00223 WidgetClass xfwfScrollbarWidgetClass = (WidgetClass) &xfwfScrollbarClassRec;
00224 /*ARGSUSED*/
00225 static void Scroll(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params;
00226 {
00227     XfwfScrollInfo info;
00228 
00229     XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info);
00230     info.reason = XfwfCvtStringToScrollReason(params[0]);
00231     switch (info.reason) {
00232     case XfwfSUp: 
00233        info.flags = XFWF_VPOS;
00234        info.vpos = max(0.0, info.vpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00235        break;
00236     case XfwfSDown:
00237        info.flags = XFWF_VPOS;
00238        info.vpos = min(1.0, info.vpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00239        break;
00240     case XfwfSLeft:
00241        info.flags = XFWF_HPOS;
00242        info.hpos = max(0.0, info.hpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00243        break;
00244     case XfwfSRight:
00245        info.flags = XFWF_HPOS;
00246        info.hpos = min(1.0, info.hpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment);
00247        break;
00248     case XfwfSPageUp:
00249        info.flags = XFWF_VPOS;
00250        info.vpos = max(0.0, info.vpos - info.vsize);
00251        break;
00252     case XfwfSPageDown:
00253        info.flags = XFWF_VPOS;
00254        info.vpos = min(1.0, info.vpos + info.vsize);
00255        break;
00256     case XfwfSPageLeft:
00257        info.flags = XFWF_HPOS;
00258        info.hpos = max(0.0, info.hpos - info.hsize);
00259        break;
00260     case XfwfSPageRight:
00261        info.flags = XFWF_HPOS;
00262        info.hpos = min(1.0, info.hpos + info.hsize);
00263        break;
00264     case XfwfSTop:
00265        info.flags = XFWF_VPOS;
00266        info.vpos = 0.0;
00267        break;
00268     case XfwfSBottom:
00269        info.flags = XFWF_VPOS;
00270        info.vpos = 1.0;
00271        break;
00272     case XfwfSLeftSide:
00273        info.flags = XFWF_HPOS;
00274        info.hpos = 0.0;
00275        break;
00276     case XfwfSRightSide:
00277        info.flags = XFWF_HPOS;
00278        info.hpos = 1.0;
00279        break;
00280     default: break;                       /* Not understood */
00281     }
00282 
00283     XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, &info);
00284 }
00285 
00286 static void _resolve_inheritance(class)
00287 WidgetClass class;
00288 {
00289   XfwfScrollbarWidgetClass c = (XfwfScrollbarWidgetClass) class;
00290   XfwfScrollbarWidgetClass super;
00291   static CompositeClassExtensionRec extension_rec = {
00292     NULL, NULLQUARK, XtCompositeExtensionVersion,
00293     sizeof(CompositeClassExtensionRec), True};
00294   CompositeClassExtensionRec *ext;
00295   ext = (XtPointer)XtMalloc(sizeof(*ext));
00296   *ext = extension_rec;
00297   ext->next_extension = c->composite_class.extension;
00298   c->composite_class.extension = ext;
00299   if (class == xfwfScrollbarWidgetClass) return;
00300   super = (XfwfScrollbarWidgetClass)class->core_class.superclass;
00301   if (c->xfwfScrollbar_class.scroll_response == XtInherit_scroll_response)
00302     c->xfwfScrollbar_class.scroll_response = super->xfwfScrollbar_class.scroll_response;
00303 }
00304 /*ARGSUSED*/
00305 #if NeedFunctionPrototypes
00306 static void initialize(Widget  request,Widget self,ArgList  args,Cardinal * num_args)
00307 #else
00308 static void initialize(request,self,args,num_args)Widget  request;Widget self;ArgList  args;Cardinal * num_args;
00309 #endif
00310 {
00311     Position x, y, xa2, xslider, ya2, yslider;
00312     int w, h, wa, ha, wslider, hslider;
00313     Pixel bg, thumb_bg;
00314 
00315     ((XfwfScrollbarWidget)self)->xfwfScrollbar.initializing = True;
00316     ((XfwfScrollbarWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00317     w = max(1, w);
00318     h = max(1, h);
00319     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) {
00320        ha = wa = wslider = w;
00321        xa2 = xslider = x;
00322        hslider = ((int)h - 2*ha > 0) ? h - 2*ha : 10;
00323        yslider = y + ha;
00324        ya2 = yslider + hslider;
00325     } else {
00326        wa = ha = hslider = h;
00327        ya2 = yslider = y;
00328        wslider = ((int)w - 2*wa > 0) ? w - 2*wa : 10;
00329        xslider = x + wa;
00330        xa2 = xslider + wslider;
00331     }
00332     XtVaGetValues(self, XtNbackground, &bg, NULL),
00333     ((XfwfScrollbarWidgetClass)self->core.widget_class)->xfwfCommon_class.set_color(self, bg, &thumb_bg);
00334     ((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1 = XtVaCreateManagedWidget
00335        ("_arrow1", xfwfArrowWidgetClass, self,
00336         XtNx, x,
00337         XtNy, y,
00338         XtNwidth, max(1, wa),
00339         XtNheight, max(1, ha),
00340         XtNframeWidth, 0,
00341         XtNforeground, BlackPixelOfScreen(XtScreen(self)),
00342         XtNinitialDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.initialDelay,
00343         XtNrepeatDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.repeatDelay,
00344         XtNtraversalOn, False,
00345         XtNhighlightThickness, 0,
00346         XtNdirection, ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical?XfwfTop:XfwfLeft,
00347         XtNouterOffset, 0,
00348         XtNbackground, bg,
00349         XtNarrowShadow, 2,
00350          XtNhighlightColor, ((XfwfScrollbarWidget)self)->xfwfCommon.highlightColor,
00351         NULL);
00352     XtAddCallback(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNcallback, up, self);
00353     ((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2 = XtVaCreateManagedWidget
00354        ("_arrow2", xfwfArrowWidgetClass, self,
00355         XtNx, xa2,
00356         XtNy, ya2,
00357         XtNwidth, max(1, wa),
00358         XtNheight, max(1, ha),
00359         XtNframeWidth, 0,
00360         XtNforeground, BlackPixelOfScreen(XtScreen(self)),
00361         XtNinitialDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.initialDelay,
00362         XtNrepeatDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.repeatDelay,
00363         XtNtraversalOn, False,
00364         XtNhighlightThickness, 0,
00365         XtNdirection, ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical?XfwfBottom:XfwfRight,
00366         XtNouterOffset, 0,
00367         XtNbackground, bg,
00368         XtNarrowShadow, 2,
00369          XtNhighlightColor, ((XfwfScrollbarWidget)self)->xfwfCommon.highlightColor,
00370         NULL);
00371     XtAddCallback(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNcallback, down, self);
00372     ((XfwfScrollbarWidget)self)->xfwfScrollbar.slider = XtVaCreateManagedWidget
00373        ("_slider", xfwfSlider2WidgetClass, self,
00374         XtNx, xslider,
00375         XtNy, yslider,
00376         XtNwidth, max(1, wslider),
00377         XtNheight, max(1, hslider),
00378         XtNthumbColor, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground,
00379         XtNframeWidth, 0,
00380         XtNinitialDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.initialDelay,
00381         XtNrepeatDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.repeatDelay,
00382         XtNtraversalOn, False,
00383         XtNhighlightThickness, 0,
00384         XtNouterOffset, 0,
00385         XtNborderWidth, 0,
00386         XtNbackground, thumb_bg,
00387          XtNthumbFrameWidth, 1,
00388         NULL);
00389     XtAddCallback(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNscrollCallback, thumbscroll, self);
00390     XtVaGetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNscrollResponse, &((XfwfScrollbarWidget)self)->xfwfScrollbar.slider_scroll, NULL);
00391     ((XfwfScrollbarWidget)self)->xfwfScrollbar.initializing = False;
00392 }
00393 /*ARGSUSED*/
00394 #if NeedFunctionPrototypes
00395 static void resize(Widget self)
00396 #else
00397 static void resize(self)Widget self;
00398 #endif
00399 {
00400     Position x, y, xa2, xslider, ya2, yslider;
00401     int w, h, wa, ha, wslider, hslider;
00402 
00403     ((XfwfScrollbarWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00404     w = max(1, w);
00405     h = max(1, h);
00406     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) {
00407        wa = wslider = w;
00408        xa2 = xslider = x;
00409        ha = wa;
00410        hslider = ((int)h - 2*ha > 0) ? h - 2*ha : 10;
00411        yslider = y + ha;
00412        ya2 = yslider + hslider;
00413     } else {
00414        ha = hslider = h;
00415        ya2 = yslider = y;
00416        wa = ha;
00417        wslider = ((int)w - 2*wa > 0) ? w - 2*wa : 10;
00418        xslider = x + wa;
00419        xa2 = xslider + wslider;
00420     }
00421     XtConfigureWidget(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, x, y, max(1, wa), max(1, ha), 0);
00422     XtConfigureWidget(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, xa2, ya2, max(1, wa), max(1, ha), 0);
00423     XtConfigureWidget(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, xslider, yslider, max(1, wslider), max(1, hslider), 0);
00424 }
00425 /*ARGSUSED*/
00426 #if NeedFunctionPrototypes
00427 static void insert_child(Widget  child)
00428 #else
00429 static void insert_child(child)Widget  child;
00430 #endif
00431 { Widget self = XtParent(child); {
00432     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.initializing)
00433        xfwfBoardClassRec.composite_class.insert_child(child);
00434     else {
00435        char s[500];
00436        (void)sprintf(s, "Cannot add children to a scrollbar (\"%s\"->\"%s\")",
00437                     XtName(child), XtName(self));
00438        XtWarning(s);
00439     }
00440 }
00441 }
00442 /*ARGSUSED*/
00443 #if NeedFunctionPrototypes
00444 static Boolean  set_values(Widget  old,Widget  request,Widget self,ArgList  args,Cardinal * num_args)
00445 #else
00446 static Boolean  set_values(old,request,self,args,num_args)Widget  old;Widget  request;Widget self;ArgList  args;Cardinal * num_args;
00447 #endif
00448 {
00449     if (((XfwfScrollbarWidget)old)->xfwfScrollbar.vertical != ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) {
00450        XtWarning("Cannot change the \"vertical\" resource of a scrollbar\n");
00451        ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical = ((XfwfScrollbarWidget)old)->xfwfScrollbar.vertical;
00452     }
00453     if (((XfwfScrollbarWidget)old)->xfwfScrollbar.scrollbarForeground != ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground) {
00454        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNthumbColor, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, NULL);
00455        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNforeground, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, NULL);
00456        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNforeground, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, NULL);
00457     }
00458     if (((XfwfScrollbarWidget)old)->xfwfScrollbar.shadow != ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow) {
00459        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNthumbFrameWidth, ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow, NULL);
00460        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNarrowShadow, ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow, NULL);
00461        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNarrowShadow, ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow, NULL);
00462     }
00463     if (((XfwfScrollbarWidget)old)->xfwfScrollbar.minsize != ((XfwfScrollbarWidget)self)->xfwfScrollbar.minsize) {
00464        XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNminsize, ((XfwfScrollbarWidget)self)->xfwfScrollbar.minsize, NULL);
00465     }
00466     if (((XfwfScrollbarWidget)old)->xfwfScrollbar.drawgrayScrollbar != ((XfwfScrollbarWidget)self)->xfwfScrollbar.drawgrayScrollbar) {
00467       XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNdrawgrayArrow, ((XfwfScrollbarWidget)self)->xfwfScrollbar.drawgrayScrollbar, NULL);
00468       XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNdrawgrayArrow, ((XfwfScrollbarWidget)self)->xfwfScrollbar.drawgrayScrollbar, NULL);
00469     }
00470     return False;
00471 }
00472 /*ARGSUSED*/
00473 #if NeedFunctionPrototypes
00474 static void scroll_response(Widget  wdg,XtPointer  client_data,XtPointer  call_data)
00475 #else
00476 static void scroll_response(wdg,client_data,call_data)Widget  wdg;XtPointer  client_data;XtPointer  call_data;
00477 #endif
00478 {
00479     Widget self = (Widget) client_data;
00480 
00481     ((XfwfScrollbarWidget)self)->xfwfScrollbar.slider_scroll(wdg, ((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, call_data);
00482 }
00483 /*ARGSUSED*/
00484 #if NeedFunctionPrototypes
00485 void XfwfSetScrollbar(Widget self,double  pos,double  size)
00486 #else
00487 void XfwfSetScrollbar(self,pos,size)Widget self;double  pos;double  size;
00488 #endif
00489 {
00490     if (! XtIsSubclass(self, xfwfScrollbarWidgetClass))
00491        XtError("XfwfSetScrollbar called with incorrect widget type");
00492     if (pos < 0.0 || pos > 1.0 || size < 0.0 || size > 1.0)
00493        XtError("XfwfSetScrollbar called with incorrect arguments");
00494     if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) {
00495        XfwfResizeThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, 1.0, size);
00496        XfwfMoveThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, 0.0, pos);
00497     } else {
00498        XfwfResizeThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, size, 1.0);
00499        XfwfMoveThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, pos, 0.0);
00500     }
00501 }
00502 /*ARGSUSED*/
00503 #if NeedFunctionPrototypes
00504 void XfwfGetScrollbar(Widget self,double * hpos,double * vpos)
00505 #else
00506 void XfwfGetScrollbar(self,hpos,vpos)Widget self;double * hpos;double * vpos;
00507 #endif
00508 {
00509     XfwfScrollInfo info;
00510 
00511     XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info);
00512     if (hpos) *hpos = info.hpos;
00513     if (vpos) *vpos = info.vpos;
00514 }