From 0dbb5e410c6524a78fbbe15c4fb20458e8403182 Mon Sep 17 00:00:00 2001 From: Pawel Andruszkiewicz Date: Thu, 6 Oct 2016 12:23:34 +0200 Subject: [PATCH] Add Scrollable property to ElmSharp.Entry 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 --- src/ElmSharp/ElmSharp/Entry.cs | 19 +++++++++++++++++++ src/ElmSharp/Interop/Interop.Elementary.Entry.cs | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/src/ElmSharp/ElmSharp/Entry.cs b/src/ElmSharp/ElmSharp/Entry.cs index 1d21d71..56e8412 100644 --- a/src/ElmSharp/ElmSharp/Entry.cs +++ b/src/ElmSharp/ElmSharp/Entry.cs @@ -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); diff --git a/src/ElmSharp/Interop/Interop.Elementary.Entry.cs b/src/ElmSharp/Interop/Interop.Elementary.Entry.cs index 5ae6646..9de2772 100644 --- a/src/ElmSharp/Interop/Interop.Elementary.Entry.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.Entry.cs @@ -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); } } -- 2.7.4