Commit 5ac55a01cb27c6d9fa43107ce0ee13319c40d488
1 parent
e4da3ca6
Exists in
master
and in
1 other branch
Rômulo Silva Neiva
29 de agosto de 2012 07:54 * não é tão necessário, mas a versão 4.1 tem, a rolagem de tela através da roda do mouse.
Showing
3 changed files
with
27 additions
and
0 deletions
Show diff stats
mouse.c
@@ -36,6 +36,10 @@ | @@ -36,6 +36,10 @@ | ||
36 | #include <lib3270/actions.h> | 36 | #include <lib3270/actions.h> |
37 | #include <lib3270/log.h> | 37 | #include <lib3270/log.h> |
38 | 38 | ||
39 | +/*--[ Globals ]--------------------------------------------------------------------------------------*/ | ||
40 | + | ||
41 | + static GtkAction *action_scroll[] = { NULL, NULL, NULL, NULL }; | ||
42 | + | ||
39 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 43 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
40 | 44 | ||
41 | gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y) | 45 | gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y) |
@@ -262,3 +266,24 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | @@ -262,3 +266,24 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | ||
262 | 266 | ||
263 | return FALSE; | 267 | return FALSE; |
264 | } | 268 | } |
269 | + | ||
270 | +void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action) | ||
271 | +{ | ||
272 | + g_return_if_fail(GTK_IS_V3270(widget)); | ||
273 | + action_scroll[((int) direction) & 0x03] = action; | ||
274 | +} | ||
275 | + | ||
276 | +gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) | ||
277 | +{ | ||
278 | + v3270 * terminal = GTK_V3270(widget); | ||
279 | + | ||
280 | + if(lib3270_get_program_message(terminal->host) != LIB3270_MESSAGE_NONE || event->direction < 0 || event->direction > G_N_ELEMENTS(action_scroll)) | ||
281 | + return FALSE; | ||
282 | + | ||
283 | + trace("Scroll: %d Action: %p",event->direction,action_scroll[event->direction]); | ||
284 | + | ||
285 | + if(action_scroll[event->direction]) | ||
286 | + gtk_action_activate(action_scroll[event->direction]); | ||
287 | + | ||
288 | + return TRUE; | ||
289 | + } |
private.h
@@ -254,5 +254,6 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event); | @@ -254,5 +254,6 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event); | ||
254 | gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event); | 254 | gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event); |
255 | void v3270_emit_popup(v3270 *widget, int baddr, GdkEventButton *event); | 255 | void v3270_emit_popup(v3270 *widget, int baddr, GdkEventButton *event); |
256 | gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y); | 256 | gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y); |
257 | +gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_data); | ||
257 | 258 | ||
258 | G_END_DECLS | 259 | G_END_DECLS |
widget.c
@@ -294,6 +294,7 @@ static void v3270_class_init(v3270Class *klass) | @@ -294,6 +294,7 @@ static void v3270_class_init(v3270Class *klass) | ||
294 | widget_class->button_release_event = v3270_button_release_event; | 294 | widget_class->button_release_event = v3270_button_release_event; |
295 | widget_class->motion_notify_event = v3270_motion_notify_event; | 295 | widget_class->motion_notify_event = v3270_motion_notify_event; |
296 | widget_class->popup_menu = v3270_popup_menu; | 296 | widget_class->popup_menu = v3270_popup_menu; |
297 | + widget_class->scroll_event = v3270_scroll_event; | ||
297 | 298 | ||
298 | /* Accessibility support */ | 299 | /* Accessibility support */ |
299 | widget_class->get_accessible = v3270_get_accessible; | 300 | widget_class->get_accessible = v3270_get_accessible; |