Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_scrollframe.c e_test.c
Log Message:
scrollframe now accepts key press events to control it too - use in
conjunction with propagate for child widgets/objects as to if u want events
to go back to the parent scrollframe or not
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_scrollframe.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_scrollframe.c 29 Oct 2005 15:56:51 -0000 1.2
+++ e_scrollframe.c 30 Oct 2005 05:20:14 -0000 1.3
@@ -43,6 +43,7 @@
static void _e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj,
void *event_info);
static void _e_smart_pan_changed_hook(void *data, Evas_Object *obj, void
*event_info);
static void _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void
*event_info);
+static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj,
void *event_info);
static void _e_smart_edje_drag_v(void *data, Evas_Object *obj, const char
*emission, const char *source);
static void _e_smart_edje_drag_h(void *data, Evas_Object *obj, const char
*emission, const char *source);
static void _e_smart_scrollbar_read(E_Smart_Data *sd);
@@ -314,6 +315,47 @@
}
static void
+_e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void
*event_info)
+{
+ Evas_Event_Key_Down *ev;
+ E_Smart_Data *sd;
+ Evas_Coord x = 0, y = 0, vw = 0, vh = 0, mx = 0, my = 0;
+
+ sd = data;
+ ev = event_info;
+ e_scrollframe_child_pos_get(sd->smart_obj, &x, &y);
+ sd->pan_func.max_get(sd->pan_obj, &mx, &my);
+ evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
+ if (!strcmp(ev->keyname, "Left"))
+ x -= sd->step.x;
+ else if (!strcmp(ev->keyname, "Right"))
+ x += sd->step.x;
+ else if (!strcmp(ev->keyname, "Up"))
+ y -= sd->step.y;
+ else if (!strcmp(ev->keyname, "Home"))
+ y = 0;
+ else if (!strcmp(ev->keyname, "End"))
+ y = my;
+ else if (!strcmp(ev->keyname, "Down"))
+ y += sd->step.y;
+ else if (!strcmp(ev->keyname, "Prior"))
+ {
+ if (sd->page.y < 0)
+ y -= -(sd->page.y * vh) / 100;
+ else
+ y -= sd->page.y;
+ }
+ else if (!strcmp(ev->keyname, "Next"))
+ {
+ if (sd->page.y < 0)
+ y += -(sd->page.y * vh) / 100;
+ else
+ y += sd->page.y;
+ }
+ e_scrollframe_child_pos_set(sd->smart_obj, x, y);
+}
+
+static void
_e_smart_scrollbar_read(E_Smart_Data *sd)
{
Evas_Coord x, y, mx = 0, my = 0;
@@ -573,6 +615,9 @@
sd->hbar_visible = 1;
sd->vbar_visible = 1;
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
_e_smart_event_key_down, sd);
+ evas_object_propagate_events_set(obj, 0);
+
o = edje_object_add(evas_object_evas_get(obj));
sd->edje_obj = o;
e_theme_edje_object_set(o, "base/theme/widgets",
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_test.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- e_test.c 29 Oct 2005 15:56:51 -0000 1.29
+++ e_test.c 30 Oct 2005 05:20:14 -0000 1.30
@@ -330,6 +330,7 @@
e_icon_file_set(o, "/home/raster/t.png");
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_test_click,
NULL);
evas_object_resize(o, 1024, 768);
+ evas_object_focus_set(o, 1);
evas_object_show(o);
o2 = e_scrollframe_add(dia->win->evas);
@@ -348,6 +349,8 @@
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
+
+ evas_object_focus_set(o, 1);
}
#else
static void
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs