Commit ad44fde4 authored by Claes Sjofors's avatar Claes Sjofors

Ge, mouse scrolling added to tables, tabbed windows and windows with vertical scrollbar

parent af0416b9
...@@ -1144,9 +1144,9 @@ int GlowDrawGtk::event_handler( GdkEvent event) ...@@ -1144,9 +1144,9 @@ int GlowDrawGtk::event_handler( GdkEvent event)
break; break;
case GDK_SCROLL: case GDK_SCROLL:
if ( event.scroll.direction == GDK_SCROLL_UP) if ( event.scroll.direction == GDK_SCROLL_UP)
sts = ctx->event_handler( glow_eEvent_ScrollUp, 0, 0, 0, 0); sts = ctx->event_handler( glow_eEvent_ScrollUp, (int)event.scroll.x, (int)event.scroll.y, 0, 0);
else if ( event.scroll.direction == GDK_SCROLL_DOWN) else if ( event.scroll.direction == GDK_SCROLL_DOWN)
sts = ctx->event_handler( glow_eEvent_ScrollDown, 0, 0, 0, 0); sts = ctx->event_handler( glow_eEvent_ScrollDown, (int)event.scroll.x, (int)event.scroll.y, 0, 0);
break; break;
default: default:
break; break;
......
...@@ -665,6 +665,8 @@ int GrowCtx::event_handler( glow_eEvent event, int x, int y, int w, int h) ...@@ -665,6 +665,8 @@ int GrowCtx::event_handler( glow_eEvent event, int x, int y, int w, int h)
case glow_eEvent_MB3Press: case glow_eEvent_MB3Press:
case glow_eEvent_MB1Down: case glow_eEvent_MB1Down:
case glow_eEvent_MB1Up: case glow_eEvent_MB1Up:
case glow_eEvent_ScrollUp:
case glow_eEvent_ScrollDown:
tiptext->remove(); tiptext->remove();
sts = 0; sts = 0;
for ( i = 0; i < a.a_size; i++) for ( i = 0; i < a.a_size; i++)
......
...@@ -967,6 +967,46 @@ int GrowTable::event_handler( GlowWind *w, glow_eEvent event, int x, int y, doub ...@@ -967,6 +967,46 @@ int GrowTable::event_handler( GlowWind *w, glow_eEvent event, int x, int y, doub
((GrowCtx *)ctx)->send_table_callback( this, event, fx, fy, column, row); ((GrowCtx *)ctx)->send_table_callback( this, event, fx, fy, column, row);
break; break;
} }
case glow_eEvent_ScrollUp:
if ( !ctx->trace_started)
return 0;
if ( v_scrollbar) {
double rx, ry;
// Convert koordinates to local koordinates
trf.reverse( fx, fy, &rx, &ry);
sts = local_event_handler( event, rx, ry);
if ( sts) {
v_value -= (table_y1 - table_y0) * window_scale/50;
if ( v_value < table_y0 * window_scale)
v_value = table_y0 * window_scale;
draw();
v_scrollbar->set_value( v_value, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
return 1;
}
}
return 0;
case glow_eEvent_ScrollDown:
if ( !ctx->trace_started)
return 0;
if ( v_scrollbar) {
double rx, ry;
// Convert koordinates to local koordinates
trf.reverse( fx, fy, &rx, &ry);
sts = local_event_handler( event, rx, ry);
if ( sts) {
v_value += (table_y1 - table_y0) * window_scale/50;
if ( v_value > (table_y1 - (y_high - y_low - scrollbar_width * horizontal_scrollbar)) * window_scale)
v_value = (table_y1 - (y_high - y_low - scrollbar_width * horizontal_scrollbar)) * window_scale;
draw();
v_scrollbar->set_value( v_value, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
return 1;
}
}
return 0;
default: ; default: ;
} }
......
...@@ -579,6 +579,46 @@ int GrowWindow::event_handler( GlowWind *w, glow_eEvent event, int x, int y, dou ...@@ -579,6 +579,46 @@ int GrowWindow::event_handler( GlowWind *w, glow_eEvent event, int x, int y, dou
} }
else else
return 0; return 0;
case glow_eEvent_ScrollUp:
if ( !ctx->trace_started)
return 0;
if ( v_scrollbar) {
double rx, ry;
// Convert koordinates to local koordinates
trf.reverse( fx, fy, &rx, &ry);
sts = local_event_handler( event, rx, ry);
if ( sts) {
v_value -= (wctx_y1 - wctx_y0) * window_scale/50;
if ( v_value < wctx_y0 * window_scale)
v_value = wctx_y0 * window_scale;
draw();
v_scrollbar->set_value( v_value, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
return 1;
}
}
return 0;
case glow_eEvent_ScrollDown:
if ( !ctx->trace_started)
return 0;
if ( v_scrollbar) {
double rx, ry;
// Convert koordinates to local koordinates
trf.reverse( fx, fy, &rx, &ry);
sts = local_event_handler( event, rx, ry);
if ( sts) {
v_value += (wctx_y1 - wctx_y0) * window_scale/50;
if ( v_value > wctx_y1 * window_scale - ((y_high - (y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar)))
v_value = wctx_y1 * window_scale - ((y_high - (y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar));
draw();
v_scrollbar->set_value( v_value, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
return 1;
}
}
return 0;
default: default:
; ;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment