Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
xwSlider2.c File Reference
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include "xwGray.h"
#include <stdio.h>
#include <./xwSlider2P.h>

Go to the source code of this file.

Defines

#define range(x)   (0.0 <=(x )&&(x )<=1.0 )

Functions

static void start ()
static void finish ()
static void drag ()
static void _resolve_inheritance ()
static void compute_thumb ()
static void compute_inside ()
static void _expose ()
static void initialize ()
static void destroy ()
static void move_thumb ()
static void compute_info ()
static Boolean set_values ()
static void scroll_response ()
static void create_gc ()
static void create_thumbgc ()
static void create_fggc ()
static void create_thumblightgc ()
static void create_thumbdarkgc ()
static void create_gc (Widget self)
static void create_thumbgc (Widget self)
static void create_fggc (Widget self)
static void create_thumblightgc (Widget self)
static void create_thumbdarkgc (Widget self)
static void start (Widget self, XEvent *event, String *params, Cardinal *num_params)
static void finish (Widget self, XEvent *event, String *params, Cardinal *num_params)
static void drag (Widget self, XEvent *event, String *params, Cardinal *num_params)
static void _resolve_inheritance (WidgetClass class)
static void compute_thumb (Widget self, Position *x, Position *y, Dimension *width, Dimension *height)
static void compute_inside (Widget self, Position *x, Position *y, int *w, int *h)
static void _expose (Widget self, XEvent *event, Region region)
static void initialize (Widget request, Widget self, ArgList args, Cardinal *num_args)
static void destroy (Widget self)
static void move_thumb (Widget self, int oldx, int oldy, int wd, int ht, int newx, int newy)
static void compute_info (Widget self, Position *x, Position *y, Dimension *w, Dimension *h, float *thumb_x, float *thumb_y, float *thumb_wd, float *thumb_ht)
static Boolean set_values (Widget old, Widget request, Widget self, ArgList args, Cardinal *num_args)
static void scroll_response (Widget wdg, XtPointer client_data, XtPointer call_data)
void XfwfGetThumb (Widget self, XfwfScrollInfo *info)
void XfwfMoveThumb (Widget self, double x, double y)
void XfwfResizeThumb (Widget self, double wd, double ht)

Variables

static XtActionsRec actionsList []
static char defaultTranslations []
static XtResource resources []
XfwfSlider2ClassRec xfwfSlider2ClassRec
WidgetClass xfwfSlider2WidgetClass = (WidgetClass) &xfwfSlider2ClassRec

Define Documentation

#define range (   x)    (0.0 <=(x )&&(x )<=1.0 )

Definition at line 651 of file xwSlider2.c.


Function Documentation

static void _expose ( ) [static]
static void _expose ( Widget  self,
XEvent *  event,
Region  region 
) [static]

Definition at line 499 of file xwSlider2.c.

{
    Position x, y;
    Dimension wd, ht, d;

    if (! XtIsRealized(self)) return;
    if (region != NULL) {
       XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfFrame.fggc, region);
       XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc, region);
       XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc, region);
       XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc, region);
    }
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &x, &y, &wd, &ht);
    d = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth;
    if ((wd > 2 * d) && (ht > 2 * d)) {
      XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc, x + d, y + d, wd - 2 * d, ht - 2 * d);
      XfwfDrawFrame(self, x, y, wd, ht, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameType, d,
                   ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc, NULL);
    }
    if (region != NULL) {
       XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfFrame.fggc, None);
       XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc, None);
       XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc, None);
       XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc, None);
    }
    xfwfLabelClassRec.xfwfCommon_class._expose(self, event, region);
}

Here is the call graph for this function:

static void _resolve_inheritance ( ) [static]
static void _resolve_inheritance ( WidgetClass  class) [static]

Definition at line 436 of file xwSlider2.c.

{
  XfwfSlider2WidgetClass c = (XfwfSlider2WidgetClass) class;
  XfwfSlider2WidgetClass super;
  static CompositeClassExtensionRec extension_rec = {
    NULL, NULLQUARK, XtCompositeExtensionVersion,
    sizeof(CompositeClassExtensionRec), True};
  CompositeClassExtensionRec *ext;
  ext = (XtPointer)XtMalloc(sizeof(*ext));
  *ext = extension_rec;
  ext->next_extension = c->composite_class.extension;
  c->composite_class.extension = ext;
  if (class == xfwfSlider2WidgetClass) return;
  super = (XfwfSlider2WidgetClass)class->core_class.superclass;
  if (c->xfwfSlider2_class.compute_thumb == XtInherit_compute_thumb)
    c->xfwfSlider2_class.compute_thumb = super->xfwfSlider2_class.compute_thumb;
  if (c->xfwfSlider2_class.move_thumb == XtInherit_move_thumb)
    c->xfwfSlider2_class.move_thumb = super->xfwfSlider2_class.move_thumb;
  if (c->xfwfSlider2_class.compute_info == XtInherit_compute_info)
    c->xfwfSlider2_class.compute_info = super->xfwfSlider2_class.compute_info;
  if (c->xfwfSlider2_class.scroll_response == XtInherit_scroll_response)
    c->xfwfSlider2_class.scroll_response = super->xfwfSlider2_class.scroll_response;
}

Here is the call graph for this function:

static void compute_info ( ) [static]
static void compute_info ( Widget  self,
Position *  x,
Position *  y,
Dimension *  w,
Dimension *  h,
float *  thumb_x,
float *  thumb_y,
float *  thumb_wd,
float *  thumb_ht 
) [static]

Definition at line 593 of file xwSlider2.c.

{
    int fw, fh;
    Position fx, fy;

    xfwfLabelClassRec.xfwfCommon_class.compute_inside(self, &fx, &fy, &fw, &fh);
    fw = max(0, fw);
    fh = max(0, fh);
    *w = min(fw, max(((XfwfSlider2Widget)self)->xfwfSlider2.minsize, *w));
    *h = min(fh, max(((XfwfSlider2Widget)self)->xfwfSlider2.minsize, *h));
    *x = min(fx + fw - *w, max(fx, *x));
    *y = min(fy + fh - *h, max(fy, *y));
    *thumb_wd = ((float) *w)/fw;
    *thumb_ht = ((float) *h)/fh;
    *thumb_x = (*w == fw) ? 0.0 : ((float) (*x - fx))/(fw - *w);
    *thumb_y = (*h == fh) ? 0.0 : ((float) (*y - fy))/(fh - *h);
}
static void compute_inside ( ) [static]
static void compute_inside ( Widget  self,
Position *  x,
Position *  y,
int w,
int h 
) [static]

Definition at line 484 of file xwSlider2.c.

{
    Dimension ww, hh;

    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, x, y, &ww, &hh);
    *x += ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth;
    *y += ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth;
    *w = (int)ww - 2 * ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth;
    *h = (int)hh - 2 * ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth;
}
static void compute_thumb ( ) [static]

Here is the caller graph for this function:

static void compute_thumb ( Widget  self,
Position *  x,
Position *  y,
Dimension *  width,
Dimension *  height 
) [static]

Definition at line 464 of file xwSlider2.c.

{
    Position fx, fy;
    int fw, fh;

    xfwfLabelClassRec.xfwfCommon_class.compute_inside(self, &fx, &fy, &fw, &fh);
    fw = max(0, fw);
    fh = max(0, fh);
    *width = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd * fw + 0.5;
    *height = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht * fh + 0.5;
    if (*width < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize) *width = min(fw, ((XfwfSlider2Widget)self)->xfwfSlider2.minsize);
    if (*height < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize) *height = min(fh, ((XfwfSlider2Widget)self)->xfwfSlider2.minsize);
    *x = fx + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x * (fw - *width) + 0.5;
    *y = fy + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y * (fh - *height) + 0.5;
}
static void create_fggc ( ) [static]
static void create_fggc ( Widget  self) [static]

Definition at line 155 of file xwSlider2.c.

{
    XtGCMask mask;
    XGCValues values;

    if (((XfwfSlider2Widget)self)->xfwfFrame.fggc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfFrame.fggc);
    mask = GCForeground;
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfCommon_class.set_color(self, ((XfwfSlider2Widget)self)->core.background_pixel, &values.foreground);
    ((XfwfSlider2Widget)self)->xfwfFrame.fggc = XtGetGC(self, mask, &values);
}
static void create_gc ( ) [static]

Here is the caller graph for this function:

static void create_gc ( Widget  self) [static]

Definition at line 118 of file xwSlider2.c.

{
    XtGCMask mask;
    XGCValues values;

    if (((XfwfSlider2Widget)self)->xfwfLabel.gc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfLabel.gc);
    values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor;
    values.foreground = ((XfwfSlider2Widget)self)->xfwfLabel.foreground;
    mask = GCBackground | GCForeground;
    ((XfwfSlider2Widget)self)->xfwfLabel.gc = XtGetGC(self, mask, &values);
}
static void create_thumbdarkgc ( ) [static]

Here is the caller graph for this function:

static void create_thumbdarkgc ( Widget  self) [static]

Definition at line 213 of file xwSlider2.c.

{
    XtGCMask mask=0;
    XGCValues values;

    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc);
    switch (((XfwfSlider2Widget)self)->xfwfFrame.shadowScheme) {
    case XfwfColor:
       mask = GCForeground;
       values.foreground = ((XfwfSlider2Widget)self)->xfwfFrame.bottomShadowColor;
       break;
    case XfwfStipple:
       mask = GCFillStyle | GCStipple | GCForeground | GCBackground;
       values.fill_style = FillOpaqueStippled;
       values.stipple = ((XfwfSlider2Widget)self)->xfwfFrame.bottomShadowStipple;
       values.foreground = BlackPixelOfScreen(XtScreen(self));
       values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor;
       break;
    case XfwfBlack:
    case XfwfAuto:
       if (DefaultDepthOfScreen(XtScreen(self)) > 4
           && ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor, &values.foreground)) {
           mask = GCForeground;
       } else {
           mask = GCFillStyle | GCBackground | GCForeground | GCStipple;
           values.fill_style = FillOpaqueStippled;
           /* values.background = $thumbColor; */
           values.background = BlackPixelOfScreen(XtScreen(self));
           values.foreground = WhitePixelOfScreen(XtScreen(self));
           values.stipple =
              XCreateBitmapFromData(XtDisplay(self),
                                  RootWindowOfScreen(XtScreen(self)),
                                  wx_gray_bits, wx_gray_width, wx_gray_height);
       }
       break;
    }
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc = XtGetGC(self, mask, &values);
}
static void create_thumbgc ( ) [static]

Here is the caller graph for this function:

static void create_thumbgc ( Widget  self) [static]

Definition at line 134 of file xwSlider2.c.

{
    XtGCMask mask;
    XGCValues values;

    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc);
    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap != 0) {
       mask = GCTile | GCFillStyle;
       values.tile = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap;
       values.fill_style = FillTiled;
    } else {
       mask = GCForeground;
       values.foreground = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor;
    }
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc = XtGetGC(self, mask, &values);
}
static void create_thumblightgc ( ) [static]

Here is the caller graph for this function:

static void create_thumblightgc ( Widget  self) [static]

Definition at line 170 of file xwSlider2.c.

{
    XtGCMask mask=0;
    XGCValues values;

    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc);
    switch (((XfwfSlider2Widget)self)->xfwfFrame.shadowScheme) {
    case XfwfColor:
       mask = GCForeground;
       values.foreground = ((XfwfSlider2Widget)self)->xfwfFrame.topShadowColor;
       break;
    case XfwfStipple:
       mask = GCFillStyle | GCStipple | GCForeground | GCBackground;
       values.fill_style = FillOpaqueStippled;
       values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor;
       values.stipple = ((XfwfSlider2Widget)self)->xfwfFrame.topShadowStipple;
       values.foreground = WhitePixelOfScreen(XtScreen(self));
       break;
    case XfwfBlack:
    case XfwfAuto:
       if (DefaultDepthOfScreen(XtScreen(self)) > 4
           && ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor, &values.foreground)) {
           mask = GCForeground;
       } else {
           mask = GCFillStyle | GCBackground | GCForeground | GCStipple;
           values.fill_style = FillOpaqueStippled;
           /* values.background = $thumbColor; */
           values.background = BlackPixelOfScreen(XtScreen(self));
           values.foreground = WhitePixelOfScreen(XtScreen(self));
           values.stipple =
              XCreateBitmapFromData(XtDisplay(self),
                                  RootWindowOfScreen(XtScreen(self)),
                                  wx_gray_bits, wx_gray_width, wx_gray_height);
       }
       break;
    }
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc = XtGetGC(self, mask, &values);
}
static void destroy ( ) [static]
static void destroy ( Widget  self) [static]

Definition at line 548 of file xwSlider2.c.

{
  if (((XfwfSlider2Widget)self)->xfwfLabel.gc) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfLabel.gc); ((XfwfSlider2Widget)self)->xfwfLabel.gc = NULL;
  if (((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc); ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc = NULL;
  if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc); ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc = NULL;
  if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc); ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc = NULL;
  if (((XfwfSlider2Widget)self)->xfwfFrame.fggc) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfFrame.fggc); ((XfwfSlider2Widget)self)->xfwfFrame.fggc = NULL;
}
static void drag ( ) [static]

Here is the caller graph for this function:

static void drag ( Widget  self,
XEvent*  event,
String*  params,
Cardinal*  num_params 
) [static]

Definition at line 413 of file xwSlider2.c.

{
    XfwfScrollInfo info;
    Dimension wd, ht;
    Position oldx, oldy, newx, newy;
    float dum1, dum2;

    if (! ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress) return;
    if (event->type != ButtonPress && event->type != ButtonRelease
       && event->type != MotionNotify)
       XtError("The drag action must be bound to a mouse event");
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &oldx, &oldy, &wd, &ht);
    newx = event->xbutton.x + ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_x;
    newy = event->xbutton.y + ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_y;
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_info(self, &newx, &newy, &wd, &ht, &((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x, &((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y,&dum1,&dum2);
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.move_thumb(self, oldx, oldy, wd, ht, newx, newy);
    info.reason = XfwfSDrag;
    info.flags = XFWF_VPOS | XFWF_HPOS;
    info.hpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x;
    info.vpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y;
    XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info);
}
static void finish ( ) [static]

Here is the caller graph for this function:

static void finish ( Widget  self,
XEvent*  event,
String*  params,
Cardinal*  num_params 
) [static]

Definition at line 398 of file xwSlider2.c.

{
    XfwfScrollInfo info;

    if (((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress) {
       ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = False;
       info.reason = XfwfSMove;
       info.flags = XFWF_VPOS | XFWF_HPOS;
       info.hpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x;
       info.vpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y;
       XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info);
    }
}
static void initialize ( ) [static]
static void initialize ( Widget  request,
Widget  self,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 531 of file xwSlider2.c.

{
    ((XfwfSlider2Widget)self)->xfwfLabel.text_bg = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor;
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y = 0.0;
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht = 1.0;
    ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = False;
    create_fggc(self);
    create_thumbgc(self);
    create_gc(self);
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc = NULL; create_thumblightgc(self);
    ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc = NULL; create_thumbdarkgc(self);
}

Here is the call graph for this function:

static void move_thumb ( ) [static]
static void move_thumb ( Widget  self,
int  oldx,
int  oldy,
int  wd,
int  ht,
int  newx,
int  newy 
) [static]

Definition at line 561 of file xwSlider2.c.

{
    int h, ah;

    XCopyArea(XtDisplay(self), XtWindow(self), XtWindow(self),
             ((XfwfSlider2Widget)self)->xfwfLabel.gc,
             oldx, oldy, wd, ht, newx, newy);
    /* First check if the old and new areas do not overlap */
    if (newx + wd <= oldx || oldx + wd <= newx
       || newy + ht <= oldy || oldy + ht <= newy) {
       XClearArea(XtDisplay(self), XtWindow(self), oldx, oldy, wd, ht, False);
       return;
    } else {                              /* They do overlap */
       h = oldy - newy;
       if (h > 0)
           XClearArea(XtDisplay(self), XtWindow(self), oldx, newy + ht, wd,h,False);
       else if (h < 0)
           XClearArea(XtDisplay(self), XtWindow(self), oldx, oldy, wd, -h, False);
       ah = (h < 0) ? -h : h;
       if (newx < oldx)
           XClearArea(XtDisplay(self), XtWindow(self), newx + wd,
                     max(oldy, newy), oldx - newx, ht - ah, False);
       else if (oldx < newx)
           XClearArea(XtDisplay(self), XtWindow(self), oldx, max(oldy, newy),
                     newx - oldx, ht - ah, False);
    }
}
static void scroll_response ( ) [static]
static void scroll_response ( Widget  wdg,
XtPointer  client_data,
XtPointer  call_data 
) [static]

Definition at line 658 of file xwSlider2.c.

{
    Widget self = (Widget) client_data;
    XfwfScrollInfo *inf = (XfwfScrollInfo *)call_data;
    XfwfScrollInfo new_info;
    float x, y, w, h;
    Position newx, newy, oldx, oldy;
    Dimension newwd, newht, oldwd, oldht, wd, ht;
    XEvent event;
    XRectangle rect;
    Region clip;
    Display *dpy = XtDisplay(self);

    x = (inf->flags&XFWF_HPOS) && range(inf->hpos) ? inf->hpos : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x;
    y = (inf->flags&XFWF_VPOS) && range(inf->vpos) ? inf->vpos : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y;
    w = (inf->flags&XFWF_HSIZE) && range(inf->hsize) ? inf->hsize : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd;
    h = (inf->flags&XFWF_VSIZE) && range(inf->vsize) ? inf->vsize : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht;

    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd != w || ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht != h) {       /* Size changed */
       if (XtIsRealized(self))
           ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &oldx, &oldy, &oldwd, &oldht);
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd = w;
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht = h;
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x = x;
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y = y;
       if (XtIsRealized(self)) {
           ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &newx, &newy, &newwd, &newht);
           if ((oldwd > newwd) || (oldht > newht))
             XClearArea(dpy, XtWindow(self), oldx, oldy, oldwd, oldht, False);
           event.xexpose.x = rect.x = newx;
           event.xexpose.y = rect.y = newy;
           event.xexpose.width = rect.width = newwd;
           event.xexpose.height = rect.height = newht;
           clip = XCreateRegion();
           XUnionRectWithRegion(&rect, clip, clip);
           ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfCommon_class._expose(self, &event, clip);
           XDestroyRegion(clip);
       }
    } else if (((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x != x || ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y != y) { /* Only position changed */
       if (XtIsRealized(self))
           ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &oldx, &oldy, &wd, &ht);
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x = x;
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y = y;
       if (XtIsRealized(self)) {
           ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &newx, &newy, &wd, &ht);
           ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.move_thumb(self, oldx, oldy, wd, ht, newx, newy);
       }
    }

    if (inf->reason != XfwfSNotify) {
       new_info = *inf;
       new_info.reason = XfwfSNotify;
       XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &new_info);
    }
}
static Boolean set_values ( ) [static]
static Boolean set_values ( Widget  old,
Widget  request,
Widget  self,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 615 of file xwSlider2.c.

{
    Boolean need_redisplay = False;
    Position x, y;
    Dimension w, h;

    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbPixmap) {
       create_fggc(self);
       create_thumbgc(self);
       create_thumblightgc(self);
       create_thumbdarkgc(self);
       need_redisplay = True;
    } else if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbColor) {
       ((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap = 0;
       create_fggc(self);
       create_thumbgc(self);
       create_thumblightgc(self);
       create_thumbdarkgc(self);
       need_redisplay = True;
    }
    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbFrameWidth)
       need_redisplay = True;
    if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameType != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbFrameType)
       need_redisplay = True;
    if (((XfwfSlider2Widget)self)->xfwfSlider2.minsize != ((XfwfSlider2Widget)old)->xfwfSlider2.minsize) {
       compute_thumb(old, &x, &y, &w, &h);
       if (w < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize || h < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize) need_redisplay = True;
    }
    if (((XfwfSlider2Widget)self)->xfwfSlider2.scrollResponse != ((XfwfSlider2Widget)old)->xfwfSlider2.scrollResponse) {
       ((XfwfSlider2Widget)self)->xfwfSlider2.scrollResponse = ((XfwfSlider2Widget)old)->xfwfSlider2.scrollResponse;
       XtWarning("scrollResponse resource may only be queried, not set");
    }

    return need_redisplay;
}

Here is the call graph for this function:

static void start ( ) [static]
static void start ( Widget  self,
XEvent*  event,
String*  params,
Cardinal*  num_params 
) [static]

Definition at line 341 of file xwSlider2.c.

{
    Dimension w, h;
    Position x, y;
    XfwfScrollInfo info;
    Boolean outside = False;

    if (event->type != ButtonPress && event->type != ButtonRelease
       && event->type != MotionNotify)
       XtError("The start action must be bound to a mouse event");
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &x, &y, &w, &h);
    if (event->xbutton.button == Button2) {
      /* Pretend mouse was clicked on the middle of the thumb... */
      ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = True;
      ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_x = - (w / 2);
      ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_y = - (h / 2);
      /* and dragged to here: */
      drag(self,event,params,num_params);
    } else {
      if (event->xbutton.x < x) {                /* Left of thumb */
       info.reason = XfwfSPageLeft;
       info.flags = XFWF_HPOS;                   /* Suggest a value: */
       info.hpos = max(0.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x - ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd);
       outside = True;
       XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info);
      }
      if (event->xbutton.x >= x + w) {           /* Right of thumb */
       info.reason = XfwfSPageRight;
       info.flags = XFWF_HPOS;                   /* Suggest a value: */
       info.hpos = min(1.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd);
       outside = True;
       XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info);
      }
      if (event->xbutton.y < y) {                /* Above thumb */
       info.reason = XfwfSPageUp;
       info.flags = XFWF_VPOS;                   /* Suggest a value: */
       info.vpos = max(0.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y - ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht);
       outside = True;
       XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info);
      }
      if (event->xbutton.y >= y + h) {           /* Below thumb */
       info.reason = XfwfSPageDown;
       info.flags = XFWF_VPOS;                   /* Suggest a value: */
       info.vpos = min(1.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht);
       outside = True;
       XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info);
      }

      if (! outside) {                           /* Inside the thumb */
       ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = True;
       ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_x = x - event->xbutton.x;
       ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_y = y - event->xbutton.y;
      }
    }
}

Here is the call graph for this function:

void XfwfGetThumb ( Widget  self,
XfwfScrollInfo info 
)

Definition at line 718 of file xwSlider2.c.

{
    if (! XtIsSubclass(self, xfwfSlider2WidgetClass))
       XtError("XfwfGetThumb called with incorrect widget type");
    info->reason = XfwfSNotify;
    info->flags = XFWF_VPOS | XFWF_VSIZE | XFWF_HPOS | XFWF_HSIZE;
    info->vpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y;
    info->vsize = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht;
    info->hpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x;
    info->hsize = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd;
}

Here is the caller graph for this function:

void XfwfMoveThumb ( Widget  self,
double  x,
double  y 
)

Definition at line 734 of file xwSlider2.c.

{
    XfwfScrollInfo info;

    if (! XtIsSubclass(self, xfwfSlider2WidgetClass))
       XtError("XfwfMoveThumb called with incorrect widget type");
    if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0)
       XtError("XfwfMoveThumb called with incorrect arguments");
    info.flags = XFWF_VPOS | XFWF_HPOS;
    info.reason = XfwfSNotify;
    info.vpos = y;
    info.hpos = x;
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.scroll_response(NULL, self, &info);
}

Here is the caller graph for this function:

void XfwfResizeThumb ( Widget  self,
double  wd,
double  ht 
)

Definition at line 753 of file xwSlider2.c.

{
    XfwfScrollInfo info;

    if (! XtIsSubclass(self, xfwfSlider2WidgetClass))
       XtError("XfwfResizeThumb called with incorrect widget type");
    if (wd < 0.0 || wd > 1.0 || ht < 0.0 || ht > 1.0)
       XtError("XfwfResizeThumb called with incorrect arguments");

    info.reason = XfwfSNotify;
    info.flags = XFWF_VSIZE | XFWF_HSIZE;
    info.vsize = ht;
    info.hsize = wd;
    ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.scroll_response(NULL, self, &info);
}

Here is the caller graph for this function:


Variable Documentation

XtActionsRec actionsList[] [static]
Initial value:
 {
{"start", start},
{"finish", finish},
{"drag", drag},
}

Definition at line 25 of file xwSlider2.c.

char defaultTranslations[] [static]
Initial value:
"\
<Btn1Down>: start() \n\
<Btn1Motion>: drag() \n\
<Btn1Up>: finish() \n\
<Btn2Down>: start() \n\
<Btn2Motion>: drag() \n\
<Btn2Up>: finish() \n\
"

Definition at line 31 of file xwSlider2.c.

XtResource resources[] [static]
Initial value:
 {
{XtNthumbColor,XtCThumbColor,XtRPixel,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbColor),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbColor),XtRString,(XtPointer)XtDefaultBackground },
{XtNthumbPixmap,XtCThumbPixmap,XtRPixmap,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbPixmap),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbPixmap),XtRImmediate,(XtPointer)NULL },
{XtNminsize,XtCMinsize,XtRDimension,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.minsize),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.minsize),XtRImmediate,(XtPointer)20 },
{XtNthumbFrameWidth,XtCThumbFrameWidth,XtRDimension,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbFrameWidth),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbFrameWidth),XtRImmediate,(XtPointer)2 },
{XtNthumbFrameType,XtCThumbFrameType,XtRFrameType,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbFrameType),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbFrameType),XtRImmediate,(XtPointer)XfwfRaised },
{XtNscrollCallback,XtCScrollCallback,XtRCallback,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.scrollCallback),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.scrollCallback),XtRImmediate,(XtPointer)NULL },
{XtNscrollResponse,XtCScrollResponse,XtRXTCallbackProc,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.scrollResponse),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.scrollResponse),XtRImmediate,(XtPointer)scroll_response },
{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfSlider2Rec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfSlider2Rec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 },
{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfSlider2Rec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfSlider2Rec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfSunken },
}

Definition at line 253 of file xwSlider2.c.

Definition at line 265 of file xwSlider2.c.

WidgetClass xfwfSlider2WidgetClass = (WidgetClass) &xfwfSlider2ClassRec

Definition at line 339 of file xwSlider2.c.