Add Scrollable property to ElmSharp.Entry
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 6 Oct 2016 10:23:34 +0000 (12:23 +0200)
committerSeungkeun Lee <sngn.lee@samsung.com>
Mon, 10 Oct 2016 07:53:54 +0000 (16:53 +0900)
Warning: enabling the Scrollable property changes the internal hierarchy of
the entry (via elm_widget_resize_object_set()). This in turn causes all kinds
of side effects, i.e. changing the background color via
    ElmSharp.Widget.SetPartColor("bg-default", color);
no longer works.

Change-Id: I4873bcdebdc9e8472710c8b0575aabd009398148
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/ElmSharp/ElmSharp/Entry.cs
src/ElmSharp/Interop/Interop.Elementary.Entry.cs

index 1d21d71..56e8412 100644 (file)
@@ -202,6 +202,25 @@ namespace ElmSharp
             }
         }
 
+        public bool Scrollable
+        {
+            get
+            {
+                return Interop.Elementary.elm_entry_scrollable_get(Handle);
+            }
+            set
+            {
+                // HACK: Enabling the scrollable property of an entry causes its internal
+                //       hierarchy to change, making the internal edje object inaccessible.
+                //       Access it before the property is set, to cache the edje object's handle.
+                if (value)
+                {
+                    var dummy = EdjeObject;
+                }
+                Interop.Elementary.elm_entry_scrollable_set(Handle, value);
+            }
+        }
+
         public static string ConvertMarkupToUtf8(string markup)
         {
             return Interop.Elementary.elm_entry_markup_to_utf8(markup);
index 5ae6646..9de2772 100644 (file)
@@ -149,6 +149,12 @@ internal static partial class Interop
             var text = _elm_entry_entry_get(obj);
             return Marshal.PtrToStringAnsi(text);
         }
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern bool elm_entry_scrollable_get(IntPtr obj);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern void elm_entry_scrollable_set(IntPtr obj, bool scroll);
     }
 }