25#include <X11/Intrinsic.h>
28#include <Xm/ScrollBar.h>
30#if defined(__cplusplus) || defined(c_plusplus)
57static void mouseScroll(Widget, XtPointer client_data, XEvent* event, Boolean*)
60 Widget sb = (Widget)client_data;
62 int slider_size_return = 0;
63 int increment_return = 0;
64 int page_increment_return = 0;
69 XmScrollBarGetValues (sb, &value_return, &slider_size_return,
70 &increment_return, &page_increment_return);
73 if ( event->xbutton.state & ShiftMask )
77 else if ( event->xbutton.state & ControlMask )
79 step = page_increment_return;
83 step = page_increment_return >> 1;
86 if ( event->xbutton.button == Button4 )
89 if ( value_return < 0 )
92 else if ( event->xbutton.button == Button5 )
95 XtVaGetValues(sb, XmNmaximum, &count, NULL);
97 if ( value_return > count - slider_size_return )
98 value_return = count - slider_size_return;
102 if ( event->xbutton.button == Button4 ||
103 event->xbutton.button == Button5 )
105 XmScrollBarSetValues (sb, value_return, slider_size_return,
106 increment_return, page_increment_return, True);
131 XtVaGetValues(XtParent(w),XmNverticalScrollBar, &wid, NULL);
134 XtAddEventHandler(w, ButtonReleaseMask, False,
135 (XtEventHandler) mouseScroll, wid);
137 XtAddEventHandler(wid, ButtonReleaseMask, False,
138 (XtEventHandler) mouseScroll, wid);
141#if defined(__cplusplus) || defined(c_plusplus)
void xmAddMouseEventHandler(Widget w)