From c2519ae863372198aea511d4afc1ccb1ecc9b923 Mon Sep 17 00:00:00 2001
From: Piotr Szydelko
Date: Thu, 2 Mar 2017 07:38:05 +0100
Subject: [PATCH] Add GenListItem.Next and Previous properties
These readnly properties allows the developer to access
the item following the current one and the one before it.
Change-Id: If3b9cf51a88a4313776057fd433fcf9fd697c40a
Signed-off-by: Piotr Szydelko
---
ElmSharp/ElmSharp/GenListItem.cs | 24 ++++++++++++++++++++++
ElmSharp/Interop/Interop.Elementary.GenListView.cs | 6 ++++++
2 files changed, 30 insertions(+)
diff --git a/ElmSharp/ElmSharp/GenListItem.cs b/ElmSharp/ElmSharp/GenListItem.cs
index af616e5..d1b9b47 100644
--- a/ElmSharp/ElmSharp/GenListItem.cs
+++ b/ElmSharp/ElmSharp/GenListItem.cs
@@ -77,6 +77,30 @@ namespace ElmSharp
}
}
+ public GenListItem Next
+ {
+ get
+ {
+ IntPtr next = Interop.Elementary.elm_genlist_item_next_get(Handle);
+ if (next == IntPtr.Zero)
+ return null;
+ else
+ return GetItemByHandle(next) as GenListItem;
+ }
+ }
+
+ public GenListItem Previous
+ {
+ get
+ {
+ IntPtr prev = Interop.Elementary.elm_genlist_item_prev_get(Handle);
+ if (prev == IntPtr.Zero)
+ return null;
+ else
+ return GetItemByHandle(prev) as GenListItem;
+ }
+ }
+
public void UpdateItemClass(GenItemClass itemClass, object data)
{
Data = data;
diff --git a/ElmSharp/Interop/Interop.Elementary.GenListView.cs b/ElmSharp/Interop/Interop.Elementary.GenListView.cs
index 732db0d..1df2030 100644
--- a/ElmSharp/Interop/Interop.Elementary.GenListView.cs
+++ b/ElmSharp/Interop/Interop.Elementary.GenListView.cs
@@ -116,6 +116,12 @@ internal static partial class Interop
internal static extern IntPtr elm_genlist_last_item_get(IntPtr obj);
[DllImport(Libraries.Elementary)]
+ internal static extern IntPtr elm_genlist_item_next_get(IntPtr item);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern IntPtr elm_genlist_item_prev_get(IntPtr item);
+
+ [DllImport(Libraries.Elementary)]
internal static extern bool elm_genlist_item_selected_get(IntPtr obj);
[DllImport(Libraries.Elementary)]
--
2.7.4