From b7de6bebc3e9715cf9ddd7c70a9cf36cd05b0555 Mon Sep 17 00:00:00 2001 From: "pius.lee" Date: Fri, 20 Oct 2017 20:36:51 +0900 Subject: [PATCH] Add CircleSurface and Change Every circle object Now Circle object use circle surface Change-Id: I16b0de180b20319f97c51983c9c20920939a4d12 --- src/ElmSharp.Wearable/ElmSharp.Wearable.sln | 26 +++- .../ElmSharp.Wearable/CircleDatetimeSelector.cs | 74 +++++------ .../ElmSharp.Wearable/CircleGenList.cs | 93 ++++++------- .../ElmSharp.Wearable/CircleProgressBar.cs | 143 +++++++++----------- .../ElmSharp.Wearable/CircleScroller.cs | 114 ++++++++-------- .../ElmSharp.Wearable/CircleSlider.cs | 147 ++++++++++----------- .../ElmSharp.Wearable/CircleSpinner.cs | 77 +++++------ .../ElmSharp.Wearable/CircleSurface.cs | 51 +++++++ .../ElmSharp.Wearable/ICircleWidget.cs | 29 ++++ .../ElmSharp.Wearable/RotaryEventManager.cs | 20 ++- src/ElmSharp/ElmSharp/Container.cs | 7 + src/ElmSharp/ElmSharp/DateTimeSelector.cs | 29 +++- src/ElmSharp/ElmSharp/GenList.cs | 19 ++- src/ElmSharp/ElmSharp/Layout.cs | 35 +++-- src/ElmSharp/ElmSharp/Scroller.cs | 20 ++- src/ElmSharp/ElmSharp/Spinner.cs | 23 +++- src/ElmSharp/ElmSharp/Widget.cs | 20 ++- test/ElmSharp.Test/ElmSharp.Test.csproj | 2 +- .../TC/CircleDateTimeSelectorTest1.cs | 4 +- .../TC/CircleDateTimeSelectorTest2.cs | 4 +- .../TC/CircleDateTimeSelectorTest3.cs | 6 +- .../TC/CircleDateTimeSelectorTest4.cs | 4 +- .../TC/CircleGenListTest1.cs | 4 +- .../TC/CircleGenListTest2.cs | 4 +- .../TC/CircleGenListTest3.cs | 6 +- .../TC/CircleGenListTest4.cs | 4 +- .../TC/CircleProgressBarTest1.cs | 4 +- .../TC/CircleProgressBarTest2.cs | 3 +- .../TC/CircleProgressBarTest3.cs | 3 +- .../TC/CircleProgressBarTest4.cs | 5 +- .../TC/CircleScrollerTest1.cs | 3 +- .../TC/CircleScrollerTest2.cs | 3 +- .../TC/CircleScrollerTest3.cs | 3 +- .../TC/CircleScrollerTest4.cs | 3 +- .../ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs | 6 +- .../ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs | 6 +- .../TC/CircleSpinnerTest1.cs | 5 +- .../TC/CircleSpinnerTest2.cs | 3 +- 38 files changed, 593 insertions(+), 419 deletions(-) create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSurface.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/ICircleWidget.cs diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable.sln b/src/ElmSharp.Wearable/ElmSharp.Wearable.sln index dbf2ebd..95835a9 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable.sln +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable.sln @@ -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 diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs index 6623984..851b135 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs @@ -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 /// - public class CircleDateTimeSelector : DateTimeSelector + public class CircleDateTimeSelector : DateTimeSelector, IRotaryActionWidget { - IntPtr circleHandle; + IntPtr _circleHandle; + CircleSurface _surface; /// /// Creates and initializes a new instance of the Circle DateTime class /// /// The parent of new Circle DateTime instance - public CircleDateTimeSelector(EvasObject parent) : base(parent) { } + /// The surface for drawing circle features for this widget. + public CircleDateTimeSelector(EvasObject parent, CircleSurface surface) : base() + { + Debug.Assert(parent == null || surface == null || parent.IsRealized); + _surface = surface; + Realize(parent); + } + + /// + /// Gets the handle for Circle Widget. + /// + public virtual IntPtr CircleHandle => _circleHandle; /// - /// Sets or gets the disabled state of the Circle DateTime Selector + /// Gets the handle for Circle Surface used in this widget /// - public bool Disabled + public virtual CircleSurface CircleSurface => _surface; + + /// + /// Sets or gets the state of the widget, which might be enabled or 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); } } @@ -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; } diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs index d5c31e3..1de98bd 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs @@ -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 /// - public class CircleGenList : GenList + public class CircleGenList : GenList, IRotaryActionWidget { - IntPtr circleHandle; + IntPtr _circleHandle; + CircleSurface _surface; /// /// Creates and initializes a new instance of the Circle GenList class /// /// The parent of new Circle GenList instance - public CircleGenList(EvasObject parent) : base(parent) { } + /// The surface for drawing circle features for this widget. + public CircleGenList(EvasObject parent, CircleSurface surface) : base() + { + Debug.Assert(parent == null || surface == null || parent.IsRealized); + _surface = surface; + Realize(parent); + } + + /// + /// Gets the handle for Circle Widget. + /// + public virtual IntPtr CircleHandle => _circleHandle; /// - /// Sets or gets the disabled state of the Circle GenList Selector + /// Gets the handle for Circle Surface used in this widget /// - public bool Disabled + public virtual CircleSurface CircleSurface => _surface; + + /// + /// Sets or gets the state of the widget, which might be enabled or 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); } } @@ -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; } diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs index bd6a98b..f4d7cbf 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs @@ -15,6 +15,7 @@ */ using System; +using System.Diagnostics; namespace ElmSharp.Wearable { @@ -22,16 +23,46 @@ namespace ElmSharp.Wearable /// /// The Circle ProgressBar is a widget for visually representing the progress status of a given job/task with the circular design. /// - public class CircleProgressBar : EvasObject + public class CircleProgressBar : Widget, ICircleWidget { + CircleSurface _surface; + /// /// Creates and initializes a new instance of the Circle Progressbar class. /// /// The parent of new Circle Progressbar instance - public CircleProgressBar(EvasObject parent) : base(parent) + /// The surface for drawing circle features for this widget. + public CircleProgressBar(EvasObject parent, CircleSurface surface) : base() { + Debug.Assert(parent == null || surface == null || parent.IsRealized); + _surface = surface; + Realize(parent); } + /// + /// Gets the handle for Circle Widget. + /// + public virtual IntPtr CircleHandle => Handle; + + /// + /// Gets the handle for Circle Surface used in this widget + /// + public virtual CircleSurface CircleSurface => _surface; + + /// + /// Sets or gets the state of the widget, which might be enabled or disabled. + /// + public override bool IsEnabled + { + get + { + return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle); + } + set + { + Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value); + } + } /// /// 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); - } - } - - /// - /// Sets or gets disable status of Circle ProgressBar. - /// - 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); } } /// /// Sets or gets color of Background ProgressBar. /// - 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 /// Handle IntPtr 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 diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs index cd3a3c3..e60f31e 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs @@ -15,36 +15,52 @@ */ using System; +using System.Diagnostics; namespace ElmSharp.Wearable { /// /// Circle scroller provides scrollbar with circular movement and is scrolled by rotary event. /// - public class CircleScroller : Scroller + public class CircleScroller : Scroller, IRotaryActionWidget { - private IntPtr _circleHandle; + IntPtr _circleHandle; + CircleSurface _surface; /// /// Creates and initializes a new instance of the CircleScroller class. /// /// The to which the new CircleScroller will be attached as a child. - public CircleScroller(EvasObject parent) : base(parent) + /// The surface for drawing circle features for this widget. + public CircleScroller(EvasObject parent, CircleSurface surface) : base() { + Debug.Assert(parent == null || surface == null || parent.IsRealized); + _surface = surface; + Realize(parent); } /// - /// Sets or gets disabled state of the circle scroller object. + /// Gets the handle for Circle Widget. /// - public bool Disabled + public virtual IntPtr CircleHandle => _circleHandle; + + /// + /// Gets the handle for Circle Surface used in this widget + /// + public virtual CircleSurface CircleSurface => _surface; + + /// + /// Sets or gets the state of the widget, which might be enabled or disabled. + /// + 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; } } diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs index 48f86a1..06bd53b 100755 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs @@ -15,33 +15,46 @@ */ using System; +using System.Diagnostics; namespace ElmSharp.Wearable { /// /// Circle slider is circular designed widget to select a value in a range by rotary event. /// - public class CircleSlider : EvasObject + public class CircleSlider : Widget, IRotaryActionWidget { - /// - /// Changed will be triggered when the circle slider value changes. - /// - public event EventHandler Changed; - SmartEvent _changedEvent; + CircleSurface _surface; /// /// Creates and initializes a new instance of the CircleSlider class. /// /// The EvasObject to which the new CircleSlider will be attached as a child. - public CircleSlider(EvasObject parent) : base(parent) + /// The surface for drawing circle features for this widget. + 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); } /// + /// Changed will be triggered when the circle slider value changes. + /// + public event EventHandler ValueChanged; + + /// + /// Gets the handle for Circle Widget. + /// + public virtual IntPtr CircleHandle => RealHandle; + + /// + /// Gets the handle for Circle Surface used in this widget + /// + public virtual CircleSurface CircleSurface => _surface; + + /// /// Sets or gets the step by which the circle slider bar moves. /// /// @@ -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); } } /// - /// Sets or gets disabled state of the circle slider object. + /// Sets or gets the state of the widget, which might be enabled or disabled. /// - 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); } } /// /// Sets or gets color of the circle slider background. /// - 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); } } /// + /// The callback of Realized Event + /// + protected override void OnRealized() + { + base.OnRealized(); + _changedEvent = new SmartEvent(this, "value,changed"); + _changedEvent.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty); + } + + /// /// Creates a widget handle. /// /// Parent EvasObject /// Handle IntPtr 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 diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs index fbc84d7..e66fa54 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs @@ -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 . /// - 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; /// /// Creates and initializes a new instance of the Circle Spinner class. /// /// The parent of new Circle Spinner instance - public CircleSpinner(EvasObject parent) : base(parent) + /// The surface for drawing circle features for this widget. + public CircleSpinner(EvasObject parent, CircleSurface surface) : base() { + Debug.Assert(parent == null || surface == null || parent.IsRealized); + _surface = surface; + Realize(parent); } /// + /// Gets the handle for Circle Widget. + /// + public virtual IntPtr CircleHandle => RealHandle; + + /// + /// Gets the handle for Circle Surface used in this widget + /// + public virtual CircleSurface CircleSurface => _surface; + + /// /// Sets or gets the circle spinner angle per each spinner value. /// 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); } } /// - /// Sets or gets disabled state of the circle spinner object. + /// Sets or gets the state of the widget, which might be enabled or disabled. /// - 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 index 0000000..91da5a1 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSurface.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + /// + /// The CircleSurface presents a surface for drawing circular feature of circle widgets + /// + public class CircleSurface + { + IntPtr _handle; + + /// + /// Creates and initializes a new instance of the CircleSurface class with surface on the Conformant widget. + /// + /// Conformant widget to create a surface. + public CircleSurface(Conformant conformant) + { + _handle = Interop.Eext.eext_circle_surface_conformant_add(conformant); + } + + /// + /// Creates and initializes a new instance of the CircleSurface class with surface on the Layout widget. + /// + /// Layout widget to create a surface. + public CircleSurface(Layout layout) + { + _handle = Interop.Eext.eext_circle_surface_layout_add(layout); + } + + /// + /// Creates and initializes a new instance of the CircleSurface class with surface on the Naviframe widget. + /// + /// Naviframe widget to create a surface. + public CircleSurface(Naviframe naviframe) + { + _handle = Interop.Eext.eext_circle_surface_naviframe_add(naviframe); + } + + /// + /// Creates and initializes a new instance of the CircleSurface class with no surface + /// + 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 index 0000000..17cdf42 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/ICircleWidget.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + /// + /// The ICircleWidget is the interface for a widget to display and handle with circle surface + /// + public interface ICircleWidget + { + /// + /// Gets the handle for Circle Widget. + /// + IntPtr CircleHandle { get; } + + /// + /// Gets the CircleSurface used in this widget + /// + CircleSurface CircleSurface { get; } + } + + /// + /// The IRotaryActionWidget is the interface for a widget has action by rotary event + /// + public interface IRotaryActionWidget : ICircleWidget + { + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotaryEventManager.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotaryEventManager.cs index 6b34fde..f413ae4 100644 --- a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotaryEventManager.cs +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotaryEventManager.cs @@ -67,7 +67,7 @@ namespace ElmSharp.Wearable /// /// RotaryEventManager serve extension functions for Rotary event to EvasObject on device like Galaxy Gear. /// - public static class EvasObjectExtensions + public static class RotaryEventExtensions { static Dictionary s_rotaryObjectEventHandlers = new Dictionary(); static Dictionary s_rotaryObjectEventMap = new Dictionary(); @@ -110,6 +110,24 @@ namespace ElmSharp.Wearable } /// + /// Activate this circle widget can take Rotary event. + /// + /// Target circle widget + public static void Activate(this IRotaryActionWidget widget) + { + Interop.Eext.eext_rotary_object_event_activated_set(widget.CircleHandle, true); + } + + /// + /// Deactivate this circle widget is blocked from Rotary event. + /// + /// Target circle widget + public static void Deactivate(this IRotaryActionWidget widget) + { + Interop.Eext.eext_rotary_object_event_activated_set(widget.CircleHandle, false); + } + + /// /// Activate this object can take Rotary event. /// /// Target object diff --git a/src/ElmSharp/ElmSharp/Container.cs b/src/ElmSharp/ElmSharp/Container.cs index 135c3d3..b7e0e33 100755 --- a/src/ElmSharp/ElmSharp/Container.cs +++ b/src/ElmSharp/ElmSharp/Container.cs @@ -39,6 +39,13 @@ namespace ElmSharp } /// + /// Creates and initializes a new instance of Container class. + /// + protected Container() : base() + { + } + + /// /// Sets the background color of a given Container. /// public override Color BackgroundColor diff --git a/src/ElmSharp/ElmSharp/DateTimeSelector.cs b/src/ElmSharp/ElmSharp/DateTimeSelector.cs index 98d2cbe..c159804 100755 --- a/src/ElmSharp/ElmSharp/DateTimeSelector.cs +++ b/src/ElmSharp/ElmSharp/DateTimeSelector.cs @@ -67,13 +67,13 @@ namespace ElmSharp ///as a child.It's type. 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; - }; + } + + /// + /// Creates and initializes a new instance of DateTimeSelector class. + /// + protected DateTimeSelector() : base() + { } /// @@ -189,6 +189,21 @@ namespace ElmSharp } /// + /// The callback of Realized Event + /// + 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; + }; + } + + /// /// Creates a widget handle. /// /// Parent EvasObject diff --git a/src/ElmSharp/ElmSharp/GenList.cs b/src/ElmSharp/ElmSharp/GenList.cs index 7afb41c..82730d1 100755 --- a/src/ElmSharp/ElmSharp/GenList.cs +++ b/src/ElmSharp/ElmSharp/GenList.cs @@ -155,8 +155,13 @@ namespace ElmSharp /// The parent is a given container which will be attached by GenList as a child. It's type. public GenList(EvasObject parent) : base(parent) { - ListMode = GenListMode.Compress; - InitializeSmartEvent(); + } + + /// + /// Creates and initializes a new instance of GenList class. + /// + protected GenList() : base() + { } /// @@ -712,6 +717,16 @@ namespace ElmSharp } /// + /// The callback of Unrealize Event + /// + protected override void OnRealized() + { + base.OnRealized(); + ListMode = GenListMode.Compress; + InitializeSmartEvent(); + } + + /// /// Creates a widget handle. /// /// Parent EvasObject diff --git a/src/ElmSharp/ElmSharp/Layout.cs b/src/ElmSharp/ElmSharp/Layout.cs index 4e7b294..d5716e1 100644 --- a/src/ElmSharp/ElmSharp/Layout.cs +++ b/src/ElmSharp/ElmSharp/Layout.cs @@ -35,17 +35,13 @@ namespace ElmSharp /// The parent is a given container which will be attached by Layout as a child. It's type. 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); - }; + /// + /// Creates and initializes a new instance of Layout class. + /// + protected Layout() : base() + { } /// @@ -340,6 +336,25 @@ namespace ElmSharp } /// + /// The callback of Realized Event + /// + 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); + }; + } + + /// /// Sets the content at a part of a given container widget. /// /// The parent is a given container which will be attached by Layout as a child. It's type. diff --git a/src/ElmSharp/ElmSharp/Scroller.cs b/src/ElmSharp/ElmSharp/Scroller.cs index 64079d1..cf7352e 100755 --- a/src/ElmSharp/ElmSharp/Scroller.cs +++ b/src/ElmSharp/ElmSharp/Scroller.cs @@ -97,10 +97,13 @@ namespace ElmSharp /// The to which the new Scroller will be attached as a child. 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"); + } + + /// + /// Creates and initializes a new instance of the Scroller class. + /// + public Scroller() : base() + { } /// @@ -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"); + } + /// /// Creates a widget handle. /// diff --git a/src/ElmSharp/ElmSharp/Spinner.cs b/src/ElmSharp/ElmSharp/Spinner.cs index 556de96..794aa32 100755 --- a/src/ElmSharp/ElmSharp/Spinner.cs +++ b/src/ElmSharp/ElmSharp/Spinner.cs @@ -36,11 +36,13 @@ namespace ElmSharp /// The parent of new Spinner instance 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); + /// + /// Creates and initializes a new instance of Layout class. + /// + protected Spinner() : base() + { } /// @@ -241,6 +243,19 @@ namespace ElmSharp } /// + /// The callback of Realized Event + /// + 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); + } + + /// /// Creates a widget handle. /// /// Parent EvasObject diff --git a/src/ElmSharp/ElmSharp/Widget.cs b/src/ElmSharp/ElmSharp/Widget.cs index 040d132..6407888 100755 --- a/src/ElmSharp/ElmSharp/Widget.cs +++ b/src/ElmSharp/ElmSharp/Widget.cs @@ -83,11 +83,6 @@ namespace ElmSharp /// The parent of new Widget instance 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); } /// @@ -113,7 +108,7 @@ namespace ElmSharp /// /// Sets or gets the state of the widget, which might be enabled or disabled. /// - public bool IsEnabled + public virtual bool IsEnabled { get { @@ -437,6 +432,19 @@ namespace ElmSharp return a; } + /// + /// The callback of Realized Event + /// + 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); diff --git a/test/ElmSharp.Test/ElmSharp.Test.csproj b/test/ElmSharp.Test/ElmSharp.Test.csproj index 6880f41..949dee3 100755 --- a/test/ElmSharp.Test/ElmSharp.Test.csproj +++ b/test/ElmSharp.Test/ElmSharp.Test.csproj @@ -29,4 +29,4 @@ - \ No newline at end of file + diff --git a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs index 4318a75..4ddaba3 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs index 6e3bdf0..d27b4fc 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs @@ -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" diff --git a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs index 8ac1907..64ee69b 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs @@ -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); diff --git a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs index 3a93ab5..5a81497 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs @@ -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", diff --git a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs index 03de32b..2443827 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs index ff1e9fd..af50687 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs index 6dc5f53..ab8c62b 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs @@ -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); diff --git a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs index d5190ab..184cb05 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs index a0bc3cb..221f321 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs index d41034d..d4e7629 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs index 66a2ba6..b272be7 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs index 9ff9d48..0675b0e 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs @@ -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) diff --git a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs index 21d7a33..9872c73 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs index b968e53..5742f24 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs index 412e1e0..b9688a7 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs index 13a3db8..c81e01f 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs @@ -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, diff --git a/test/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs b/test/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs index 91a4cc2..12681c2 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs @@ -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); }; diff --git a/test/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs b/test/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs index 9f0c262..179638e 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs @@ -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); }; diff --git a/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs b/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs index d67564e..5c6eabd 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs @@ -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; }; diff --git a/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs b/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs index 59adefd..50db506 100644 --- a/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs +++ b/test/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs @@ -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", -- 2.7.4