get_scroll_direction


Description:

[ Version ( since = "3.2" ) ]
public bool get_scroll_direction (out ScrollDirection direction)

Extracts the scroll direction from an event.

If this is not of type gdk_scroll, the contents of direction are undefined.

If you wish to handle both discrete and smooth scrolling, you should check the return value of this function, or of get_scroll_deltas; for instance:

	GdkScrollDirection direction;
double vscroll_factor = 0.0;
double x_scroll, y_scroll;

if (gdk_event_get_scroll_direction (event, &direction))
{
// Handle discrete scrolling with a known constant delta;
const double delta = 12.0;

switch (direction)
{
case GDK_SCROLL_UP:
vscroll_factor = -delta;
break;
case GDK_SCROLL_DOWN:
vscroll_factor = delta;
break;
default:
// no scrolling
break;
}
}
else if (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
{
// Handle smooth scrolling directly
vscroll_factor = y_scroll;
}

Parameters:

this

a Event

direction

location to store the scroll direction

Returns:

true if the event delivered a scroll direction and false otherwise




2022 vala-language.org