From c370534c53aaf321b6b573030481003975a02c6d Mon Sep 17 00:00:00 2001 From: Kangho Hur Date: Tue, 6 Sep 2016 09:48:59 +0900 Subject: [PATCH] Add Interop.eo to support eo_XXX APIs. * 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 | 1 + src/ElmSharp/ElmSharp/EvasObject.cs | 8 ++++++++ src/ElmSharp/Interop/Interop.Elementary.cs | 4 +++- src/ElmSharp/Interop/Interop.Eo.cs | 30 ++++++++++++++++++++++++++++++ src/ElmSharp/Interop/Interop.Libraries.cs | 1 + test/ElmSharp.Test/TC/ButtonTest1.cs | 10 +++++++--- 6 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 src/ElmSharp/Interop/Interop.Eo.cs diff --git a/src/ElmSharp/ElmSharp.csproj b/src/ElmSharp/ElmSharp.csproj index b9850d8..47fa3cd 100644 --- a/src/ElmSharp/ElmSharp.csproj +++ b/src/ElmSharp/ElmSharp.csproj @@ -105,6 +105,7 @@ + diff --git a/src/ElmSharp/ElmSharp/EvasObject.cs b/src/ElmSharp/ElmSharp/EvasObject.cs index a5f5243..ddbb441 100644 --- a/src/ElmSharp/ElmSharp/EvasObject.cs +++ b/src/ElmSharp/ElmSharp/EvasObject.cs @@ -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 diff --git a/src/ElmSharp/Interop/Interop.Elementary.cs b/src/ElmSharp/Interop/Interop.Elementary.cs index fdd7e6d..c8fe751 100644 --- a/src/ElmSharp/Interop/Interop.Elementary.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.cs @@ -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 index 0000000..6dd843c --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Eo.cs @@ -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 diff --git a/src/ElmSharp/Interop/Interop.Libraries.cs b/src/ElmSharp/Interop/Interop.Libraries.cs index ac01c4c..1f294dd 100644 --- a/src/ElmSharp/Interop/Interop.Libraries.cs +++ b/src/ElmSharp/Interop/Interop.Libraries.cs @@ -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"; } } diff --git a/test/ElmSharp.Test/TC/ButtonTest1.cs b/test/ElmSharp.Test/TC/ButtonTest1.cs index d4d443f..377ff9a 100644 --- a/test/ElmSharp.Test/TC/ButtonTest1.cs +++ b/test/ElmSharp.Test/TC/ButtonTest1.cs @@ -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 +} -- 2.7.4