diff options
author | Kangho Hur <kangho.hur@samsung.com> | 2017-06-09 00:31:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2017-06-09 00:31:58 +0000 |
commit | a477a5840c748f769279adb9fe5dc07c6201a0f9 (patch) | |
tree | d7aca55fd654509a68f08dd2f04220181764ed24 /ElmSharp | |
parent | 5f7ad771d0286710817c8441c6d4ee2275b15f4e (diff) | |
parent | 6b096360211c4e1bebb6fd37b53a4c9141036e91 (diff) | |
download | elm-sharp-a477a5840c748f769279adb9fe5dc07c6201a0f9.tar.gz elm-sharp-a477a5840c748f769279adb9fe5dc07c6201a0f9.tar.bz2 elm-sharp-a477a5840c748f769279adb9fe5dc07c6201a0f9.zip |
Merge changes I98ade8b7,Iedce8507 into tizen
* changes:
Add new internal APIs for layout/label
Add layout for button, entry, label
Diffstat (limited to 'ElmSharp')
-rwxr-xr-x | ElmSharp/ElmSharp/Button.cs | 9 | ||||
-rwxr-xr-x | ElmSharp/ElmSharp/Entry.cs | 19 | ||||
-rwxr-xr-x | ElmSharp/ElmSharp/Label.cs | 41 | ||||
-rwxr-xr-x | ElmSharp/ElmSharp/Layout.cs | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/Interop/Interop.Elementary.Label.cs | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/Interop/Interop.Elementary.cs | 6 |
6 files changed, 104 insertions, 7 deletions
diff --git a/ElmSharp/ElmSharp/Button.cs b/ElmSharp/ElmSharp/Button.cs index cf6155c..e369054 100755 --- a/ElmSharp/ElmSharp/Button.cs +++ b/ElmSharp/ElmSharp/Button.cs @@ -163,8 +163,13 @@ namespace ElmSharp protected override IntPtr CreateHandle(EvasObject parent) { - //TODO: Fix this to use layout - return Interop.Elementary.elm_button_add(parent.Handle); + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_button_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; } } } diff --git a/ElmSharp/ElmSharp/Entry.cs b/ElmSharp/ElmSharp/Entry.cs index a274055..8413592 100755 --- a/ElmSharp/ElmSharp/Entry.cs +++ b/ElmSharp/ElmSharp/Entry.cs @@ -430,10 +430,25 @@ namespace ElmSharp Interop.Elementary.elm_entry_select_none(RealHandle); } + public override void SetPartColor(string part, Color color) + { + IntPtr handle = (part == "bg") ? Handle : RealHandle; + Interop.Elementary.elm_object_color_class_color_set(handle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + protected override IntPtr CreateHandle(EvasObject parent) { - //TODO: Fix this to use layout - return Interop.Elementary.elm_entry_add(parent.Handle); + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + + RealHandle = Interop.Elementary.elm_entry_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; } } } diff --git a/ElmSharp/ElmSharp/Label.cs b/ElmSharp/ElmSharp/Label.cs index 77fa79b..68b7486 100755 --- a/ElmSharp/ElmSharp/Label.cs +++ b/ElmSharp/ElmSharp/Label.cs @@ -15,7 +15,6 @@ */ using System; - namespace ElmSharp { /// <summary> @@ -71,6 +70,11 @@ namespace ElmSharp set { Interop.Elementary.elm_label_line_wrap_set(RealHandle, (int)value); + if (value != WrapType.None) + { + Interop.Evas.evas_object_size_hint_min_get(RealHandle, IntPtr.Zero, out int h); + Interop.Evas.evas_object_size_hint_min_set(RealHandle, 0, h); + } } } @@ -140,6 +144,32 @@ namespace ElmSharp } /// <summary> + /// Sets or gets the style of the label text. + /// </summary> + /// <remarks> + /// APIs, elm_label_text_style_user_peek/pop/push, are internal APIs only in Tizen. Avalilable since Tizen_4.0. + /// </remarks> + /// + public string TextStyle + { + get + { + return Interop.Elementary.elm_label_text_style_user_peek(RealHandle); + } + set + { + if (!string.IsNullOrEmpty(value)) + { + Interop.Elementary.elm_label_text_style_user_pop(RealHandle); + } + else + { + Interop.Elementary.elm_label_text_style_user_push(RealHandle, value); + } + } + } + + /// <summary> /// Start slide effect. /// </summary> public void PlaySlide() @@ -154,8 +184,13 @@ namespace ElmSharp /// <returns>The new object, otherwise null if it cannot be created</returns> protected override IntPtr CreateHandle(EvasObject parent) { - //TODO: Fix this to use layout - return Interop.Elementary.elm_label_add(parent.Handle); + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_label_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; } } diff --git a/ElmSharp/ElmSharp/Layout.cs b/ElmSharp/ElmSharp/Layout.cs index c7382f1..4c92402 100755 --- a/ElmSharp/ElmSharp/Layout.cs +++ b/ElmSharp/ElmSharp/Layout.cs @@ -113,6 +113,28 @@ namespace ElmSharp } /// <summary> + /// Sets the vertical text alignment of layout's text part + /// </summary> + /// <remarks> + /// API, elm_layout_text_valign_set, is an internal API only in Tizen. Avalilable since Tizen_4.0. + /// </remarks> + public virtual void SetVerticalTextAlignment(string part, double valign) + { + Interop.Elementary.elm_layout_text_valign_set(RealHandle, part, valign); + } + + /// <summary> + /// Gets the vertical text alignment of layout's text part + /// </summary> + /// <remarks> + /// API, elm_layout_text_valign_get, is internal API only in Tizen. Avalilable since Tizen_4.0. + /// </remarks> + public virtual double GetVerticalTextAlignment(string part) + { + return Interop.Elementary.elm_layout_text_valign_get(RealHandle, part); + } + + /// <summary> /// Sets the content at a part of a given container widget. /// </summary> /// <param name="parent">The parent is a given container which will be attached by Layout as a child. It's <see cref="EvasObject"/> type.</param> diff --git a/ElmSharp/Interop/Interop.Elementary.Label.cs b/ElmSharp/Interop/Interop.Elementary.Label.cs index d326fc2..bf5c2d5 100644..100755 --- a/ElmSharp/Interop/Interop.Elementary.Label.cs +++ b/ElmSharp/Interop/Interop.Elementary.Label.cs @@ -62,5 +62,19 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern bool elm_label_ellipsis_get(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_label_text_style_user_peek", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_label_text_style_user_peek(IntPtr obj); + internal static string elm_label_text_style_user_peek(IntPtr obj) + { + var text = _elm_label_text_style_user_peek(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_text_style_user_push(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_text_style_user_pop(IntPtr obj); } }
\ No newline at end of file diff --git a/ElmSharp/Interop/Interop.Elementary.cs b/ElmSharp/Interop/Interop.Elementary.cs index 1071b13..da07a4a 100644..100755 --- a/ElmSharp/Interop/Interop.Elementary.cs +++ b/ElmSharp/Interop/Interop.Elementary.cs @@ -283,6 +283,12 @@ internal static partial class Interop internal static extern string elm_layout_data_get(IntPtr obj, string key); [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_text_valign_set(IntPtr obj, string part, double valign); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_layout_text_valign_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] internal static extern IntPtr elm_notify_add(IntPtr obj); [DllImport(Libraries.Elementary)] |