Add Interop.eo to support eo_XXX APIs.
authorKangho Hur <kangho.hur@samsung.com>
Tue, 6 Sep 2016 00:48:59 +0000 (09:48 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Wed, 7 Sep 2016 05:01:38 +0000 (14:01 +0900)
* Provide ClassName property on EvasObject by using eo_class_get(), eo_class_name_get()
* edje_object_color_class_del(IntPtr obj, string colorClass) has been added to prepare support to reset object color.

Change-Id: Icd2249aad30e81ec142bdaca091796e3e00eaeda

src/ElmSharp/ElmSharp.csproj
src/ElmSharp/ElmSharp/EvasObject.cs
src/ElmSharp/Interop/Interop.Elementary.cs
src/ElmSharp/Interop/Interop.Eo.cs [new file with mode: 0644]
src/ElmSharp/Interop/Interop.Libraries.cs
test/ElmSharp.Test/TC/ButtonTest1.cs

index b9850d8..47fa3cd 100644 (file)
     <Compile Include="ElmSharp\Widget.cs" />\r
     <Compile Include="ElmSharp\Window.cs" />\r
     <Compile Include="ElmSharp\WrapType.cs" />\r
+    <Compile Include="Interop\Interop.Eo.cs" />\r
     <Compile Include="Interop\Interop.Ecore.cs" />\r
     <Compile Include="Interop\Interop.Elementary.Bg.cs" />\r
     <Compile Include="Interop\Interop.Elementary.Box.cs" />\r
index a5f5243..ddbb441 100644 (file)
@@ -41,6 +41,14 @@ namespace ElmSharp
 
         public bool IsRealized { get { return Handle != IntPtr.Zero; } }
 
+        public string ClassName
+        {
+            get
+            {
+                return Interop.Eo.eo_class_name_get(Interop.Eo.eo_class_get(Handle));
+            }
+        }
+
         public double WeightX
         {
             get
index fdd7e6d..c8fe751 100644 (file)
@@ -192,6 +192,9 @@ internal static partial class Interop
         internal static extern IntPtr elm_layout_edje_get(IntPtr obj);
 
         [DllImport(Libraries.Elementary)]
+        internal static extern void edje_object_color_class_del(IntPtr obj, string colorClass);
+
+        [DllImport(Libraries.Elementary)]
         internal static extern bool edje_object_part_exists(IntPtr obj, string part);
 
         [DllImport(Libraries.Elementary)]
@@ -212,7 +215,6 @@ internal static partial class Interop
             return Marshal.PtrToStringAnsi(text);
         }
 
-
         [DllImport(Libraries.Elementary, EntryPoint = "edje_object_part_text_style_user_peek", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)]
         internal static extern IntPtr _edje_object_part_text_style_user_peek(IntPtr obj, string part);
 
diff --git a/src/ElmSharp/Interop/Interop.Eo.cs b/src/ElmSharp/Interop/Interop.Eo.cs
new file mode 100644 (file)
index 0000000..6dd843c
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+    internal static partial class Eo
+    {
+        [DllImport(Libraries.Eo)]
+        internal static extern IntPtr eo_class_get(IntPtr obj);
+
+        [DllImport(Libraries.Eo, EntryPoint = "eo_class_name_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)]
+        internal static extern IntPtr _eo_class_name_get(IntPtr klass);
+
+        internal static string eo_class_name_get(IntPtr obj)
+        {
+            var name = _eo_class_name_get(obj);
+            return Marshal.PtrToStringAnsi(name);
+        }
+
+    }
+
+}
\ No newline at end of file
index ac01c4c..1f294dd 100644 (file)
@@ -16,5 +16,6 @@ internal static partial class Interop
         internal const string Elementary = "libelementary.so.1";
         internal const string Eina = "libeina.so.1";
         internal const string Ecore = "libecore.so.1";
+        internal const string Eo = "libeo.so.1";
     }
 }
index d4d443f..377ff9a 100644 (file)
@@ -12,12 +12,16 @@ namespace ElmSharp.Test
         {
             Button button1 = new Button(window) {
                 Text = "Button 1",
-
             };
 
+            button1.SetPartColor("bg-default", Color.Red);
+
             button1.Clicked += (s, e) =>
             {
-                Console.WriteLine("Button1 Clicked!");
+                Console.WriteLine("Button1 Clicked! : {0}", button1.ClassName);
+                Console.WriteLine("Button1 Clicked! : {0}", button1.ClassName.ToLower());
+                Console.WriteLine("Button1 Clicked! : {0}", button1.ClassName.ToLower().Replace("_","/widget/"));
+                Console.WriteLine("Button1 Clicked! : {0}", button1.ClassName.ToLower().Replace("_", "/widget/")+ "/" + "bg-default");
             };
 
             button1.Pressed += (s, e) =>
@@ -41,4 +45,4 @@ namespace ElmSharp.Test
         }
 
     }
-}
\ No newline at end of file
+}