summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bouchaud(yoz) <yoz@efl.so>2017-03-02 11:54:02 +0100
committerMichael Bouchaud(yoz) <yoz@efl.so>2017-03-02 12:58:11 +0100
commit8662ee4256349ad8aea096024c505f608f1579e6 (patch)
treeae52d0275d16c65de6db0e3f54b3daaf05015ac1
parente0e2dc92f52a8ca50a4564a921fd408f426bc78e (diff)
downloadefl-8662ee4256349ad8aea096024c505f608f1579e6.tar.gz
elementary: Add 2 api to elm_index to navigate into the item list
-rw-r--r--src/lib/elementary/elm_index.c51
-rw-r--r--src/lib/elementary/elm_index.eo16
2 files changed, 67 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_index.c b/src/lib/elementary/elm_index.c
index 3b60f4452a..63d2ed0052 100644
--- a/src/lib/elementary/elm_index.c
+++ b/src/lib/elementary/elm_index.c
@@ -1557,6 +1557,57 @@ _elm_index_item_find(Eo *obj, Elm_Index_Data *_pd EINA_UNUSED, const void *data)
return EO_OBJ(it);
}
+EOLIAN static Elm_Object_Item*
+_elm_index_item_next(const Eo *obj, Elm_Index_Data *pd EINA_UNUSED, Elm_Object_Item *it)
+{
+ Eina_List *l;
+ Elm_Object_Item *eo_item;
+
+ ELM_INDEX_DATA_GET(obj, sd);
+
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
+ {
+ ELM_INDEX_ITEM_DATA_GET(eo_item, it_l);
+ if (it == EO_OBJ(it_l))
+ {
+ l = eina_list_next(l);
+ break;
+ }
+ }
+ if (l)
+ {
+ ELM_INDEX_ITEM_DATA_GET(eo_item, it_l);
+ return EO_OBJ(it_l);
+ }
+ return NULL;
+}
+
+EOLIAN static Elm_Object_Item*
+_elm_index_item_prev(const Eo *obj, Elm_Index_Data *pd EINA_UNUSED, Elm_Object_Item *it)
+{
+ Eina_List *l;
+ Elm_Object_Item *eo_item;
+
+ ELM_INDEX_DATA_GET(obj, sd);
+
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
+ {
+ ELM_INDEX_ITEM_DATA_GET(eo_item, it_l);
+ if (it == EO_OBJ(it_l))
+ {
+ l = eina_list_prev(l);
+ break;
+ }
+ }
+ if (l)
+ {
+ ELM_INDEX_ITEM_DATA_GET(eo_item, it_l);
+ return EO_OBJ(it_l);
+ }
+ return NULL;
+}
+
+
EOLIAN static void
_elm_index_item_clear(Eo *obj, Elm_Index_Data *sd)
{
diff --git a/src/lib/elementary/elm_index.eo b/src/lib/elementary/elm_index.eo
index 2c8faab999..b27bce3805 100644
--- a/src/lib/elementary/elm_index.eo
+++ b/src/lib/elementary/elm_index.eo
@@ -217,6 +217,22 @@ class Elm.Index (Elm.Layout, Efl.Orientation,
duplicated, if $cmp_func returns $0.]]
}
}
+ item_next @const {
+ [[Returns the next item, for a given item.]]
+
+ return: Elm.Widget.Item; [[The next item on $obj (or $NULL, on errors).]]
+ params {
+ @in item: Elm.Widget.Item; [[The item.]]
+ }
+ }
+ item_prev @const {
+ [[Returns the next item, for a given item.]]
+
+ return: Elm.Widget.Item; [[The next item on $obj (or $NULL, on errors).]]
+ params {
+ @in item: Elm.Widget.Item; [[The item.]]
+ }
+ }
}
implements {
class.constructor;