elementary/elm_grid : Add focus_direction.
authorWooHyun Jung <woohyun0705@gmail.com>
Tue, 15 May 2012 10:39:07 +0000 (10:39 +0000)
committerWooHyun Jung <woohyun0705@gmail.com>
Tue, 15 May 2012 10:39:07 +0000 (10:39 +0000)
SVN revision: 71103

src/lib/elm_grid.c

index f166e95..0e6c0c8 100644 (file)
@@ -69,6 +69,44 @@ _elm_grid_smart_focus_next(const Evas_Object *obj,
    return ret;
 }
 
+static Eina_Bool
+_elm_grid_smart_focus_direction(const Evas_Object *obj,
+                                const Evas_Object *base,
+                                double degree,
+                                Evas_Object **direction,
+                                double *weight)
+{
+   Eina_Bool ret;
+   const Eina_List *items;
+   Eina_List *(*list_free)(Eina_List *list);
+   void *(*list_data_get)(const Eina_List *list);
+
+   ELM_GRID_DATA_GET(obj, sd);
+
+   /* Focus chain */
+   /* TODO: Change this to use other chain */
+   if ((items = elm_widget_focus_custom_chain_get(obj)))
+     {
+        list_data_get = eina_list_data_get;
+        list_free = NULL;
+     }
+   else
+     {
+        items = evas_object_grid_children_get(sd->resize_obj);
+        list_data_get = eina_list_data_get;
+        list_free = eina_list_free;
+
+        if (!items) return EINA_FALSE;
+     }
+
+   ret = elm_widget_focus_list_direction_get(obj, base, items, list_data_get,
+                                             degree, direction, weight);
+
+   if (list_free) list_free((Eina_List *)items);
+
+   return ret;
+}
+
 static void
 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
 {
@@ -132,6 +170,7 @@ _elm_grid_smart_set_user(Elm_Widget_Smart_Class *sc)
 
    sc->theme = _elm_grid_smart_theme;
    sc->focus_next = _elm_grid_smart_focus_next;
+   sc->focus_direction = _elm_grid_smart_focus_direction;
 }
 
 EAPI Evas_Object *