25 #include <X11/Intrinsic.h>
28 #include <Xm/ScrollBar.h>
30 #if defined(__cplusplus) || defined(c_plusplus)
57 static void mouseScroll(Widget, XtPointer client_data, XEvent *event)
59 Widget sb = (Widget)client_data;
61 int slider_size_return = 0;
62 int increment_return = 0;
63 int page_increment_return = 0;
68 XmScrollBarGetValues (sb, &value_return, &slider_size_return,
69 &increment_return, &page_increment_return);
72 if ( event->xbutton.state & ShiftMask )
76 else if ( event->xbutton.state & ControlMask )
78 step = page_increment_return;
82 step = page_increment_return >> 1;
85 if ( event->xbutton.button == Button4 )
88 if ( value_return < 0 )
91 else if ( event->xbutton.button == Button5 )
94 XtVaGetValues(sb, XmNmaximum, &count, NULL);
96 if ( value_return > count - slider_size_return )
97 value_return = count - slider_size_return;
101 if ( event->xbutton.button == Button4 ||
102 event->xbutton.button == Button5 )
104 XmScrollBarSetValues (sb, value_return, slider_size_return,
105 increment_return, page_increment_return, True);
130 XtVaGetValues(XtParent(w),XmNverticalScrollBar, &wid, NULL);
133 XtAddEventHandler(w, ButtonReleaseMask, False,
136 XtAddEventHandler(wid, ButtonReleaseMask, False,
137 (XtEventHandler) mouseScroll, wid);
140 #if defined(__cplusplus) || defined(c_plusplus)
const G4double w[NPOINTSGL]
static void mouseScroll(Widget, XtPointer client_data, XEvent *event)
void xmAddMouseEventHandler(Widget w)