#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "scroll.h"

void XfwfConnectScrollingWidgets(w1, w2)
    Widget w1, w2;
{
    XtCallbackProc response_cb_1 = NULL, response_cb_2 = NULL;

    /* Error checking omitted */
    XtVaGetValues(w1, "scrollResponse", &response_cb_1, NULL);
    XtVaGetValues(w2, "scrollResponse", &response_cb_2, NULL);

    XtAddCallback(w1, "scrollCallback", response_cb_2, (XtPointer)w2);

    XtAddCallback(w2, "scrollCallback", response_cb_1, (XtPointer)w1);
}

XfwfSReason XfwfCvtStringToScrollReason(s)
    String s;
{
    if (strcasecmp(s, "Notify") == 0) return XfwfSNotify;
    if (strcasecmp(s, "Move") == 0) return XfwfSMove;
    if (strcasecmp(s, "Drag") == 0) return XfwfSDrag;
    if (strcasecmp(s, "Zoom") == 0) return XfwfSZoom;
    if (strcasecmp(s, "Stretch") == 0) return XfwfSStretch;
    if (strcasecmp(s, "Up") == 0) return XfwfSUp;
    if (strcasecmp(s, "Down") == 0) return XfwfSDown;
    if (strcasecmp(s, "Left") == 0) return XfwfSLeft;
    if (strcasecmp(s, "Right") == 0) return XfwfSRight;
    if (strcasecmp(s, "PageUp") == 0) return XfwfSPageUp;
    if (strcasecmp(s, "PageDown") == 0) return XfwfSPageDown;
    if (strcasecmp(s, "PageLeft") == 0) return XfwfSPageLeft;
    if (strcasecmp(s, "PageRight") == 0) return XfwfSPageRight;
    if (strcasecmp(s, "ZoomIn") == 0) return XfwfSZoomIn;
    if (strcasecmp(s, "ZoomOut") == 0) return XfwfSZoomOut;
    if (strcasecmp(s, "Top") == 0) return XfwfSTop;
    if (strcasecmp(s, "Bottom") == 0) return XfwfSBottom;
    if (strcasecmp(s, "LeftSide") == 0) return XfwfSLeftSide;
    if (strcasecmp(s, "RightSide") == 0) return XfwfSRightSide;
    if (strcasecmp(s, "ZoomInFull") == 0) return XfwfSZoomInFull;
    if (strcasecmp(s, "ZoomOutFull") == 0) return XfwfSZoomOutFull;
    return XfwfSNotify;				/* Should be: error */
}

