Add CircleSurface and Change Every circle object 00/156900/11
authorpius.lee <pius.lee@samsung.com>
Fri, 20 Oct 2017 11:36:51 +0000 (20:36 +0900)
committerpius.lee <pius.lee@samsung.com>
Tue, 24 Oct 2017 09:13:38 +0000 (18:13 +0900)
Now Circle object use circle surface

Change-Id: I16b0de180b20319f97c51983c9c20920939a4d12

38 files changed:
src/ElmSharp.Wearable/ElmSharp.Wearable.sln
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSurface.cs [new file with mode: 0644]
src/ElmSharp.Wearable/ElmSharp.Wearable/ICircleWidget.cs [new file with mode: 0644]
src/ElmSharp.Wearable/ElmSharp.Wearable/RotaryEventManager.cs
src/ElmSharp/ElmSharp/Container.cs
src/ElmSharp/ElmSharp/DateTimeSelector.cs
src/ElmSharp/ElmSharp/GenList.cs
src/ElmSharp/ElmSharp/Layout.cs
src/ElmSharp/ElmSharp/Scroller.cs
src/ElmSharp/ElmSharp/Spinner.cs
src/ElmSharp/ElmSharp/Widget.cs
test/ElmSharp.Test/ElmSharp.Test.csproj
test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs
test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs
test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs
test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs
test/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs
test/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs
test/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs
test/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs
test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs
test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs
test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs
test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs
test/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs
test/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs
test/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs
test/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs
test/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs
test/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs
test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs
test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs

index dbf2ebd..95835a9 100644 (file)
@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 15
-VisualStudioVersion = 15.0.26730.8
+VisualStudioVersion = 15.0.26730.10
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Wearable", "ElmSharp.Wearable.csproj", "{01AE2E3A-C08E-431C-97B3-A18D536FCD52}"
 EndProject
@@ -11,6 +11,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Test", "..\..\test
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Wearable.Test", "..\..\test\ElmSharp.Wearable.Test\ElmSharp.Wearable.Test.csproj", "{DC7126DF-8ED8-448A-B7D8-15C7441B6929}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{EC21B79B-8EC3-4324-B8B0-F541D37FA0C7}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.UI", "..\Tizen.Applications.UI\Tizen.Applications.UI.csproj", "{21EEB0B3-BCE2-4BF7-A826-F62F3E97A42F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{E26744AF-0991-410E-8AD8-81AD65749036}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{1E463DAD-F3CA-47B7-8D02-C53873D8D0F2}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -33,6 +41,22 @@ Global
                {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {DC7126DF-8ED8-448A-B7D8-15C7441B6929}.Release|Any CPU.Build.0 = Release|Any CPU
+               {EC21B79B-8EC3-4324-B8B0-F541D37FA0C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {EC21B79B-8EC3-4324-B8B0-F541D37FA0C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {EC21B79B-8EC3-4324-B8B0-F541D37FA0C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {EC21B79B-8EC3-4324-B8B0-F541D37FA0C7}.Release|Any CPU.Build.0 = Release|Any CPU
+               {21EEB0B3-BCE2-4BF7-A826-F62F3E97A42F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {21EEB0B3-BCE2-4BF7-A826-F62F3E97A42F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {21EEB0B3-BCE2-4BF7-A826-F62F3E97A42F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {21EEB0B3-BCE2-4BF7-A826-F62F3E97A42F}.Release|Any CPU.Build.0 = Release|Any CPU
+               {E26744AF-0991-410E-8AD8-81AD65749036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {E26744AF-0991-410E-8AD8-81AD65749036}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {E26744AF-0991-410E-8AD8-81AD65749036}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {E26744AF-0991-410E-8AD8-81AD65749036}.Release|Any CPU.Build.0 = Release|Any CPU
+               {1E463DAD-F3CA-47B7-8D02-C53873D8D0F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {1E463DAD-F3CA-47B7-8D02-C53873D8D0F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {1E463DAD-F3CA-47B7-8D02-C53873D8D0F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {1E463DAD-F3CA-47B7-8D02-C53873D8D0F2}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 6623984..851b135 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 using System;
+using System.Diagnostics;
 
 namespace ElmSharp.Wearable
 {
@@ -22,28 +23,45 @@ namespace ElmSharp.Wearable
     /// The Circle DateTime Selector is a widget to display and handle datetime value by rotary event
     /// Inherits <see cref="DateTimeSelector"/>
     /// </summary>
-    public class CircleDateTimeSelector : DateTimeSelector
+    public class CircleDateTimeSelector : DateTimeSelector, IRotaryActionWidget
     {
-        IntPtr circleHandle;
+        IntPtr _circleHandle;
+        CircleSurface _surface;
 
         /// <summary>
         /// Creates and initializes a new instance of the Circle DateTime class
         /// </summary>
         /// <param name="parent">The parent of new Circle DateTime instance</param>
-        public CircleDateTimeSelector(EvasObject parent) : base(parent) { }
+        /// <param name="surface">The surface for drawing circle features for this widget.</param>
+        public CircleDateTimeSelector(EvasObject parent, CircleSurface surface) : base()
+        {
+            Debug.Assert(parent == null || surface == null || parent.IsRealized);
+            _surface = surface;
+            Realize(parent);
+        }
+
+        /// <summary>
+        /// Gets the handle for Circle Widget.
+        /// </summary>
+        public virtual IntPtr CircleHandle => _circleHandle;
 
         /// <summary>
-        /// Sets or gets the disabled state of the Circle DateTime Selector
+        /// Gets the handle for Circle Surface used in this widget
         /// </summary>
-        public bool Disabled
+        public virtual CircleSurface CircleSurface => _surface;
+
+        /// <summary>
+        /// Sets or gets the state of the widget, which might be enabled or disabled.
+        /// </summary>
+        public override bool IsEnabled
         {
             get
             {
-                return Interop.Eext.eext_circle_object_disabled_get(circleHandle);
+                return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_disabled_set(circleHandle, value);
+                Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
             }
         }
 
@@ -55,12 +73,12 @@ namespace ElmSharp.Wearable
             get
             {
                 int r, g, b, a;
-                Interop.Eext.eext_circle_object_item_color_get(circleHandle, "default", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a);
                 return new Color(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(circleHandle, "default", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -71,11 +89,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "default");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "default", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
             }
         }
 
@@ -86,11 +104,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default");
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
             }
         }
 
@@ -103,35 +121,7 @@ namespace ElmSharp.Wearable
         {
             var handle = base.CreateHandle(parent);
 
-            IntPtr surface = IntPtr.Zero;
-
-            if (parent is Conformant)
-            {
-                surface = Interop.Eext.eext_circle_surface_conformant_add(parent);
-            }
-            else if (parent is Naviframe)
-            {
-                surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
-            }
-            else if (parent is Layout)
-            {
-                surface = Interop.Eext.eext_circle_surface_layout_add(parent);
-            }
-
-            circleHandle = Interop.Eext.eext_circle_object_datetime_add(RealHandle, surface);
-            if (surface == IntPtr.Zero)
-            {
-                EvasObject p = parent;
-                while (!(p is Window))
-                {
-                    p = p.Parent;
-                }
-                var w = (p as Window).ScreenSize.Width;
-                var h = (p as Window).ScreenSize.Height;
-                Interop.Evas.evas_object_resize(circleHandle, w, h);
-            }
-
-            Interop.Eext.eext_rotary_object_event_activated_set(circleHandle, true);
+            _circleHandle = Interop.Eext.eext_circle_object_datetime_add(RealHandle == IntPtr.Zero ? Handle : RealHandle , CircleSurface.Handle);
 
             return handle;
         }
index d5c31e3..1de98bd 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 using System;
+using System.Diagnostics;
 
 namespace ElmSharp.Wearable
 {
@@ -22,28 +23,45 @@ namespace ElmSharp.Wearable
     /// The Circle GenList Selector is a widget to display and handle genlist items by rotary event
     /// Inherits <see cref="GenList"/>
     /// </summary>
-    public class CircleGenList : GenList
+    public class CircleGenList : GenList, IRotaryActionWidget
     {
-        IntPtr circleHandle;
+        IntPtr _circleHandle;
+        CircleSurface _surface;
 
         /// <summary>
         /// Creates and initializes a new instance of the Circle GenList class
         /// </summary>
         /// <param name="parent">The parent of new Circle GenList instance</param>
-        public CircleGenList(EvasObject parent) : base(parent) { }
+        /// <param name="surface">The surface for drawing circle features for this widget.</param>
+        public CircleGenList(EvasObject parent, CircleSurface surface) : base()
+        {
+            Debug.Assert(parent == null || surface == null || parent.IsRealized);
+            _surface = surface;
+            Realize(parent);
+        }
+
+        /// <summary>
+        /// Gets the handle for Circle Widget.
+        /// </summary>
+        public virtual IntPtr CircleHandle => _circleHandle;
 
         /// <summary>
-        /// Sets or gets the disabled state of the Circle GenList Selector
+        /// Gets the handle for Circle Surface used in this widget
         /// </summary>
-        public bool Disabled
+        public virtual CircleSurface CircleSurface => _surface;
+
+        /// <summary>
+        /// Sets or gets the state of the widget, which might be enabled or disabled.
+        /// </summary>
+        public override bool IsEnabled
         {
             get
             {
-                return Interop.Eext.eext_circle_object_disabled_get(circleHandle);
+                return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_disabled_set(circleHandle, value);
+                Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
             }
         }
 
@@ -55,12 +73,12 @@ namespace ElmSharp.Wearable
             get
             {
                 int r, g, b, a;
-                Interop.Eext.eext_circle_object_item_color_get(circleHandle, "vertical,scroll,bg", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "vertical,scroll,bg", out r, out g, out b, out a);
                 return new Color(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(circleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -71,11 +89,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "vertical,scroll,bg");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "vertical,scroll,bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "vertical,scroll,bg", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "vertical,scroll,bg", value);
             }
         }
 
@@ -86,11 +104,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "vertical,scroll,bg");
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "vertical,scroll,bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "vertical,scroll,bg", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "vertical,scroll,bg", value);
             }
         }
 
@@ -102,12 +120,12 @@ namespace ElmSharp.Wearable
             get
             {
                 int r, g, b, a;
-                Interop.Eext.eext_circle_object_item_color_get(circleHandle, "default", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a);
                 return new Color(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(circleHandle, "default", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -118,11 +136,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "default");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "default", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
             }
         }
 
@@ -133,11 +151,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default");
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
             }
         }
 
@@ -153,14 +171,14 @@ namespace ElmSharp.Wearable
             get
             {
                 int policy;
-                Interop.Eext.eext_circle_object_genlist_scroller_policy_get(circleHandle, IntPtr.Zero, out policy);
+                Interop.Eext.eext_circle_object_genlist_scroller_policy_get(CircleHandle, IntPtr.Zero, out policy);
                 return (ScrollBarVisiblePolicy)policy;
             }
             set
             {
                 int h;
-                Interop.Eext.eext_circle_object_genlist_scroller_policy_get(circleHandle, out h, IntPtr.Zero);
-                Interop.Eext.eext_circle_object_genlist_scroller_policy_set(circleHandle, (int)h, (int)value);
+                Interop.Eext.eext_circle_object_genlist_scroller_policy_get(CircleHandle, out h, IntPtr.Zero);
+                Interop.Eext.eext_circle_object_genlist_scroller_policy_set(CircleHandle, (int)h, (int)value);
             }
         }
 
@@ -172,36 +190,7 @@ namespace ElmSharp.Wearable
         protected override IntPtr CreateHandle(EvasObject parent)
         {
             var handle = base.CreateHandle(parent);
-
-            IntPtr surface = IntPtr.Zero;
-
-            if (parent is Conformant)
-            {
-                surface = Interop.Eext.eext_circle_surface_conformant_add(parent);
-            }
-            else if (parent is Naviframe)
-            {
-                surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
-            }
-            else if (parent is Layout)
-            {
-                surface = Interop.Eext.eext_circle_surface_layout_add(parent);
-            }
-
-            circleHandle = Interop.Eext.eext_circle_object_genlist_add(RealHandle, surface);
-            if (surface == IntPtr.Zero)
-            {
-                EvasObject p = parent;
-                while(!(p is Window))
-                {
-                    p = p.Parent;
-                }
-                var w = (p as Window).ScreenSize.Width;
-                var h = (p as Window).ScreenSize.Height;
-                Interop.Evas.evas_object_resize(circleHandle, w, h);
-            }
-
-            Interop.Eext.eext_rotary_object_event_activated_set(circleHandle, true);
+            _circleHandle = Interop.Eext.eext_circle_object_genlist_add(RealHandle == IntPtr.Zero ? Handle : RealHandle, CircleSurface.Handle);
 
             return handle;
         }
index bd6a98b..f4d7cbf 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 using System;
+using System.Diagnostics;
 
 namespace ElmSharp.Wearable
 {
@@ -22,16 +23,46 @@ namespace ElmSharp.Wearable
     /// <summary>
     /// The Circle ProgressBar is a widget for visually representing the progress status of a given job/task with the circular design.
     /// </summary>
-    public class CircleProgressBar : EvasObject
+    public class CircleProgressBar : Widget, ICircleWidget
     {
+        CircleSurface _surface;
+
         /// <summary>
         /// Creates and initializes a new instance of the Circle Progressbar class.
         /// </summary>
         /// <param name="parent">The parent of new Circle Progressbar instance</param>
-        public CircleProgressBar(EvasObject parent) : base(parent)
+        /// <param name="surface">The surface for drawing circle features for this widget.</param>
+        public CircleProgressBar(EvasObject parent, CircleSurface surface) : base()
         {
+            Debug.Assert(parent == null || surface == null || parent.IsRealized);
+            _surface = surface;
+            Realize(parent);
         }
 
+        /// <summary>
+        /// Gets the handle for Circle Widget.
+        /// </summary>
+        public virtual IntPtr CircleHandle => Handle;
+
+        /// <summary>
+        /// Gets the handle for Circle Surface used in this widget
+        /// </summary>
+        public virtual CircleSurface CircleSurface => _surface;
+
+        /// <summary>
+        /// Sets or gets the state of the widget, which might be enabled or disabled.
+        /// </summary>
+        public override bool IsEnabled
+        {
+            get
+            {
+                return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
+            }
+            set
+            {
+                Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
+            }
+        }
 
         /// <summary>
         /// Sets or gets the value of ProgressBar.
@@ -40,11 +71,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_value_get(Handle);
+                return Interop.Eext.eext_circle_object_value_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_value_set(Handle, value);
+                Interop.Eext.eext_circle_object_value_set(CircleHandle, value);
             }
         }
 
@@ -57,13 +88,13 @@ namespace ElmSharp.Wearable
             {
                 double max = 0;
                 double min = 0;
-                Interop.Eext.eext_circle_object_value_min_max_get(Handle, out min, out max);
+                Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
                 return max;
             }
             set
             {
                 double min = Minimum;
-                Interop.Eext.eext_circle_object_value_min_max_set(Handle, min, value);
+                Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, min, value);
             }
         }
 
@@ -76,13 +107,13 @@ namespace ElmSharp.Wearable
             {
                 double max = 0;
                 double min = 0;
-                Interop.Eext.eext_circle_object_value_min_max_get(Handle, out min, out max);
+                Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
                 return min;
             }
             set
             {
                 double max = Maximum;
-                Interop.Eext.eext_circle_object_value_min_max_set(Handle, value, max);
+                Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, value, max);
             }
         }
 
@@ -93,11 +124,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_angle_get(Handle);
+                return Interop.Eext.eext_circle_object_angle_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_angle_set(Handle, value);
+                Interop.Eext.eext_circle_object_angle_set(CircleHandle, value);
             }
         }
 
@@ -108,11 +139,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_angle_get(Handle, "bg");
+                return Interop.Eext.eext_circle_object_item_angle_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_angle_set(Handle, "bg", value);
+                Interop.Eext.eext_circle_object_item_angle_set(CircleHandle, "bg", value);
             }
         }
 
@@ -123,11 +154,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_angle_offset_get(Handle);
+                return Interop.Eext.eext_circle_object_angle_offset_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_angle_offset_set(Handle, value);
+                Interop.Eext.eext_circle_object_angle_offset_set(CircleHandle, value);
             }
         }
 
@@ -138,11 +169,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_angle_offset_get(Handle, "bg");
+                return Interop.Eext.eext_circle_object_item_angle_offset_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_angle_offset_set(Handle, "bg", value);
+                Interop.Eext.eext_circle_object_item_angle_offset_set(CircleHandle, "bg", value);
             }
         }
 
@@ -155,13 +186,13 @@ namespace ElmSharp.Wearable
             {
                 double max = 0;
                 double min = 0;
-                Interop.Eext.eext_circle_object_angle_min_max_get(Handle, out min, out max);
+                Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
                 return max;
             }
             set
             {
                 double min = BarAngleMinimum;
-                Interop.Eext.eext_circle_object_angle_min_max_set(Handle, min, value);
+                Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, min, value);
             }
         }
 
@@ -174,28 +205,13 @@ namespace ElmSharp.Wearable
             {
                 double max = 0;
                 double min = 0;
-                Interop.Eext.eext_circle_object_angle_min_max_get(Handle, out min, out max);
+                Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
                 return min;
             }
             set
             {
                 double max = BarAngleMaximum;
-                Interop.Eext.eext_circle_object_angle_min_max_set(Handle, value, max);
-            }
-        }
-
-        /// <summary>
-        /// Sets or gets disable status of Circle ProgressBar.
-        /// </summary>
-        public bool Disabled
-        {
-            get
-            {
-                return Interop.Eext.eext_circle_object_disabled_get(Handle);
-            }
-            set
-            {
-                Interop.Eext.eext_circle_object_disabled_set(Handle, value);
+                Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, value, max);
             }
         }
 
@@ -210,19 +226,19 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_color_get(Handle, out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_color_get(CircleHandle, out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_color_set(Handle, value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_color_set(CircleHandle, value.R, value.G, value.B, value.A);
             }
         }
 
         /// <summary>
         /// Sets or gets color of Background ProgressBar.
         /// </summary>
-        public Color BackgroundColor
+        public override Color BackgroundColor
         {
             get
             {
@@ -230,12 +246,12 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_item_color_get(Handle, "bg", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "bg", out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(Handle, "bg", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "bg", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -246,11 +262,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_line_width_get(Handle); ;
+                return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_line_width_set(Handle, value);
+                Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
             }
         }
 
@@ -261,11 +277,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(Handle, "bg");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(Handle, "bg", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "bg", value);
             }
         }
 
@@ -276,11 +292,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_radius_get(Handle); ;
+                return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_radius_set(Handle, value);
+                Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
             }
         }
 
@@ -291,11 +307,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(Handle, "bg"); ;
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(Handle, "bg", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "bg", value);
             }
         }
 
@@ -306,36 +322,7 @@ namespace ElmSharp.Wearable
         /// <returns>Handle IntPtr</returns>
         protected override IntPtr CreateHandle(EvasObject parent)
         {
-            IntPtr surface = IntPtr.Zero;
-
-            if (parent is Conformant)
-            {
-                surface = Interop.Eext.eext_circle_surface_conformant_add(parent.Handle);
-            }
-            else if (parent is Layout)
-            {
-                surface = Interop.Eext.eext_circle_surface_layout_add(parent.Handle);
-            }
-            else if (parent is Naviframe)
-            {
-                surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
-            }
-
-            var handle = Interop.Eext.eext_circle_object_progressbar_add(parent.Handle, surface);
-            if (surface == IntPtr.Zero)
-            {
-                EvasObject p = parent;
-                while (!(p is Window))
-                {
-                    p = p.Parent;
-                }
-                var w = (p as Window).ScreenSize.Width;
-                var h = (p as Window).ScreenSize.Height;
-                Interop.Evas.evas_object_resize(handle, w, h);
-            }
-
-            Interop.Eext.eext_rotary_object_event_activated_set(handle, true);
-            return handle;
+            return Interop.Eext.eext_circle_object_progressbar_add(parent, CircleSurface.Handle);
         }
     }
 }
\ No newline at end of file
index cd3a3c3..e60f31e 100644 (file)
  */
 
 using System;
+using System.Diagnostics;
 
 namespace ElmSharp.Wearable
 {
     /// <summary>
     /// Circle scroller provides scrollbar with circular movement and is scrolled by rotary event.
     /// </summary>
-    public class CircleScroller : Scroller
+    public class CircleScroller : Scroller, IRotaryActionWidget
     {
-        private IntPtr _circleHandle;
+        IntPtr _circleHandle;
+        CircleSurface _surface;
 
         /// <summary>
         /// Creates and initializes a new instance of the CircleScroller class.
         /// </summary>
         /// <param name="parent">The <see cref="EvasObject"/> to which the new CircleScroller will be attached as a child.</param>
-        public CircleScroller(EvasObject parent) : base(parent)
+        /// <param name="surface">The surface for drawing circle features for this widget.</param>
+        public CircleScroller(EvasObject parent, CircleSurface surface) : base()
         {
+            Debug.Assert(parent == null || surface == null || parent.IsRealized);
+            _surface = surface;
+            Realize(parent);
         }
 
         /// <summary>
-        /// Sets or gets disabled state of the circle scroller object.
+        /// Gets the handle for Circle Widget.
         /// </summary>
-        public bool Disabled
+        public virtual IntPtr CircleHandle => _circleHandle;
+
+        /// <summary>
+        /// Gets the handle for Circle Surface used in this widget
+        /// </summary>
+        public virtual CircleSurface CircleSurface => _surface;
+
+        /// <summary>
+        /// Sets or gets the state of the widget, which might be enabled or disabled.
+        /// </summary>
+        public override bool IsEnabled
         {
             get
             {
-                return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); ;
+                return !Interop.Eext.eext_circle_object_disabled_get(Handle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value);
+                Interop.Eext.eext_circle_object_disabled_set(Handle, !value);
             }
         }
 
@@ -60,13 +76,13 @@ namespace ElmSharp.Wearable
             get
             {
                 int policy;
-                Interop.Eext.eext_circle_object_scroller_policy_get(_circleHandle, out policy, IntPtr.Zero);
+                Interop.Eext.eext_circle_object_scroller_policy_get(CircleHandle, out policy, IntPtr.Zero);
                 return (ScrollBarVisiblePolicy)policy;
             }
             set
             {
                 ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy;
-                Interop.Eext.eext_circle_object_scroller_policy_set(_circleHandle, (int)value, (int)v);
+                Interop.Eext.eext_circle_object_scroller_policy_set(CircleHandle, (int)value, (int)v);
             }
         }
 
@@ -82,13 +98,13 @@ namespace ElmSharp.Wearable
             get
             {
                 int policy;
-                Interop.Eext.eext_circle_object_scroller_policy_get(_circleHandle, IntPtr.Zero, out policy);
+                Interop.Eext.eext_circle_object_scroller_policy_get(CircleHandle, IntPtr.Zero, out policy);
                 return (ScrollBarVisiblePolicy)policy;
             }
             set
             {
                 ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy;
-                Interop.Eext.eext_circle_object_scroller_policy_set(_circleHandle, (int)h, (int)value);
+                Interop.Eext.eext_circle_object_scroller_policy_set(CircleHandle, (int)h, (int)value);
             }
         }
 
@@ -103,12 +119,12 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_color_get(_circleHandle, out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_color_get(CircleHandle, out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_color_set(_circleHandle, value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_color_set(CircleHandle, value.R, value.G, value.B, value.A);
             }
         }
 
@@ -123,12 +139,12 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "horizontal,scroll,bar", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "horizontal,scroll,bar", out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "horizontal,scroll,bar", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "horizontal,scroll,bar", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -143,12 +159,12 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "vertical,scroll,bg", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "vertical,scroll,bg", out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -163,12 +179,12 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "horizontal,scroll,bg", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "horizontal,scroll,bg", out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "horizontal,scroll,bg", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "horizontal,scroll,bg", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -179,11 +195,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_line_width_get(_circleHandle); ;
+                return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_line_width_set(_circleHandle, value);
+                Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
             }
         }
 
@@ -194,11 +210,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "horizontal,scroll,bar");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "horizontal,scroll,bar");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "horizontal,scroll,bar", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "horizontal,scroll,bar", value);
             }
         }
 
@@ -209,11 +225,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "vertical,scroll,bg");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "vertical,scroll,bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "vertical,scroll,bg", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "vertical,scroll,bg", value);
             }
         }
 
@@ -224,11 +240,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "horizontal,scroll,bg");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "horizontal,scroll,bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "horizontal,scroll,bg", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "horizontal,scroll,bg", value);
             }
         }
 
@@ -239,11 +255,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_radius_get(_circleHandle); ;
+                return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_radius_set(_circleHandle, value);
+                Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
             }
         }
 
@@ -254,11 +270,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "horizontal,scroll,bar"); ;
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "horizontal,scroll,bar");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "horizontal,scroll,bar", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "horizontal,scroll,bar", value);
             }
         }
 
@@ -269,11 +285,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "vertical,scroll,bg"); ;
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "vertical,scroll,bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "vertical,scroll,bg", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "vertical,scroll,bg", value);
             }
         }
 
@@ -284,11 +300,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "horizontal,scroll,bg"); ;
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "horizontal,scroll,bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "horizontal,scroll,bg", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "horizontal,scroll,bg", value);
             }
         }
 
@@ -300,33 +316,7 @@ namespace ElmSharp.Wearable
         protected override IntPtr CreateHandle(EvasObject parent)
         {
             IntPtr handle = base.CreateHandle(parent);
-            IntPtr surface = IntPtr.Zero;
-            if (parent is Conformant)
-            {
-                surface = Interop.Eext.eext_circle_surface_conformant_add(parent);
-            }
-            else if (parent is Layout)
-            {
-                surface = Interop.Eext.eext_circle_surface_layout_add(parent);
-            }
-            else if (parent is Naviframe)
-            {
-                surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
-            }
-
-            _circleHandle = Interop.Eext.eext_circle_object_scroller_add(RealHandle, surface);
-            if (surface == IntPtr.Zero)
-            {
-                EvasObject p = parent;
-                while (!(p is Window))
-                {
-                    p = p.Parent;
-                }
-                var w = (p as Window).ScreenSize.Width;
-                var h = (p as Window).ScreenSize.Height;
-                Interop.Evas.evas_object_resize(_circleHandle, w, h);
-            }
-            Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true);
+            _circleHandle = Interop.Eext.eext_circle_object_scroller_add(RealHandle == IntPtr.Zero ? Handle : RealHandle, CircleSurface.Handle);
             return handle;
         }
     }
index 48f86a1..06bd53b 100755 (executable)
  */
 
 using System;
+using System.Diagnostics;
 
 namespace ElmSharp.Wearable
 {
     /// <summary>
     /// Circle slider is circular designed widget to select a value in a range by rotary event.
     /// </summary>
-    public class CircleSlider : EvasObject
+    public class CircleSlider : Widget, IRotaryActionWidget
     {
-        /// <summary>
-        /// Changed will be triggered when the circle slider value changes.
-        /// </summary>
-        public event EventHandler Changed;
-
         SmartEvent _changedEvent;
+        CircleSurface _surface;
 
         /// <summary>
         /// Creates and initializes a new instance of the CircleSlider class.
         /// </summary>
         /// <param name="parent">The EvasObject to which the new CircleSlider will be attached as a child.</param>
-        public CircleSlider(EvasObject parent) : base(parent)
+        /// <param name="surface">The surface for drawing circle features for this widget.</param>
+        public CircleSlider(EvasObject parent, CircleSurface surface) : base()
         {
-            _changedEvent = new SmartEvent(this, "value,changed");
-
-            _changedEvent.On += (s, e) => Changed?.Invoke(this, EventArgs.Empty);
+            Debug.Assert(parent == null || surface == null || parent.IsRealized);
+            _surface = surface;
+            Realize(parent);
         }
 
         /// <summary>
+        /// Changed will be triggered when the circle slider value changes.
+        /// </summary>
+        public event EventHandler ValueChanged;
+
+        /// <summary>
+        /// Gets the handle for Circle Widget.
+        /// </summary>
+        public virtual IntPtr CircleHandle => RealHandle;
+
+        /// <summary>
+        /// Gets the handle for Circle Surface used in this widget
+        /// </summary>
+        public virtual CircleSurface CircleSurface => _surface;
+
+        /// <summary>
         /// Sets or gets the step by which the circle slider bar moves.
         /// </summary>
         /// <remarks>
@@ -52,26 +65,26 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_slider_step_get(RealHandle);
+                return Interop.Eext.eext_circle_object_slider_step_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_slider_step_set(RealHandle, (double)value);
+                Interop.Eext.eext_circle_object_slider_step_set(CircleHandle, (double)value);
             }
         }
 
         /// <summary>
-        /// Sets or gets disabled state of the circle slider object.
+        /// Sets or gets the state of the widget, which might be enabled or disabled.
         /// </summary>
-        public bool Disabled
+        public override bool IsEnabled
         {
             get
             {
-                return Interop.Eext.eext_circle_object_disabled_get(RealHandle); ;
+                return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_disabled_set(RealHandle, value);
+                Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
             }
         }
 
@@ -86,19 +99,19 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_color_get(RealHandle, out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_color_get(CircleHandle, out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_color_set(RealHandle, value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_color_set(CircleHandle, value.R, value.G, value.B, value.A);
             }
         }
 
         /// <summary>
         /// Sets or gets color of the circle slider background.
         /// </summary>
-        public Color BackgroundColor
+        public override Color BackgroundColor
         {
             get
             {
@@ -106,12 +119,12 @@ namespace ElmSharp.Wearable
                 int g = 0;
                 int b = 0;
                 int a = 0;
-                Interop.Eext.eext_circle_object_item_color_get(RealHandle, "bg", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "bg", out r, out g, out b, out a);
                 return Color.FromRgba(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(RealHandle, "bg", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "bg", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -122,11 +135,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_line_width_get(RealHandle); ;
+                return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_line_width_set(RealHandle, value);
+                Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
             }
         }
 
@@ -137,11 +150,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(RealHandle, "bg");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(RealHandle, "bg", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "bg", value);
             }
         }
 
@@ -152,11 +165,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_angle_get(RealHandle); ;
+                return Interop.Eext.eext_circle_object_angle_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_angle_set(RealHandle, value);
+                Interop.Eext.eext_circle_object_angle_set(CircleHandle, value);
             }
         }
 
@@ -167,11 +180,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_angle_get(RealHandle, "bg");
+                return Interop.Eext.eext_circle_object_item_angle_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_angle_set(RealHandle, "bg", value);
+                Interop.Eext.eext_circle_object_item_angle_set(CircleHandle, "bg", value);
             }
         }
 
@@ -183,11 +196,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_angle_offset_get(RealHandle); ;
+                return Interop.Eext.eext_circle_object_angle_offset_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_angle_offset_set(RealHandle, value);
+                Interop.Eext.eext_circle_object_angle_offset_set(CircleHandle, value);
             }
         }
 
@@ -199,11 +212,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_angle_offset_get(RealHandle, "bg");
+                return Interop.Eext.eext_circle_object_item_angle_offset_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_angle_offset_set(RealHandle, "bg", value);
+                Interop.Eext.eext_circle_object_item_angle_offset_set(CircleHandle, "bg", value);
             }
         }
 
@@ -216,13 +229,13 @@ namespace ElmSharp.Wearable
             {
                 double min;
                 double max;
-                Interop.Eext.eext_circle_object_angle_min_max_get(RealHandle, out min, out max);
+                Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
                 return min;
             }
             set
             {
                 double max = BarAngleMaximum;
-                Interop.Eext.eext_circle_object_angle_min_max_set(RealHandle, (double)value, max);
+                Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, (double)value, max);
             }
         }
 
@@ -235,13 +248,13 @@ namespace ElmSharp.Wearable
             {
                 double min;
                 double max;
-                Interop.Eext.eext_circle_object_angle_min_max_get(RealHandle, out min, out max);
+                Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
                 return max;
             }
             set
             {
                 double min = BarAngleMinimum;
-                Interop.Eext.eext_circle_object_angle_min_max_set(RealHandle, min, (double)value);
+                Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, min, (double)value);
             }
         }
 
@@ -259,13 +272,13 @@ namespace ElmSharp.Wearable
             {
                 double min;
                 double max;
-                Interop.Eext.eext_circle_object_value_min_max_get(RealHandle, out min, out max);
+                Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
                 return min;
             }
             set
             {
                 double max = Maximum;
-                Interop.Eext.eext_circle_object_value_min_max_set(RealHandle, (double)value, max);
+                Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, (double)value, max);
             }
         }
 
@@ -284,13 +297,13 @@ namespace ElmSharp.Wearable
             {
                 double min;
                 double max;
-                Interop.Eext.eext_circle_object_value_min_max_get(RealHandle, out min, out max);
+                Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
                 return max;
             }
             set
             {
                 double min = Minimum;
-                Interop.Eext.eext_circle_object_value_min_max_set(RealHandle, min, (double)value);
+                Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, min, (double)value);
             }
         }
 
@@ -304,11 +317,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_value_get(RealHandle);
+                return Interop.Eext.eext_circle_object_value_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_value_set(RealHandle, (double)value);
+                Interop.Eext.eext_circle_object_value_set(CircleHandle, (double)value);
             }
         }
 
@@ -319,11 +332,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_radius_get(RealHandle); ;
+                return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_radius_set(RealHandle, value);
+                Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
             }
         }
 
@@ -334,50 +347,32 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(RealHandle, "bg"); ;
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "bg");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(RealHandle, "bg", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "bg", value);
             }
         }
 
         /// <summary>
+        /// The callback of Realized Event
+        /// </summary>
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            _changedEvent = new SmartEvent(this, "value,changed");
+            _changedEvent.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
+        }
+
+        /// <summary>
         /// Creates a widget handle.
         /// </summary>
         /// <param name="parent">Parent EvasObject</param>
         /// <returns>Handle IntPtr</returns>
         protected override IntPtr CreateHandle(EvasObject parent)
         {
-            IntPtr surface = IntPtr.Zero;
-            if (parent is Conformant)
-            {
-                surface = Interop.Eext.eext_circle_surface_conformant_add(parent);
-            }
-            else if (parent is Layout)
-            {
-                surface = Interop.Eext.eext_circle_surface_layout_add(parent);
-            }
-            else if (parent is Naviframe)
-            {
-                surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
-            }
-
-            IntPtr handle = Interop.Eext.eext_circle_object_slider_add(parent, surface);
-            if (surface == IntPtr.Zero)
-            {
-                EvasObject p = parent;
-                while (!(p is Window))
-                {
-                    p = p.Parent;
-                }
-                var w = (p as Window).ScreenSize.Width;
-                var h = (p as Window).ScreenSize.Height;
-                Interop.Evas.evas_object_resize(handle, w, h);
-            }
-
-            Interop.Eext.eext_rotary_object_event_activated_set(handle, true);
-            return handle;
+            return Interop.Eext.eext_circle_object_slider_add(parent, CircleSurface.Handle);
         }
     }
 }
\ No newline at end of file
index fbc84d7..e66fa54 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 using System;
+using System.Diagnostics;
 
 namespace ElmSharp.Wearable
 {
@@ -23,20 +24,35 @@ namespace ElmSharp.Wearable
     /// The Circle Spinner is a widget to display and handle spinner value by rotary event
     /// Inherits <see cref="Spinner"/>.
     /// </summary>
-    public class CircleSpinner : Spinner
+    public class CircleSpinner : Spinner, IRotaryActionWidget
     {
-        private IntPtr _circleHandle;
-        private double _angleRatio = 1.0;
+        IntPtr _circleHandle;
+        double _angleRatio = 1.0;
+        CircleSurface _surface;
 
         /// <summary>
         /// Creates and initializes a new instance of the Circle Spinner class.
         /// </summary>
         /// <param name="parent">The parent of new Circle Spinner instance</param>
-        public CircleSpinner(EvasObject parent) : base(parent)
+        /// <param name="surface">The surface for drawing circle features for this widget.</param>
+        public CircleSpinner(EvasObject parent, CircleSurface surface) : base()
         {
+            Debug.Assert(parent == null || surface == null || parent.IsRealized);
+            _surface = surface;
+            Realize(parent);
         }
 
         /// <summary>
+        /// Gets the handle for Circle Widget.
+        /// </summary>
+        public virtual IntPtr CircleHandle => RealHandle;
+
+        /// <summary>
+        /// Gets the handle for Circle Surface used in this widget
+        /// </summary>
+        public virtual CircleSurface CircleSurface => _surface;
+
+        /// <summary>
         /// Sets or gets the circle spinner angle per each spinner value.
         /// </summary>
         public double AngleRatio
@@ -48,22 +64,22 @@ namespace ElmSharp.Wearable
             set
             {
                 _angleRatio = value;
-                Interop.Eext.eext_circle_object_spinner_angle_set(_circleHandle, _angleRatio);
+                Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
             }
         }
 
         /// <summary>
-        /// Sets or gets disabled state of the circle spinner object.
+        /// Sets or gets the state of the widget, which might be enabled or disabled.
         /// </summary>
-        public bool Disabled
+        public override bool IsEnabled
         {
             get
             {
-                return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); ;
+                return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
             }
             set
             {
-                Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value);
+                Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
             }
         }
 
@@ -74,11 +90,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "default");
+                return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "default", value);
+                Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
             }
         }
 
@@ -90,12 +106,12 @@ namespace ElmSharp.Wearable
             get
             {
                 int r, g, b, a;
-                Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "default", out r, out g, out b, out a);
+                Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a);
                 return new Color(r, g, b, a);
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "default", value.R, value.G, value.B, value.A);
+                Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
             }
         }
 
@@ -106,11 +122,11 @@ namespace ElmSharp.Wearable
         {
             get
             {
-                return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "default");
+                return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
             }
             set
             {
-                Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "default", value);
+                Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
             }
         }
 
@@ -122,36 +138,7 @@ namespace ElmSharp.Wearable
         protected override IntPtr CreateHandle(EvasObject parent)
         {
             IntPtr handle = base.CreateHandle(parent);
-
-            IntPtr surface = IntPtr.Zero;
-
-            if (parent is Conformant)
-            {
-                surface = Interop.Eext.eext_circle_surface_conformant_add(parent.Handle);
-            }
-            else if (parent is Naviframe)
-            {
-                surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
-            }
-            else if (parent is Layout)
-            {
-                surface = Interop.Eext.eext_circle_surface_layout_add(parent.Handle);
-            }
-
-            _circleHandle = Interop.Eext.eext_circle_object_spinner_add(RealHandle, surface);
-            if (surface == IntPtr.Zero)
-            {
-                EvasObject p = parent;
-                while (!(p is Window))
-                {
-                    p = p.Parent;
-                }
-                var w = (p as Window).ScreenSize.Width;
-                var h = (p as Window).ScreenSize.Height;
-                Interop.Evas.evas_object_resize(_circleHandle, w, h);
-            }
-
-            Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true);
+            _circleHandle = Interop.Eext.eext_circle_object_spinner_add(RealHandle == IntPtr.Zero ? Handle : RealHandle, CircleSurface.Handle);
             return handle;
         }
     }
diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSurface.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSurface.cs
new file mode 100644 (file)
index 0000000..91da5a1
--- /dev/null
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Wearable
+{
+    /// <summary>
+    /// The CircleSurface presents a surface for drawing circular feature of circle widgets
+    /// </summary>
+    public class CircleSurface
+    {
+        IntPtr _handle;
+
+        /// <summary>
+        /// Creates and initializes a new instance of the CircleSurface class with surface on the Conformant widget.
+        /// </summary>
+        /// <param name="conformant">Conformant widget to create a surface.</param>
+        public CircleSurface(Conformant conformant)
+        {
+            _handle = Interop.Eext.eext_circle_surface_conformant_add(conformant);
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of the CircleSurface class with surface on the Layout widget.
+        /// </summary>
+        /// <param name="layout">Layout widget to create a surface.</param>
+        public CircleSurface(Layout layout)
+        {
+            _handle = Interop.Eext.eext_circle_surface_layout_add(layout);
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of the CircleSurface class with surface on the Naviframe widget.
+        /// </summary>
+        /// <param name="naviframe">Naviframe widget to create a surface.</param>
+        public CircleSurface(Naviframe naviframe)
+        {
+            _handle = Interop.Eext.eext_circle_surface_naviframe_add(naviframe);
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of the CircleSurface class with no surface
+        /// </summary>
+        public CircleSurface()
+        {
+            _handle = IntPtr.Zero;
+        }
+
+        public IntPtr Handle => _handle;
+    }
+}
diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/ICircleWidget.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/ICircleWidget.cs
new file mode 100644 (file)
index 0000000..17cdf42
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Wearable
+{
+    /// <summary>
+    /// The ICircleWidget is the interface for a widget to display and handle with circle surface
+    /// </summary>
+    public interface ICircleWidget
+    {
+        /// <summary>
+        /// Gets the handle for Circle Widget.
+        /// </summary>
+        IntPtr CircleHandle { get; }
+
+        /// <summary>
+        /// Gets the CircleSurface used in this widget
+        /// </summary>
+        CircleSurface CircleSurface { get; }
+    }
+
+    /// <summary>
+    /// The IRotaryActionWidget is the interface for a widget has action by rotary event
+    /// </summary>
+    public interface IRotaryActionWidget : ICircleWidget
+    {
+    }
+}
index 6b34fde..f413ae4 100644 (file)
@@ -67,7 +67,7 @@ namespace ElmSharp.Wearable
     /// <summary>
     /// RotaryEventManager serve extension functions for Rotary event to EvasObject on device like Galaxy Gear.
     /// </summary>
-    public static class EvasObjectExtensions
+    public static class RotaryEventExtensions
     {
         static Dictionary<EvasObject, RotaryEventHandler> s_rotaryObjectEventHandlers = new Dictionary<EvasObject, RotaryEventHandler>();
         static Dictionary<EvasObject, Interop.Eext.Eext_Rotary_Event_Cb> s_rotaryObjectEventMap = new Dictionary<EvasObject, Interop.Eext.Eext_Rotary_Event_Cb>();
@@ -110,6 +110,24 @@ namespace ElmSharp.Wearable
         }
 
         /// <summary>
+        /// Activate this circle widget can take Rotary event.
+        /// </summary>
+        /// <param name="widget">Target circle widget</param>
+        public static void Activate(this IRotaryActionWidget widget)
+        {
+            Interop.Eext.eext_rotary_object_event_activated_set(widget.CircleHandle, true);
+        }
+
+        /// <summary>
+        /// Deactivate this circle widget is blocked from Rotary event.
+        /// </summary>
+        /// <param name="widget">Target circle widget</param>
+        public static void Deactivate(this IRotaryActionWidget widget)
+        {
+            Interop.Eext.eext_rotary_object_event_activated_set(widget.CircleHandle, false);
+        }
+
+        /// <summary>
         /// Activate this object can take Rotary event.
         /// </summary>
         /// <param name="obj">Target object</param>
index 135c3d3..b7e0e33 100755 (executable)
@@ -39,6 +39,13 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// Creates and initializes a new instance of Container class.
+        /// </summary>
+        protected Container() : base()
+        {
+        }
+
+        /// <summary>
         /// Sets the background color of a given Container.
         /// </summary>
         public override Color BackgroundColor
index 98d2cbe..c159804 100755 (executable)
@@ -67,13 +67,13 @@ namespace ElmSharp
         ///as a child.It's <see cref="EvasObject"/> type.</param>
         public DateTimeSelector(EvasObject parent) : base(parent)
         {
-            _changed = new SmartEvent(this, this.RealHandle, "changed");
-            _changed.On += (s, e) =>
-            {
-                DateTime newDateTime = DateTime;
-                DateTimeChanged?.Invoke(this, new DateChangedEventArgs(_cacheDateTime, newDateTime));
-                DateTime = newDateTime;
-            };
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of DateTimeSelector class.
+        /// </summary>
+        protected DateTimeSelector() : base()
+        {
         }
 
         /// <summary>
@@ -189,6 +189,21 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// The callback of Realized Event
+        /// </summary>
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            _changed = new SmartEvent(this, this.RealHandle, "changed");
+            _changed.On += (s, e) =>
+            {
+                DateTime newDateTime = DateTime;
+                DateTimeChanged?.Invoke(this, new DateChangedEventArgs(_cacheDateTime, newDateTime));
+                DateTime = newDateTime;
+            };
+        }
+
+        /// <summary>
         /// Creates a widget handle.
         /// </summary>
         /// <param name="parent">Parent EvasObject</param>
index 7afb41c..82730d1 100755 (executable)
@@ -155,8 +155,13 @@ namespace ElmSharp
         /// <param name="parent">The parent is a given container which will be attached by GenList as a child. It's <see cref="EvasObject"/> type.</param>
         public GenList(EvasObject parent) : base(parent)
         {
-            ListMode = GenListMode.Compress;
-            InitializeSmartEvent();
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of GenList class.
+        /// </summary>
+        protected GenList() : base()
+        {
         }
 
         /// <summary>
@@ -712,6 +717,16 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// The callback of Unrealize Event
+        /// </summary>
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            ListMode = GenListMode.Compress;
+            InitializeSmartEvent();
+        }
+
+        /// <summary>
         /// Creates a widget handle.
         /// </summary>
         /// <param name="parent">Parent EvasObject</param>
index 4e7b294..d5716e1 100644 (file)
@@ -35,17 +35,13 @@ namespace ElmSharp
         /// <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>
         public Layout(EvasObject parent) : base(parent)
         {
-            _languageChanged = new SmartEvent(this, this.RealHandle, "language,changed");
-            _languageChanged.On += (s, e) =>
-            {
-                LanguageChanged?.Invoke(this, EventArgs.Empty);
-            };
+        }
 
-            _themeChanged = new SmartEvent(this, this.RealHandle, "theme,changed");
-            _themeChanged.On += (s, e) =>
-            {
-                ThemeChanged?.Invoke(this, EventArgs.Empty);
-            };
+        /// <summary>
+        /// Creates and initializes a new instance of Layout class.
+        /// </summary>
+        protected Layout() : base()
+        {
         }
 
         /// <summary>
@@ -340,6 +336,25 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// The callback of Realized Event
+        /// </summary>
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            _languageChanged = new SmartEvent(this, this.RealHandle, "language,changed");
+            _languageChanged.On += (s, e) =>
+            {
+                LanguageChanged?.Invoke(this, EventArgs.Empty);
+            };
+
+            _themeChanged = new SmartEvent(this, this.RealHandle, "theme,changed");
+            _themeChanged.On += (s, e) =>
+            {
+                ThemeChanged?.Invoke(this, EventArgs.Empty);
+            };
+        }
+
+        /// <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>
index 64079d1..cf7352e 100755 (executable)
@@ -97,10 +97,13 @@ namespace ElmSharp
         /// <param name="parent">The <see cref="EvasObject"/> to which the new Scroller will be attached as a child.</param>
         public Scroller(EvasObject parent) : base(parent)
         {
-            _scroll = new SmartEvent(this, this.RealHandle, "scroll");
-            _dragStart = new SmartEvent(this, this.RealHandle, "scroll,drag,start");
-            _dragStop = new SmartEvent(this, this.RealHandle, "scroll,drag,stop");
-            _scrollpage = new SmartEvent(this, this.RealHandle, "scroll,page,changed");
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of the Scroller class.
+        /// </summary>
+        public Scroller() : base()
+        {
         }
 
         /// <summary>
@@ -780,6 +783,15 @@ namespace ElmSharp
             }
         }
 
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            _scroll = new SmartEvent(this, this.RealHandle, "scroll");
+            _dragStart = new SmartEvent(this, this.RealHandle, "scroll,drag,start");
+            _dragStop = new SmartEvent(this, this.RealHandle, "scroll,drag,stop");
+            _scrollpage = new SmartEvent(this, this.RealHandle, "scroll,page,changed");
+        }
+
         /// <summary>
         /// Creates a widget handle.
         /// </summary>
index 556de96..794aa32 100755 (executable)
@@ -36,11 +36,13 @@ namespace ElmSharp
         /// <param name="parent">The parent of new Spinner instance</param>
         public Spinner(EvasObject parent) : base(parent)
         {
-            _changed = new SmartEvent(this, this.RealHandle, "changed");
-            _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
+        }
 
-            _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed");
-            _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty);
+        /// <summary>
+        /// Creates and initializes a new instance of Layout class.
+        /// </summary>
+        protected Spinner() : base()
+        {
         }
 
         /// <summary>
@@ -241,6 +243,19 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// The callback of Realized Event
+        /// </summary>
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            _changed = new SmartEvent(this, this.RealHandle, "changed");
+            _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
+
+            _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed");
+            _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty);
+        }
+
+        /// <summary>
         /// Creates a widget handle.
         /// </summary>
         /// <param name="parent">Parent EvasObject</param>
index 040d132..6407888 100755 (executable)
@@ -83,11 +83,6 @@ namespace ElmSharp
         /// <param name="parent">The parent of new Widget instance</param>
         protected Widget(EvasObject parent) : base(parent)
         {
-            _focused = new SmartEvent(this, "focused");
-            _focused.On += (s, e) => Focused?.Invoke(this, EventArgs.Empty);
-
-            _unfocused = new SmartEvent(this, "unfocused");
-            _unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty);
         }
 
         /// <summary>
@@ -113,7 +108,7 @@ namespace ElmSharp
         /// <summary>
         /// Sets or gets the state of the widget, which might be enabled or disabled.
         /// </summary>
-        public bool IsEnabled
+        public virtual bool IsEnabled
         {
             get
             {
@@ -437,6 +432,19 @@ namespace ElmSharp
             return a;
         }
 
+        /// <summary>
+        /// The callback of Realized Event
+        /// </summary>
+        protected override void OnRealized()
+        {
+            base.OnRealized();
+            _focused = new SmartEvent(this, "focused");
+            _focused.On += (s, e) => Focused?.Invoke(this, EventArgs.Empty);
+
+            _unfocused = new SmartEvent(this, "unfocused");
+            _unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty);
+        }
+
         internal IntPtr GetPartContent(string part)
         {
             return Interop.Elementary.elm_object_part_content_get(RealHandle, part);
index 6880f41..949dee3 100755 (executable)
@@ -29,4 +29,4 @@
     <ProjectReference Include="..\..\src\Tizen\Tizen.csproj" />
   </ItemGroup>
 
-</Project>
\ No newline at end of file
+</Project>
index 4318a75..4ddaba3 100644 (file)
@@ -35,7 +35,9 @@ namespace ElmSharp.Test.TC
 
             conformant.SetContent(layout);
 
-            DateTimeSelector datetime = new CircleDateTimeSelector(conformant)
+            var surface = new CircleSurface(conformant);
+
+            DateTimeSelector datetime = new CircleDateTimeSelector(conformant, surface)
             {
                 MinimumDateTime = new DateTime(2015, 1, 1),
                 MaximumDateTime = DateTime.Now,
index 6e3bdf0..d27b4fc 100644 (file)
@@ -35,7 +35,9 @@ namespace ElmSharp.Test.TC
 
             conformant.SetContent(layout);
 
-            DateTimeSelector datetime = new CircleDateTimeSelector(conformant)
+            var surface = new CircleSurface(conformant);
+
+            DateTimeSelector datetime = new CircleDateTimeSelector(conformant, surface)
             {
                 DateTime = DateTime.Now,
                 Style = "timepicker/circle"
index 8ac1907..64ee69b 100644 (file)
@@ -35,11 +35,13 @@ namespace ElmSharp.Test.TC
 
             conformant.SetContent(layout);
 
-            DateTimeSelector datetime = new CircleDateTimeSelector(conformant)
+            var surface = new CircleSurface(conformant);
+
+            DateTimeSelector datetime = new CircleDateTimeSelector(conformant, surface)
             {
                 DateTime = DateTime.Now,
                 Style = "timepicker/circle",
-                Disabled = true
+                IsEnabled = false
             };
 
             layout.SetContent(datetime);
index 3a93ab5..5a81497 100644 (file)
@@ -35,7 +35,9 @@ namespace ElmSharp.Test.TC
 
             conformant.SetContent(layout);
 
-            DateTimeSelector datetime = new CircleDateTimeSelector(conformant)
+            var surface = new CircleSurface(conformant);
+
+            DateTimeSelector datetime = new CircleDateTimeSelector(conformant, surface)
             {
                 DateTime = DateTime.Now,
                 Style = "timepicker/circle",
index 03de32b..2443827 100644 (file)
@@ -28,7 +28,9 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-            var list = new CircleGenList(conformant)
+            var surface = new CircleSurface(conformant);
+
+            var list = new CircleGenList(conformant, surface)
             {
                 Homogeneous = true,
                 VerticalScrollBarColor = Color.Red,
index ff1e9fd..af50687 100644 (file)
@@ -32,7 +32,9 @@ namespace ElmSharp.Test.TC
             layout.Move(0, 0);
             layout.Resize(360, 360);
 
-            var list = new CircleGenList(layout)
+            var surface = new CircleSurface(layout);
+
+            var list = new CircleGenList(layout, surface)
             {
                 Homogeneous = true,
                 VerticalScrollBackgroundRadius = 165,
index 6dc5f53..ab8c62b 100644 (file)
@@ -32,11 +32,13 @@ namespace ElmSharp.Test.TC
 
             conformant.SetContent(naviframe);
 
-            var list = new CircleGenList(naviframe)
+            var surface = new CircleSurface(naviframe);
+
+            var list = new CircleGenList(naviframe, surface)
             {
                 Homogeneous = true,
                 VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
-                Disabled = true,
+                IsEnabled = false,
             };
 
             var item = naviframe.Push(list);
index d5190ab..184cb05 100644 (file)
@@ -25,7 +25,9 @@ namespace ElmSharp.Test.TC
 
         public override void Run(Window window)
         {
-            var list = new CircleGenList(window)
+            var surface = new CircleSurface();
+
+            var list = new CircleGenList(window, surface)
             {
                 Homogeneous = true,
                 VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
index a0bc3cb..221f321 100644 (file)
@@ -30,7 +30,9 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-            CircleProgressBar pb1 = new CircleProgressBar(conformant)
+            var surface = new CircleSurface(conformant);
+
+            CircleProgressBar pb1 = new CircleProgressBar(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index d41034d..d4e7629 100644 (file)
@@ -30,7 +30,8 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-            CircleProgressBar pb1 = new CircleProgressBar(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleProgressBar pb1 = new CircleProgressBar(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index 66a2ba6..b272be7 100644 (file)
@@ -30,7 +30,8 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-            CircleProgressBar pb1 = new CircleProgressBar(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleProgressBar pb1 = new CircleProgressBar(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index 9ff9d48..0675b0e 100644 (file)
@@ -30,7 +30,8 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-            CircleProgressBar pb1 = new CircleProgressBar(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleProgressBar pb1 = new CircleProgressBar(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
@@ -66,7 +67,7 @@ namespace ElmSharp.Test.TC
                 if (pb1.Value == pb1.Maximum/2)
                 {
                     // Test purpose : set disable
-                    pb1.Disabled = true;
+                    pb1.IsEnabled = false;
                 }
 
                 if (pb1.Value == pb1.Maximum)
index 21d7a33..9872c73 100644 (file)
@@ -29,7 +29,8 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-            CircleScroller circleScroller = new CircleScroller(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleScroller circleScroller = new CircleScroller(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index b968e53..5742f24 100644 (file)
@@ -31,7 +31,8 @@ namespace ElmSharp.Test.TC
             layout.Move(0, 0);
             layout.Resize(360, 360);
 
-            CircleScroller circleScroller = new CircleScroller(layout)
+            var surface = new CircleSurface(layout);
+            CircleScroller circleScroller = new CircleScroller(layout, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index 412e1e0..b9688a7 100644 (file)
@@ -31,7 +31,8 @@ namespace ElmSharp.Test.TC
 
             Naviframe naviframe = new Naviframe(conformant);
 
-            CircleScroller circleScroller = new CircleScroller(naviframe)
+            var surface = new CircleSurface(naviframe);
+            CircleScroller circleScroller = new CircleScroller(naviframe, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index 13a3db8..c81e01f 100644 (file)
@@ -26,8 +26,9 @@ namespace ElmSharp.Test.TC
 
         public override void Run(Window window)
         {
+            var surface = new CircleSurface();
 
-            CircleScroller circleScroller = new CircleScroller(window)
+            CircleScroller circleScroller = new CircleScroller(window, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
index 91a4cc2..12681c2 100644 (file)
@@ -28,8 +28,8 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-
-            CircleSlider circleSlider = new CircleSlider(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleSlider circleSlider = new CircleSlider(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
@@ -53,7 +53,7 @@ namespace ElmSharp.Test.TC
             label1.Move(170, window.ScreenSize.Height / 2 - 20);
             label1.Show();
 
-            circleSlider.Changed += (s, e) =>
+            circleSlider.ValueChanged += (s, e) =>
             {
                 label1.Text = string.Format("{0}", circleSlider.Value);
             };
index 9f0c262..179638e 100644 (file)
@@ -28,8 +28,8 @@ namespace ElmSharp.Test.TC
             Conformant conformant = new Conformant(window);
             conformant.Show();
 
-
-            CircleSlider circleSlider = new CircleSlider(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleSlider circleSlider = new CircleSlider(conformant, surface)
             {
                 AlignmentX = -1,
                 AlignmentY = -1,
@@ -75,7 +75,7 @@ namespace ElmSharp.Test.TC
 
             Log.Debug(TestName, "CircleSliderTest2 step:" + circleSlider.Step);
 
-            circleSlider.Changed += (s, e) =>
+            circleSlider.ValueChanged += (s, e) =>
             {
                 label1.Text = string.Format("{0:F1}", circleSlider.Value);
             };
index d67564e..5c6eabd 100644 (file)
@@ -33,7 +33,8 @@ namespace ElmSharp.Test.TC
             layout.SetTheme("layout", "circle", "spinner");
             conformant.SetContent(layout);
 
-            CircleSpinner spn1 = new CircleSpinner(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleSpinner spn1 = new CircleSpinner(conformant, surface)
             {
                 Text = "Spinner Test",
                 LabelFormat = "%d Value",
@@ -59,7 +60,7 @@ namespace ElmSharp.Test.TC
 
             btn.Clicked += (s, e) =>
             {
-                spn1.Disabled = true;
+                spn1.IsEnabled = false;
                 spn1.Text = "100 match";
                 spn1.Value = 0;
             };
index 59adefd..50db506 100644 (file)
@@ -33,7 +33,8 @@ namespace ElmSharp.Test.TC
             layout.SetTheme("layout", "circle", "spinner");
             conformant.SetContent(layout);
 
-            CircleSpinner spn1 = new CircleSpinner(conformant)
+            var surface = new CircleSurface(conformant);
+            CircleSpinner spn1 = new CircleSpinner(conformant, surface)
             {
                 Text = "Slider Test",
                 LabelFormat = "%d Value",