aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-10-30 14:05:50 +0000
committerTom Hacohen <tom@stosb.com>2012-10-30 14:05:50 +0000
commit00698b999e78320052ade2b19dd87d70444866ea (patch)
tree587b150feb23d19053fb8e805fc13300b3de53d5
parentfsel no longer changes entry text when changing directory (diff)
downloadenlightenment-00698b999e78320052ade2b19dd87d70444866ea.tar.gz
E srcollframe: Added a mode to disable key navigation + fixed show region.
Show region now doesn't move if the requested region is inside of the already visible region. SVN revision: 78661
-rw-r--r--src/bin/e_scrollframe.c25
-rw-r--r--src/bin/e_scrollframe.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/src/bin/e_scrollframe.c b/src/bin/e_scrollframe.c
index 5534bac7a..3d78b51bd 100644
--- a/src/bin/e_scrollframe.c
+++ b/src/bin/e_scrollframe.c
@@ -62,6 +62,7 @@ struct _E_Smart_Data
unsigned char vbar_visible : 1;
unsigned char extern_pan : 1;
unsigned char one_dir_at_a_time : 1;
+ Eina_Bool key_nav : 1;
};
/* local subsystem functions */
@@ -264,13 +265,18 @@ e_scrollframe_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
EAPI void
e_scrollframe_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
- Evas_Coord mx = 0, my = 0, cw = 0, ch = 0, px = 0, py = 0, nx, ny;
+ Evas_Coord mx = 0, my = 0, cw = 0, ch = 0, px = 0, py = 0, nx, ny, vw, vh;
API_ENTRY return;
if (!sd->pan_obj) return;
sd->pan_func.max_get(sd->pan_obj, &mx, &my);
sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
sd->pan_func.get(sd->pan_obj, &px, &py);
+ e_scrollframe_child_viewport_size_get(obj, &vw, &vh);
+
+ /* Abort if the request region is already shown */
+ if ((px <= x) && (py <= y) && (x + w <= px + vw) && (y + h <= py + vh))
+ return;
nx = px;
if (x < px) nx = x;
@@ -381,6 +387,22 @@ e_scrollframe_thumbscroll_force(Evas_Object *obj, Eina_Bool forced)
sd->thumbscroll.forced = forced;
}
+EAPI void
+e_scrollframe_key_navigation_set(Evas_Object *obj, Eina_Bool enabled)
+{
+ API_ENTRY return;
+ if (enabled == sd->key_nav)
+ return;
+
+ sd->key_nav = enabled;
+ if (sd->key_nav)
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
+ _e_smart_event_key_down, sd);
+ else
+ evas_object_event_callback_del_full(obj, EVAS_CALLBACK_KEY_DOWN,
+ _e_smart_event_key_down, sd);
+}
+
/* local subsystem functions */
static void
_e_smart_edje_drag_v(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
@@ -992,6 +1014,7 @@ _e_smart_add(Evas_Object *obj)
sd->vbar_flags = E_SCROLLFRAME_POLICY_AUTO;
sd->hbar_visible = 1;
sd->vbar_visible = 1;
+ sd->key_nav = EINA_TRUE;
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
_e_smart_event_key_down, sd);
diff --git a/src/bin/e_scrollframe.h b/src/bin/e_scrollframe.h
index 9b7520539..b37e58b46 100644
--- a/src/bin/e_scrollframe.h
+++ b/src/bin/e_scrollframe.h
@@ -30,6 +30,7 @@ EAPI Evas_Object *e_scrollframe_edje_object_get (Evas_Object *obj);
EAPI void e_scrollframe_single_dir_set (Evas_Object *obj, Eina_Bool single_dir);
EAPI Eina_Bool e_scrollframe_single_dir_get (Evas_Object *obj);
EAPI void e_scrollframe_thumbscroll_force (Evas_Object *obj, Eina_Bool forced);
+EAPI void e_scrollframe_key_navigation_set (Evas_Object *obj, Eina_Bool enabled);
#endif
#endif