Implement ItemStyle of Naviframe
authorWonYoung Choi <wy80.choi@samsung.com>
Mon, 6 Feb 2017 07:28:43 +0000 (16:28 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Thu, 9 Feb 2017 07:53:28 +0000 (16:53 +0900)
Change-Id: Ie735334a39dc43da17cf5ab396544006be79d138

packaging/elm-sharp.spec
src/ElmSharp/ElmSharp/NaviItem.cs
src/ElmSharp/ElmSharp/Naviframe.cs
src/ElmSharp/Interop/Interop.Elementary.Naviframe.cs

index 9def293..b690ec0 100644 (file)
@@ -1,4 +1,4 @@
-%define DEV_VERSION beta-009
+%define DEV_VERSION beta-010
 
 Name:       elm-sharp
 Summary:    C# Binding for Elementary
index d3f3bde..eabd003 100644 (file)
@@ -77,6 +77,18 @@ namespace ElmSharp
             }
         }
 
+        public string Style
+        {
+            get
+            {
+                return Interop.Elementary.elm_naviframe_item_style_get(Handle);
+            }
+            set
+            {
+                Interop.Elementary.elm_naviframe_item_style_set(Handle, value);
+            }
+        }
+
         protected override void OnInvalidate()
         {
             if (!_isPopped)
index c657ff0..0ff43b7 100644 (file)
@@ -77,9 +77,15 @@ namespace ElmSharp
         {
             return Push(content, null);
         }
+
         public NaviItem Push(EvasObject content, string title)
         {
-            IntPtr item = Interop.Elementary.elm_naviframe_item_push(Handle, title, IntPtr.Zero, IntPtr.Zero, content.Handle, null);
+            return Push(content, title, null);
+        }
+
+        public NaviItem Push(EvasObject content, string title, string style)
+        {
+            IntPtr item = Interop.Elementary.elm_naviframe_item_push(Handle, title, IntPtr.Zero, IntPtr.Zero, content.Handle, style);
             NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
             _itemStack.Add(naviItem);
             naviItem.Popped += ItemPoppedHandler;
@@ -90,9 +96,15 @@ namespace ElmSharp
         {
             return InsertBefore(before, content, "");
         }
+
         public NaviItem InsertBefore(NaviItem before, EvasObject content, string title)
         {
-            IntPtr item = Interop.Elementary.elm_naviframe_item_insert_before(Handle, before, title, IntPtr.Zero, IntPtr.Zero, content, null);
+            return InsertBefore(before, content, title, null);
+        }
+
+        public NaviItem InsertBefore(NaviItem before, EvasObject content, string title, string style)
+        {
+            IntPtr item = Interop.Elementary.elm_naviframe_item_insert_before(Handle, before, title, IntPtr.Zero, IntPtr.Zero, content, style);
             NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
             int idx = _itemStack.IndexOf(before);
             _itemStack.Insert(idx, naviItem);
@@ -104,9 +116,15 @@ namespace ElmSharp
         {
             return InsertAfter(after, content, "");
         }
+
         public NaviItem InsertAfter(NaviItem after, EvasObject content, string title)
         {
-            IntPtr item = Interop.Elementary.elm_naviframe_item_insert_after(Handle, after, title, IntPtr.Zero, IntPtr.Zero, content, null);
+            return InsertAfter(after, content, title, null);
+        }
+
+        public NaviItem InsertAfter(NaviItem after, EvasObject content, string title, string style)
+        {
+            IntPtr item = Interop.Elementary.elm_naviframe_item_insert_after(Handle, after, title, IntPtr.Zero, IntPtr.Zero, content, style);
             NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
             int idx = _itemStack.IndexOf(after);
             _itemStack.Insert(idx + 1, naviItem);
index 5a481b4..2804eb1 100644 (file)
@@ -68,5 +68,16 @@ internal static partial class Interop
 
         [DllImport(Libraries.Elementary)]
         internal static extern void elm_naviframe_item_pop_to(IntPtr item);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern void elm_naviframe_item_style_set(IntPtr item, string style);
+
+        [DllImport(Libraries.Elementary, EntryPoint = "elm_naviframe_item_style_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)]
+        internal static extern IntPtr _elm_naviframe_item_style_get(IntPtr item);
+        internal static string elm_naviframe_item_style_get(IntPtr item)
+        {
+            var text = _elm_naviframe_item_style_get(item);
+            return Marshal.PtrToStringAnsi(text);
+        }
     }
 }