diff options
author | Sungtaek Hong <sth253.hong@samsung.com> | 2017-05-31 15:38:01 +0900 |
---|---|---|
committer | Sungtaek Hong <sth253.hong@samsung.com> | 2017-06-08 15:33:53 +0900 |
commit | b1a3877f3fcb2e160e005d1271ecfdf5a864e813 (patch) | |
tree | f8607b23dbc025aa72391b3c2b9a43dd318c06ba | |
parent | 1b6794a3d249092439f3c1a96c31a032c0c2b90d (diff) | |
download | elm-sharp-b1a3877f3fcb2e160e005d1271ecfdf5a864e813.tar.gz elm-sharp-b1a3877f3fcb2e160e005d1271ecfdf5a864e813.tar.bz2 elm-sharp-b1a3877f3fcb2e160e005d1271ecfdf5a864e813.zip |
Add layout for button, entry, label
Change-Id: Iedce850763cd41ef1140563c9f9cf32a2bdcce0b
Signed-off-by: Sungtaek Hong <sth253.hong@samsung.com>
-rwxr-xr-x | ElmSharp/ElmSharp/Button.cs | 9 | ||||
-rwxr-xr-x | ElmSharp/ElmSharp/Entry.cs | 19 | ||||
-rwxr-xr-x | ElmSharp/ElmSharp/Label.cs | 15 |
3 files changed, 36 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..48fa897 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); + } } } @@ -154,8 +158,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; } } |