Add layout for button, entry, label 01/131901/3
authorSungtaek Hong <sth253.hong@samsung.com>
Wed, 31 May 2017 06:38:01 +0000 (15:38 +0900)
committerSungtaek Hong <sth253.hong@samsung.com>
Thu, 8 Jun 2017 06:33:53 +0000 (15:33 +0900)
Change-Id: Iedce850763cd41ef1140563c9f9cf32a2bdcce0b
Signed-off-by: Sungtaek Hong <sth253.hong@samsung.com>
ElmSharp/ElmSharp/Button.cs
ElmSharp/ElmSharp/Entry.cs
ElmSharp/ElmSharp/Label.cs

index cf6155c..e369054 100755 (executable)
@@ -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;
         }
     }
 }
index a274055..8413592 100755 (executable)
@@ -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;
         }
     }
 }
index 77fa79b..48fa897 100755 (executable)
@@ -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;
         }
     }