diff options
98 files changed, 4989 insertions, 0 deletions
diff --git a/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj b/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj new file mode 100644 index 0000000..419f133 --- /dev/null +++ b/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.csproj @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectTypeGuids>{2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ProjectGuid>{C6E111B7-21E2-4CD6-93BF-2CD5ED255749}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ElmSharp.Wearable.Test</RootNamespace> + <AssemblyName>ElmSharp.Wearable.Test</AssemblyName> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup> + <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier> + <TargetFrameworkVersion>v1.0</TargetFrameworkVersion> + <NuGetTargetMoniker>.NETCoreApp,Version=v1.0</NuGetTargetMoniker> + <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences> + <NoStdLib>true</NoStdLib> + <NoWarn>$(NoWarn);1701;1702</NoWarn> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="TC\CircleDateTimeSelectorTest1.cs" /> + <Compile Include="TC\CircleDateTimeSelectorTest2.cs" /> + <Compile Include="TC\CircleDateTimeSelectorTest3.cs" /> + <Compile Include="TC\CircleDateTimeSelectorTest4.cs" /> + <Compile Include="TC\CircleGenListTest1.cs" /> + <Compile Include="TC\CircleGenListTest2.cs" /> + <Compile Include="TC\CircleGenListTest3.cs" /> + <Compile Include="TC\CircleGenListTest4.cs" /> + <Compile Include="TC\CircleScrollerTest1.cs" /> + <Compile Include="TC\CircleScrollerTest2.cs" /> + <Compile Include="TC\CircleScrollerTest3.cs" /> + <Compile Include="TC\CircleScrollerTest4.cs" /> + <Compile Include="TC\CircleSliderTest1.cs" /> + <Compile Include="TC\CircleSliderTest2.cs" /> + <Compile Include="TC\CircleProgressBarTest1.cs" /> + <Compile Include="TC\CircleProgressBarTest2.cs" /> + <Compile Include="TC\CircleProgressBarTest3.cs" /> + <Compile Include="TC\CircleProgressBarTest4.cs" /> + <Compile Include="TC\CircleSpinnerTest1.cs" /> + <Compile Include="TC\CircleSpinnerTest2.cs" /> + <Compile Include="TC\Log.cs" /> + <Compile Include="TC\MoreOptionTest.cs" /> + <Compile Include="TC\RotarySelectorTest.cs" /> + <Compile Include="TestCaseBase.cs" /> + <Compile Include="TestRunner.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="ElmSharp.Wearable.Test.project.json" /> + </ItemGroup> + <ItemGroup> + <Content Include="res\icons\bg_black.png" /> + <Content Include="res\icons\bg_red.png" /> + <Content Include="res\icons\bg_white.png" /> + <Content Include="res\icons\icon_aquamarine_260_me.png" /> + <Content Include="res\icons\icon_auamarine_260_me.png" /> + <Content Include="res\icons\icon_azure_215_me.png" /> + <Content Include="res\icons\icon_beige_330_me.png" /> + <Content Include="res\icons\icon_blue_45_me.png" /> + <Content Include="res\icons\icon_brown_90_me.png" /> + <Content Include="res\icons\icon_cyan_230_me.png" /> + <Content Include="res\icons\icon_firebrick_95_me.png" /> + <Content Include="res\icons\icon_gold_75_me.png" /> + <Content Include="res\icons\icon_green_60_me.png" /> + <Content Include="res\icons\icon_honeydew_285_me.png" /> + <Content Include="res\icons\icon_ivory_315_me.png" /> + <Content Include="res\icons\icon_khaki_360_me.png" /> + <Content Include="res\icons\icon_lime_300_me.png" /> + <Content Include="res\icons\icon_maroon_120_me.png" /> + <Content Include="res\icons\icon_me.png" /> + <Content Include="res\icons\icon_orchid_160_me.png" /> + <Content Include="res\icons\icon_pink_145_me.png" /> + <Content Include="res\icons\icon_purple_200_me.png" /> + <Content Include="res\icons\icon_red_30_me.png" /> + <Content Include="res\icons\icon_snow_75_me.png" /> + <Content Include="res\icons\icon_snow_80_me.png" /> + <Content Include="res\icons\icon_teal_245_me.png" /> + <Content Include="res\icons\icon_violet_180_me.png" /> + <Content Include="res\icons\icon_yellow_345_me.png" /> + <Content Include="res\icons\pressed.png" /> + <Content Include="res\icons\round_bg_green.png" /> + <Content Include="res\icons\round_bg_white.png" /> + <Content Include="res\icons\round_bg_yellow.png" /> + <Content Include="res\icons\round_content_black.png" /> + <Content Include="res\icons\round_content_blue.png" /> + <Content Include="res\icons\round_content_red.png" /> + <Content Include="shared\res\ElmSharp.Test.png" /> + <Content Include="tizen-manifest.xml" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\ElmSharp.Wearable\ElmSharp.Wearable.csproj"> + <Project>{9a1c45ac-93e3-4b09-b896-769df60cf1b2}</Project> + <Name>ElmSharp.Wearable</Name> + </ProjectReference> + <ProjectReference Include="..\ElmSharp\ElmSharp.csproj"> + <Project>{d00c29dd-4b2e-41c0-a323-bad1a74c69bf}</Project> + <Name>ElmSharp</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and + https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild + --> + <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two + properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and + to prevent it from outputting a warning (MSB3644). + --> + <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories> + <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths> + <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences> + </PropertyGroup> + <ProjectExtensions> + <VisualStudio> + <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Debug|Any CPU"> + <ProjectCommonFlavorCfg /> + </FlavorProperties> + <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Release|Any CPU"> + <ProjectCommonFlavorCfg /> + </FlavorProperties> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json b/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json new file mode 100644 index 0000000..4bd5e6c --- /dev/null +++ b/ElmSharp.Wearable.Test/ElmSharp.Wearable.Test.project.json @@ -0,0 +1,13 @@ +{ + "dependencies": { + "Microsoft.NETCore.App": "1.0.0", + "Tizen.Applications.Common": "1.5.8", + "Tizen.Applications.UI": "1.5.8" + }, + "frameworks": { + "netcoreapp1.0": {} + }, + "runtimes": { + "win": {} + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs b/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c419e2d --- /dev/null +++ b/ElmSharp.Wearable.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ElmSharp.Wearable.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ElmSharp.Wearable.Test")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2e1a161a-baa9-40ef-a8b4-082ce7c813b8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs new file mode 100644 index 0000000..4318a75 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest1.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleDateTimeSelectorTest1 : TestCaseBase + { + public override string TestName => "CircleDateTimeSelectorTest1"; + public override string TestDescription => "To display a date time selector with circle UI"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Layout layout = new Layout(window); + + layout.SetTheme("layout", "circle", "datetime"); + + conformant.SetContent(layout); + + DateTimeSelector datetime = new CircleDateTimeSelector(conformant) + { + MinimumDateTime = new DateTime(2015, 1, 1), + MaximumDateTime = DateTime.Now, + DateTime = DateTime.Now + }; + + layout.SetContent(datetime); + + Button btn = new Button(layout) + { + Text = "OK", + Style = "bottom", + }; + + layout.SetPartContent("elm.swallow.btn", btn); + + layout.SetPartText("elm.text", "Set date"); + + datetime.DateTimeChanged += (object sender, DateChangedEventArgs e) => + { + Log.Debug(TestName, "Old DateTime={0}", e.OldDate.ToString()); + Log.Debug(TestName, "New DateTime={0}", e.NewDate.ToString()); + Log.Debug(TestName, "Current DateTime={0}", datetime.DateTime.ToString()); + }; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs new file mode 100644 index 0000000..6e3bdf0 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest2.cs @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleDateTimeSelectorTest2 : TestCaseBase + { + public override string TestName => "CircleDateTimeSelectorTest2"; + public override string TestDescription => "To display a date time selector with circle UI"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Layout layout = new Layout(window); + + layout.SetTheme("layout", "circle", "datetime"); + + conformant.SetContent(layout); + + DateTimeSelector datetime = new CircleDateTimeSelector(conformant) + { + DateTime = DateTime.Now, + Style = "timepicker/circle" + }; + + layout.SetContent(datetime); + + Button btn = new Button(layout) + { + Text = "OK", + Style = "bottom", + }; + + layout.SetPartContent("elm.swallow.btn", btn); + + layout.SetPartText("elm.text", "Set time"); + + datetime.DateTimeChanged += (object sender, DateChangedEventArgs e) => + { + Log.Debug(TestName, "Old DateTime={0}", e.OldDate.ToString()); + Log.Debug(TestName, "New DateTime={0}", e.NewDate.ToString()); + Log.Debug(TestName, "Current DateTime={0}", datetime.DateTime.ToString()); + }; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs new file mode 100644 index 0000000..8ac1907 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest3.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleDateTimeSelectorTest3 : TestCaseBase + { + public override string TestName => "CircleDateTimeSelectorTest3"; + public override string TestDescription => "To display a date time selector with circle UI"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Layout layout = new Layout(window); + + layout.SetTheme("layout", "circle", "datetime"); + + conformant.SetContent(layout); + + DateTimeSelector datetime = new CircleDateTimeSelector(conformant) + { + DateTime = DateTime.Now, + Style = "timepicker/circle", + Disabled = true + }; + + layout.SetContent(datetime); + + Button btn = new Button(layout) + { + Text = "OK", + Style = "bottom", + }; + + layout.SetPartContent("elm.swallow.btn", btn); + + layout.SetPartText("elm.text", "Set time"); + + datetime.DateTimeChanged += (object sender, DateChangedEventArgs e) => + { + Log.Debug(TestName, "Old DateTime={0}", e.OldDate.ToString()); + Log.Debug(TestName, "New DateTime={0}", e.NewDate.ToString()); + Log.Debug(TestName, "Current DateTime={0}", datetime.DateTime.ToString()); + }; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs new file mode 100644 index 0000000..3a93ab5 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleDateTimeSelectorTest4.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleDateTimeSelectorTest4 : TestCaseBase + { + public override string TestName => "CircleDateTimeSelectorTest4"; + public override string TestDescription => "To display a date time selector with circle UI"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Layout layout = new Layout(window); + + layout.SetTheme("layout", "circle", "datetime"); + + conformant.SetContent(layout); + + DateTimeSelector datetime = new CircleDateTimeSelector(conformant) + { + DateTime = DateTime.Now, + Style = "timepicker/circle", + MarkerLineWidth = 40, + MarkerColor = Color.Pink, + MarkerRadius = 100, + }; + + layout.SetContent(datetime); + + Button btn = new Button(layout) + { + Text = "OK", + Style = "bottom", + }; + + layout.SetPartContent("elm.swallow.btn", btn); + + layout.SetPartText("elm.text", "Set time"); + + datetime.DateTimeChanged += (object sender, DateChangedEventArgs e) => + { + Log.Debug(TestName, "Old DateTime={0}", e.OldDate.ToString()); + Log.Debug(TestName, "New DateTime={0}", e.NewDate.ToString()); + Log.Debug(TestName,"Current DateTime={0}", datetime.DateTime.ToString()); + }; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs b/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs new file mode 100644 index 0000000..03de32b --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleGenListTest1.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleGenListTest1 : TestCaseBase + { + public override string TestName => "CircleGenListTest1"; + public override string TestDescription => "To display a genlist applied a circle UI on a conformant"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + var list = new CircleGenList(conformant) + { + Homogeneous = true, + VerticalScrollBarColor = Color.Red, + VerticalScrollBackgroundColor = Color.Pink, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Visible, + }; + + conformant.SetContent(list); + + GenItemClass defaultClass = new GenItemClass("default") + { + GetTextHandler = (obj, part) => + { + return string.Format("{0} - {1}",(string)obj, part); + } + }; + + for (int i = 0; i < 100; i++) + { + list.Append(defaultClass, string.Format("{0} Item", i)); + } + list.ItemSelected += List_ItemSelected; ; + } + + private void List_ItemSelected(object sender, GenListItemEventArgs e) + { + Log.Debug(TestName, "{0} Item was selected", (string)(e.Item.Data)); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs b/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs new file mode 100644 index 0000000..ff1e9fd --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleGenListTest2.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleGenListTest2 : TestCaseBase + { + public override string TestName => "CircleGenListTest2"; + public override string TestDescription => "To display a genlist applied a circle UI on a layout"; + + public override void Run(Window window) + { + var layout = new Layout(window); + layout.Show(); + + layout.Move(0, 0); + layout.Resize(360, 360); + + var list = new CircleGenList(layout) + { + Homogeneous = true, + VerticalScrollBackgroundRadius = 165, + VerticalScrollBarRadius = 165, + VerticalScrollBackgroundLineWidth = 30, + VerticalScrollBarLineWidth = 30, + }; + list.Show(); + + list.Move(0, 0); + list.Resize(360, 360); + list.Lower(); + + + GenItemClass defaultClass = new GenItemClass("default") + { + GetTextHandler = (obj, part) => + { + return string.Format("{0} - {1}",(string)obj, part); + } + }; + + for (int i = 0; i < 100; i++) + { + list.Append(defaultClass, string.Format("{0} Item", i)); + } + list.ItemSelected += List_ItemSelected; ; + } + + private void List_ItemSelected(object sender, GenListItemEventArgs e) + { + Log.Debug(TestName, "{0} Item was selected", (string)(e.Item.Data)); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs b/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs new file mode 100644 index 0000000..6dc5f53 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleGenListTest3.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleGenListTest3 : TestCaseBase + { + public override string TestName => "CircleGenListTest3"; + public override string TestDescription => "To display a genlist applied a circle UI on a naviframe"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + var naviframe = new Naviframe(conformant); + + conformant.SetContent(naviframe); + + var list = new CircleGenList(naviframe) + { + Homogeneous = true, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, + Disabled = true, + }; + + var item = naviframe.Push(list); + item.Style = "empty"; + + GenItemClass defaultClass = new GenItemClass("default") + { + GetTextHandler = (obj, part) => + { + return string.Format("{0} - {1}",(string)obj, part); + } + }; + + for (int i = 0; i < 100; i++) + { + list.Append(defaultClass, string.Format("{0} Item", i)); + } + list.ItemSelected += List_ItemSelected; ; + } + + private void List_ItemSelected(object sender, GenListItemEventArgs e) + { + Log.Debug(TestName, "{0} Item was selected", (string)(e.Item.Data)); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs b/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs new file mode 100644 index 0000000..d5190ab --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleGenListTest4.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleGenListTest4 : TestCaseBase + { + public override string TestName => "CircleGenListTest4"; + public override string TestDescription => "To display a genlist applied a circle UI on an window"; + + public override void Run(Window window) + { + var list = new CircleGenList(window) + { + Homogeneous = true, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, + }; + list.Show(); + + list.Move(0, 0); + list.Resize(360, 360); + + GenItemClass defaultClass = new GenItemClass("default") + { + GetTextHandler = (obj, part) => + { + return string.Format("{0} - {1}",(string)obj, part); + } + }; + + for (int i = 0; i < 100; i++) + { + list.Append(defaultClass, string.Format("{0} Item", i)); + } + list.ItemSelected += List_ItemSelected; ; + } + + private void List_ItemSelected(object sender, GenListItemEventArgs e) + { + Log.Debug(TestName, "{0} Item was selected", (string)(e.Item.Data)); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs new file mode 100644 index 0000000..a0bc3cb --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest1.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleProgressBarTest1 : TestCaseBase + { + public override string TestName => "CircleProgressBarTest1"; + public override string TestDescription => "To test basic operation of CircleProgressBar"; + + public override void Run(Window window) + { + Log.Debug(TestName, "CircleProgressBar run"); + Conformant conformant = new Conformant(window); + conformant.Show(); + + CircleProgressBar pb1 = new CircleProgressBar(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + + // default + Value = 20, + Maximum = 100, + Minimum = 0, + BarRadius = 80, + BarLineWidth = 6, + + // background + BackgroundRadius = 80, + BackgroundLineWidth = 6, + }; + pb1.Show(); + conformant.SetContent(pb1); + Label lb1 = new Label(window) + { + Text = string.Format("{0} %", pb1.Value), + }; + + lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + lb1.Move(170, window.ScreenSize.Height / 2 - 20); + lb1.Show(); + + EcoreMainloop.AddTimer(0.05, () => + { + pb1.Value += 1; + lb1.Text = string.Format("{0} %", pb1.Value); + + return true; + }); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs new file mode 100644 index 0000000..d41034d --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest2.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleProgressBarTest2 : TestCaseBase + { + public override string TestName => "CircleProgressBarTest2"; + public override string TestDescription => "To test property related with background of CircleProgressBar"; + + public override void Run(Window window) + { + Log.Debug(TestName, "CircleProgressBar run"); + Conformant conformant = new Conformant(window); + conformant.Show(); + + CircleProgressBar pb1 = new CircleProgressBar(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + + // bar + Value = 20, + Maximum = 100, + Minimum = 0, + BarRadius = 100, + BarLineWidth = 10, + BarColor = Color.Green, + + // Test purpose : to test property related with background + + // background + BackgroundRadius = 110, + BackgroundLineWidth = 10, + BackgroundColor = Color.Aqua + }; + pb1.Show(); + conformant.SetContent(pb1); + Label lb1 = new Label(window) + { + Text = string.Format("S {0} %", pb1.Value), + }; + + lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + lb1.Move(160, window.ScreenSize.Height / 2 - 20); + lb1.Show(); + + EcoreMainloop.AddTimer(0.05, () => + { + pb1.Value += 1; + lb1.Text = string.Format("S {0} %", pb1.Value); + + return true; + }); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs new file mode 100644 index 0000000..66a2ba6 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest3.cs @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleProgressBarTest3 : TestCaseBase + { + public override string TestName => "CircleProgressBarTest3"; + public override string TestDescription => "To test property related with angle of CircleProgressBar"; + + public override void Run(Window window) + { + Log.Debug(TestName, "CircleProgressBar run"); + Conformant conformant = new Conformant(window); + conformant.Show(); + + CircleProgressBar pb1 = new CircleProgressBar(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + + // Test purpose : to test property related with angle + + // bar + Maximum = 100, + BarRadius = 100, + BarLineWidth = 20, + BarColor = Color.Green, + BarAngleOffset = 90, + BarAngle = 90, + BarAngleMaximum = 180, + + // background + BackgroundRadius = 100, + BackgroundLineWidth = 20, + BackgroundColor = Color.Aqua, + BackgroundAngleOffset = 90, + BackgroundAngle = 180, + }; + pb1.Show(); + conformant.SetContent(pb1); + Label lb1 = new Label(window) + { + Text = string.Format("V {0} %", pb1.Value), + }; + + lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + lb1.Move(160, window.ScreenSize.Height / 2 - 40); + lb1.Show(); + + Label lb2 = new Label(window) + { + Text = string.Format("A {0} ", pb1.BarAngle), + }; + + lb2.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + lb2.Move(160, window.ScreenSize.Height / 2); + lb2.Show(); + + EcoreMainloop.AddTimer(0.5, () => + { + pb1.Value += 1; + + lb1.Text = string.Format("V {0} %", pb1.Value); + lb2.Text = string.Format("A {0} ", pb1.BarAngle); + + return true; + }); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs new file mode 100644 index 0000000..9ff9d48 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleProgressBarTest4.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleProgressBarTest4 : TestCaseBase + { + public override string TestName => "CircleProgressBarTest4"; + public override string TestDescription => "To test Disabled property of CircleProgressBar"; + + public override void Run(Window window) + { + Log.Debug(TestName, "CircleProgressBar run"); + Conformant conformant = new Conformant(window); + conformant.Show(); + + CircleProgressBar pb1 = new CircleProgressBar(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + + // bar + Value = 0, + Maximum = 100, + Minimum = 0, + BarRadius = 100, + BarLineWidth = 15, + BarColor = Color.Green, + + // background + BackgroundRadius = 100, + BackgroundLineWidth = 15, + BackgroundColor = Color.Aqua, + }; + pb1.Show(); + conformant.SetContent(pb1); + Label lb1 = new Label(window) + { + Text = string.Format("S {0} %", pb1.Value), + }; + + lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + lb1.Move(160, window.ScreenSize.Height / 2 - 40); + lb1.Show(); + + EcoreMainloop.AddTimer(0.05, () => + { + if (pb1.Value == pb1.Maximum/2) + { + // Test purpose : set disable + pb1.Disabled = true; + } + + if (pb1.Value == pb1.Maximum) + { + EcoreMainloop.RemoveTimer(pb1); + } + + pb1.Value += 1; + lb1.Text = string.Format("S {0} %", pb1.Value); + + return true; + }); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs b/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs new file mode 100644 index 0000000..21d7a33 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleScrollerTest1.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleScrollerTest1 : TestCaseBase + { + public override string TestName => "CircleScrollerTest1"; + public override string TestDescription => "To test basic operation of CircleScroller"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + CircleScroller circleScroller = new CircleScroller(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, + HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, + }; + circleScroller.Show(); + conformant.SetContent(circleScroller); + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + box.Show(); + circleScroller.SetContent(box); + + var rnd = new Random(); + for (int i = 0; i < 10; i++) + { + int r = rnd.Next(255); + int g = rnd.Next(255); + int b = rnd.Next(255); + Color color = Color.FromRgb(r, g, b); + Rectangle colorBox = new Rectangle(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = color, + MinimumHeight = window.ScreenSize.Height, + }; + colorBox.Show(); + box.PackEnd(colorBox); + } + circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Circle Scrolled Scrolled"); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs b/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs new file mode 100644 index 0000000..b968e53 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleScrollerTest2.cs @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleScrollerTest2 : TestCaseBase + { + public override string TestName => "CircleScrollerTest2"; + public override string TestDescription => "To test basic operation of CircleScroller"; + + public override void Run(Window window) + { + Layout layout = new Layout(window); + layout.Show(); + layout.Move(0, 0); + layout.Resize(360, 360); + + CircleScroller circleScroller = new CircleScroller(layout) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, + HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, + }; + circleScroller.Show(); + circleScroller.Move(0, 0); + circleScroller.Resize(360, 360); + circleScroller.Lower(); + + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + IsHorizontal = true, + }; + box.Show(); + circleScroller.SetContent(box); + + var rnd = new Random(); + for (int i = 0; i < 10; i++) + { + int r = rnd.Next(255); + int g = rnd.Next(255); + int b = rnd.Next(255); + Color color = Color.FromRgb(r, g, b); + Rectangle colorBox = new Rectangle(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = color, + MinimumWidth = window.ScreenSize.Width, + }; + colorBox.Show(); + box.PackEnd(colorBox); + } + circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled"); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs b/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs new file mode 100644 index 0000000..412e1e0 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleScrollerTest3.cs @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleScrollerTest3 : TestCaseBase + { + public override string TestName => "CircleScrollerTest3"; + public override string TestDescription => "To test basic operation of CircleScroller"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + Naviframe naviframe = new Naviframe(conformant); + + CircleScroller circleScroller = new CircleScroller(naviframe) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, + HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, + HorizontalScrollBarColor = new Color(255, 0, 0, 50), + HorizontalScrollBackgroundColor = Color.Orange, + HorizontalScrollBarLineWidth = 15, + HorizontalScrollBackgroundLineWidth = 15, + }; + circleScroller.Show(); + naviframe.Push(circleScroller); + naviframe.Show(); + conformant.SetContent(naviframe); + + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + IsHorizontal = true, + }; + box.Show(); + circleScroller.SetContent(box); + + var rnd = new Random(); + for (int i = 0; i < 10; i++) + { + int r = rnd.Next(255); + int g = rnd.Next(255); + int b = rnd.Next(255); + Color color = Color.FromRgb(r, g, b); + Rectangle colorBox = new Rectangle(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = color, + MinimumWidth = window.ScreenSize.Width, + }; + colorBox.Show(); + box.PackEnd(colorBox); + } + circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled"); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs b/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs new file mode 100644 index 0000000..13a3db8 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleScrollerTest4.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleScrollerTest4 : TestCaseBase + { + public override string TestName => "CircleScrollerTest4"; + public override string TestDescription => "To test basic operation of CircleScroller"; + + public override void Run(Window window) + { + + CircleScroller circleScroller = new CircleScroller(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, + HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, + VerticalScrollBarColor = Color.Yellow, + VerticalScrollBackgroundColor = Color.Red, + VerticalScrollBarRadius = 170, + VerticalScrollBackgroundRadius = 170, + }; + circleScroller.Show(); + circleScroller.Move(0, 0); + circleScroller.Resize(360, 360); + + Box box = new Box(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + }; + box.Show(); + circleScroller.SetContent(box); + + var rnd = new Random(); + for (int i = 0; i < 10; i++) + { + int r = rnd.Next(255); + int g = rnd.Next(255); + int b = rnd.Next(255); + Color color = Color.FromRgb(r, g, b); + Rectangle colorBox = new Rectangle(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Color = color, + MinimumHeight = window.ScreenSize.Height, + }; + colorBox.Show(); + box.PackEnd(colorBox); + } + circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled"); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs b/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs new file mode 100644 index 0000000..91a4cc2 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleSliderTest1.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleSliderTest1 : TestCaseBase + { + public override string TestName => "CircleSliderTest1"; + public override string TestDescription => "To test basic operation of CircleSlider"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + + CircleSlider circleSlider = new CircleSlider(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Minimum = 0, + Maximum = 100, + Value = 25, + Step = 5, + }; + circleSlider.Show(); + conformant.SetContent(circleSlider); + + Label label1 = new Label(window) + { + Text = string.Format("{0}", circleSlider.Value), + Color = Color.White, + }; + + label1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + label1.Move(170, window.ScreenSize.Height / 2 - 20); + label1.Show(); + + circleSlider.Changed += (s, e) => + { + label1.Text = string.Format("{0}", circleSlider.Value); + }; + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs b/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs new file mode 100644 index 0000000..9f0c262 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleSliderTest2.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + public class CircleSliderTest2 : TestCaseBase + { + public override string TestName => "CircleSliderTest2"; + public override string TestDescription => "To test basic operation of CircleSlider"; + + public override void Run(Window window) + { + Conformant conformant = new Conformant(window); + conformant.Show(); + + + CircleSlider circleSlider = new CircleSlider(conformant) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Minimum = 0, + Maximum = 15, + BarColor = Color.Purple, + BackgroundColor = Color.Red, + BarRadius = 160, + BackgroundRadius = 160, + BarLineWidth = 15, + BackgroundLineWidth = 15, + BackgroundAngleOffset = 90, + BackgroundAngle = 270, + BarAngleOffset = 90.0, + BarAngleMinimum = 0.0, + BarAngleMaximum = 270.0, + Value = 3, + Step = 0.5, + }; + circleSlider.Show(); + conformant.SetContent(circleSlider); + Label label1 = new Label(window) + { + Text = string.Format("{0:F1}", circleSlider.Value), + Color = Color.White, + }; + + label1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + label1.Move(170, window.ScreenSize.Height / 2 - 30); + label1.Show(); + + Label label2 = new Label(window) + { + Text = string.Format("min:{0},max{1}", circleSlider.Minimum, circleSlider.Maximum), + Color = Color.White, + }; + + label2.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + label2.Move(110, window.ScreenSize.Height / 2 + 10); + label2.Show(); + + Log.Debug(TestName, "CircleSliderTest2 step:" + circleSlider.Step); + + circleSlider.Changed += (s, e) => + { + label1.Text = string.Format("{0:F1}", circleSlider.Value); + }; + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs b/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs new file mode 100644 index 0000000..d67564e --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleSpinnerTest1.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleSpinnerTest1 : TestCaseBase + { + public override string TestName => "CircleSpinnerTest1"; + public override string TestDescription => "To test basic operation of Circle Spinner"; + + public override void Run(Window window) + { + Log.Debug(TestName, "CircleSpinnerTest run"); + Conformant conformant = new Conformant(window); + conformant.Show(); + + Layout layout = new Layout(window); + layout.SetTheme("layout", "circle", "spinner"); + conformant.SetContent(layout); + + CircleSpinner spn1 = new CircleSpinner(conformant) + { + Text = "Spinner Test", + LabelFormat = "%d Value", + Style = "circle", + AngleRatio = 3.0, + Minimum = 0, + Maximum = 360, + Value = 0, + Step = 10, + Interval = 0.5, + AlignmentX = -1, + AlignmentY = 1, + WeightX = 1, + WeightY = 1 + }; + spn1.AddSpecialValue(50, "50 match !!!!"); + layout.SetContent(spn1); + + Button btn = new Button(layout) { + Text = "OK", + Style = "bottom", + }; + + btn.Clicked += (s, e) => + { + spn1.Disabled = true; + spn1.Text = "100 match"; + spn1.Value = 0; + }; + + layout.SetPartContent("elm.swallow.btn", btn); + layout.SetPartText("elm.text", "Set value"); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs b/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs new file mode 100644 index 0000000..59adefd --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/CircleSpinnerTest2.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class CircleSpinnerTest2 : TestCaseBase + { + public override string TestName => "CircleSpinnerTest2"; + public override string TestDescription => "To test basic operation of Circle Spinner"; + + public override void Run(Window window) + { + Log.Debug(TestName, "CircleSpinnerTest run"); + Conformant conformant = new Conformant(window); + conformant.Show(); + + Layout layout = new Layout(window); + layout.SetTheme("layout", "circle", "spinner"); + conformant.SetContent(layout); + + CircleSpinner spn1 = new CircleSpinner(conformant) + { + Text = "Slider Test", + LabelFormat = "%d Value", + Style = "circle", + AngleRatio = 3.0, + Minimum = 0, + Maximum = 360, + Value = 0, + Step = 10, + Interval = 0.5, + AlignmentX = -1, + AlignmentY = 1, + WeightX = 1, + WeightY = 1, + // change marker + MarkerLineWidth = 40, + MarkerColor = Color.Pink, + MarkerRadius = 100, + }; + spn1.AddSpecialValue(50, "50 match !!!!"); + layout.SetContent(spn1); + + Button btn = new Button(layout) { + Text = "OK", + Style = "bottom", + }; + + layout.SetPartContent("elm.swallow.btn", btn); + layout.SetPartText("elm.text", "Set value"); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/Log.cs b/ElmSharp.Wearable.Test/TC/Log.cs new file mode 100644 index 0000000..37313aa --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/Log.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace ElmSharp.Test +{ + internal static class Log + { + const string Library = "libdlog.so.0"; + const string TAG = "ElmSharp.Test"; + + public static void Debug(string message, + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line); + } + + public static void Info(string message, + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line); + } + + public static void Error(string message, + [CallerFilePath] string file = "", + [CallerMemberName] string func = "", + [CallerLineNumber] int line = 0) + { + Print(LogPriority.DLOG_DEBUG, TAG, message, file, func, line); + } + + internal enum LogPriority + { + DLOG_UNKNOWN = 0, + DLOG_DEFAULT, + DLOG_VERBOSE, + DLOG_DEBUG, + DLOG_INFO, + DLOG_WARN, + DLOG_ERROR, + DLOG_FATAL, + DLOG_SILENT, + DLOG_PRIO_MAX, + } + + private static void Print(LogPriority priority, string tag, string message, string file, string func, int line) + { + FileInfo finfo = new FileInfo(file); + Print(priority, tag, "%s: %s(%d) > %s", finfo.Name, func, line, message); + } + + [DllImportAttribute(Library, EntryPoint = "dlog_print")] + internal static extern int Print(LogPriority prio, string tag, string fmt, string file, string func, int line, string msg); + } +} diff --git a/ElmSharp.Wearable.Test/TC/MoreOptionTest.cs b/ElmSharp.Wearable.Test/TC/MoreOptionTest.cs new file mode 100644 index 0000000..4c0e2b8 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/MoreOptionTest.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class MoreOptionTest : TestCaseBase + { + public override string TestName => "MoreOptionTest"; + + public override string TestDescription => "Wearable More Option Widget Test"; + + class ColorMoreOptionItem : MoreOptionItem + { + public Color Color; + public ColorMoreOptionItem(Window window, string iconName, Color color) + { + MainText = (iconName.First().ToString().ToUpper() + iconName.Substring(1)).Replace('_', ' '); + SubText = color.ToString(); + Icon = new Image(window); + Icon.Show(); + Icon.Load(Path.Combine(TestRunner.ResourceDir, "icons", iconName+".png")); + Color = color; + } + } + + static Color Deep(Color color) + { + return new Color(color.R / 2, color.G / 2, color.B / 2); + } + + public override void Run(Window window) + { + Conformant conf = new Conformant(window); + conf.Show(); + + MoreOption option = new MoreOption(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + Direction = MoreOptionDirection.Right + }; + option.Show(); + //option.Move(window.ScreenSize.Width/2, window.ScreenSize.Height/2); + conf.SetContent(option); + + option.Items.Add(new ColorMoreOptionItem(window, "icon_aquamarine_260_me", Color.FromHex("#800000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_auamarine_260_me", Color.FromHex("#800012"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_azure_215_me", Color.FromHex("#800034"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_beige_330_me", Color.FromHex("#800056"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_blue_45_me", Color.FromHex("#800067"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_brown_90_me", Color.FromHex("#800087"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_cyan_230_me", Color.FromHex("#800023"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_firebrick_95_me", Color.FromHex("#804300"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_gold_75_me", Color.FromHex("#854000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_green_60_me", Color.FromHex("#800340"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_honeydew_285_me", Color.FromHex("#823000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_ivory_315_me", Color.FromHex("#806700"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_khaki_360_me", Color.FromHex("#80ab00"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_lime_300_me", Color.FromHex("#800c30"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_maroon_120_me", Color.FromHex("#8fd000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_me", Color.FromHex("#800000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_orchid_160_me", Color.FromHex("#8d3000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_pink_145_me", Color.FromHex("#8002d0"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_purple_200_me", Color.FromHex("#8ff000"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_red_30_me", Color.FromHex("#800fa0"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_snow_75_me", Color.FromHex("#80f200"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_snow_80_me", Color.FromHex("#80d200"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_teal_245_me", Color.FromHex("#80f300"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_violet_180_me", Color.FromHex("#80fb00"))); + option.Items.Add(new ColorMoreOptionItem(window, "icon_yellow_345_me", Color.FromHex("#800b30"))); + + option.Opened += (s, e) => Log.Debug(TestName, "Opened!"); + option.Closed += (s, e) => Log.Debug(TestName, "Closed!"); + option.Selected += (s, e) => Log.Debug(TestName, "Selected! : " + e?.Item?.MainText); + option.Clicked += (s, e) => Log.Debug(TestName, "Clicked! : " + e?.Item?.MainText); + + option.Opened += (s, e) => option.BackgroundColor = Color.Aqua; + option.Closed += (s, e) => option.BackgroundColor = Color.Black; + + option.Selected += (s, e) => option.BackgroundColor = (e?.Item as ColorMoreOptionItem).Color; + option.Clicked += (s, e) => option.BackgroundColor = Deep((e?.Item as ColorMoreOptionItem).Color); + } + } +} diff --git a/ElmSharp.Wearable.Test/TC/RotarySelectorTest.cs b/ElmSharp.Wearable.Test/TC/RotarySelectorTest.cs new file mode 100644 index 0000000..549c580 --- /dev/null +++ b/ElmSharp.Wearable.Test/TC/RotarySelectorTest.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Linq; +using System.IO; + +using ElmSharp.Wearable; + +namespace ElmSharp.Test.TC +{ + class RotarySelectorTest : TestCaseBase + { + public override string TestName => "RotarySelectorTest"; + + public override string TestDescription => "Rotary Selector Widget Test"; + + Window _window; + + class MyRotarySelectorItem : RotarySelectorItem + { + public Color Color { get; set; } + public string Message { get; set; } + } + + MyRotarySelectorItem NewItem(string iconName, Color color) + { + Image img = new Image(_window); + img.Load(Path.Combine(TestRunner.ResourceDir, "icons", iconName + ".png")); + + string title = (iconName.First().ToString().ToUpper() + iconName.Substring(1)).Replace('_', ' '); + + return new MyRotarySelectorItem + { + Color = color, + Message = title, + MainText = title, + SubText = color.ToString(), + NormalIconImage = img, + + //PressedIconColor = Color.Green, + //IconColor = Color.Red, + + //BackgroundImage = img, + //BackgroundColor = Color.Blue, + //PressedBackgroundColor = Color.Red + + }; + } + + public override void Run(Window window) + { + this._window = window; + Conformant conf = new Conformant(window); + conf.Show(); + + RotarySelector selector = new RotarySelector(window) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + selector.Show(); + + selector.Items.Add(NewItem("icon_aquamarine_260_me", Color.FromHex("#800000"))); + selector.Items.Add(NewItem("icon_auamarine_260_me", Color.FromHex("#800012"))); + selector.Items.Add(NewItem("icon_azure_215_me", Color.FromHex("#800034"))); + selector.Items.Add(NewItem("icon_beige_330_me", Color.FromHex("#800056"))); + selector.Items.Add(NewItem("icon_blue_45_me", Color.FromHex("#800067"))); + selector.Items.Add(NewItem("icon_brown_90_me", Color.FromHex("#800087"))); + selector.Items.Add(NewItem("icon_cyan_230_me", Color.FromHex("#800023"))); + selector.Items.Add(NewItem("icon_firebrick_95_me", Color.FromHex("#804300"))); + selector.Items.Add(NewItem("icon_gold_75_me", Color.FromHex("#854000"))); + selector.Items.Add(NewItem("icon_green_60_me", Color.FromHex("#800340"))); + selector.Items.Add(NewItem("icon_honeydew_285_me", Color.FromHex("#823000"))); + selector.Items.Add(NewItem("icon_ivory_315_me", Color.FromHex("#806700"))); + selector.Items.Add(NewItem("icon_khaki_360_me", Color.FromHex("#80ab00"))); + selector.Items.Add(NewItem("icon_lime_300_me", Color.FromHex("#800c30"))); + selector.Items.Add(NewItem("icon_maroon_120_me", Color.FromHex("#8fd000"))); + selector.Items.Add(NewItem("icon_me", Color.FromHex("#800000"))); + selector.Items.Add(NewItem("icon_orchid_160_me", Color.FromHex("#8d3000"))); + selector.Items.Add(NewItem("icon_pink_145_me", Color.FromHex("#8002d0"))); + selector.Items.Add(NewItem("icon_purple_200_me", Color.FromHex("#8ff000"))); + selector.Items.Add(NewItem("icon_red_30_me", Color.FromHex("#800fa0"))); + selector.Items.Add(NewItem("icon_snow_75_me", Color.FromHex("#80f200"))); + selector.Items.Add(NewItem("icon_snow_80_me", Color.FromHex("#80d200"))); + selector.Items.Add(NewItem("icon_teal_245_me", Color.FromHex("#80f300"))); + selector.Items.Add(NewItem("icon_violet_180_me", Color.FromHex("#80fb00"))); + selector.Items.Add(NewItem("icon_yellow_345_me", Color.FromHex("#800b30"))); + //selector.BackgroundImage = new Image(window); + //selector.BackgroundImage.Load(Path.Combine(TestRunner.ResourceDir, "icons", "round_bg_green.png")); + //selector.BackgroundColor = Color.Pink; + //selector.PressedBackgroundColor = Color.Gray; + conf.SetContent(selector); + + } + } +} diff --git a/ElmSharp.Wearable.Test/TestCaseBase.cs b/ElmSharp.Wearable.Test/TestCaseBase.cs new file mode 100644 index 0000000..5803eaa --- /dev/null +++ b/ElmSharp.Wearable.Test/TestCaseBase.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp; + +namespace ElmSharp.Test +{ + public abstract class TestCaseBase + { + public abstract string TestName { get; } + public abstract string TestDescription { get; } + public abstract void Run(Window window); + } +} diff --git a/ElmSharp.Wearable.Test/TestRunner.cs b/ElmSharp.Wearable.Test/TestRunner.cs new file mode 100644 index 0000000..927f2b6 --- /dev/null +++ b/ElmSharp.Wearable.Test/TestRunner.cs @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Collections.Generic; + +using Tizen.Applications; + +namespace ElmSharp.Test +{ + public class TestRunner : CoreUIApplication + { + internal Window _firstPageWindow; + private static bool s_terminated; + + public static string ResourceDir { get; private set; } + + public TestRunner() + { + s_terminated = false; + } + + protected override void OnCreate() + { + ResourceDir = DirectoryInfo.Resource; + + var testCases = GetTestCases(); + CreateFirstPage(testCases); + base.OnCreate(); + } + + protected override void OnTerminate() + { + s_terminated = true; + base.OnTerminate(); + } + + public void RunStandalone(string[] args) + { + ResourceDir = Path.Combine(Path.GetDirectoryName(typeof(TestRunner).GetTypeInfo().Assembly.Location), "res"); + + EcoreSynchronizationContext.Initialize(); + + var testCases = GetTestCases(); + TestCaseBase theTest = null; + + if (args.Count() > 0) + { + theTest = testCases.Where((testCase) => testCase.TestName == args[0] || testCase.GetType().ToString() == args[0]).FirstOrDefault(); + } + + if (theTest != null) + { + StartTC(theTest); + EcoreMainloop.Begin(); + } + else + { + CreateFirstPage(testCases); + EcoreMainloop.Begin(); + } + + Elementary.Shutdown(); + } + + private IEnumerable<TestCaseBase> GetTestCases() + { + Assembly asm = typeof(TestRunner).GetTypeInfo().Assembly; + Type testCaseType = typeof(TestCaseBase); + + var tests = from test in asm.GetTypes() + where testCaseType.IsAssignableFrom(test) && !test.GetTypeInfo().IsInterface && !test.GetTypeInfo().IsAbstract + select Activator.CreateInstance(test) as TestCaseBase; + + return from test in tests + orderby test.TestName + select test; + } + + internal static void UIExit() + { + EcoreMainloop.Quit(); + } + + private Window CreateWindow(bool isSecond = false) + { + Window window = new Window("ElmSharp UI Tests") + { + AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90 + }; + window.Show(); + if (isSecond) + { + window.BackButtonPressed += (s, e) => + { + window.Hide(); + window.Unrealize(); + GC.Collect(); + GC.WaitForPendingFinalizers(); + }; + } + else + { + window.BackButtonPressed += (s, e) => + { + UIExit(); + }; + } + return window; + } + + private void CreateFirstPage(IEnumerable<TestCaseBase> testCases) + { + _firstPageWindow = CreateWindow(); + Console.WriteLine("Screen DPI : {0}", _firstPageWindow.ScreenDpi.X); + Conformant conformant = new Conformant(_firstPageWindow); + conformant.Show(); + Box box = new Box(_firstPageWindow) + { + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1, + }; + box.Show(); + var bg = new Background(_firstPageWindow); + bg.Color = Color.White; + bg.SetContent(box); + conformant.SetContent(bg); + + GenList list = new GenList(_firstPageWindow) + { + Homogeneous = true, + AlignmentX = -1, + AlignmentY = -1, + WeightX = 1, + WeightY = 1 + }; + + GenItemClass defaultClass = new GenItemClass("default") + { + GetTextHandler = (data, part) => + { + return string.Format("{0}",(string)data); + } + }; + + list.Append(defaultClass, ""); + foreach (var tc in testCases) + { + list.Append(defaultClass, tc.TestName); + } + list.Append(defaultClass, ""); + + list.ItemSelected += (s, e) => + { + foreach (var tc in testCases) + { + if (tc.TestName == (string)(e.Item.Data)) + { + StartTCFromList(tc); + break; + } + } + }; + list.Show(); + + box.PackEnd(list); + } + + private void StartTC(TestCaseBase tc) + { + Window window = CreateWindow(); + tc.Run(window); + } + + private void StartTCFromList(TestCaseBase tc) + { + Window window = CreateWindow(true); + tc.Run(window); + } + + static void Main(string[] args) + { + Elementary.Initialize(); + Elementary.ThemeOverlay(); + + Console.WriteLine("ELM_PROFILE : {0}", Elementary.GetProfile()); + Console.WriteLine("ELM_SCALE : {0}", Elementary.GetScale()); + + TestRunner testRunner = new TestRunner(); + testRunner.Run(args); + + // if running with appfw is failed, below line will be executed. + if (!s_terminated) + { + testRunner.RunStandalone(args); + } + } + } +} diff --git a/ElmSharp.Wearable.Test/res/icons/bg_black.png b/ElmSharp.Wearable.Test/res/icons/bg_black.png Binary files differnew file mode 100644 index 0000000..08a258a --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/bg_black.png diff --git a/ElmSharp.Wearable.Test/res/icons/bg_red.png b/ElmSharp.Wearable.Test/res/icons/bg_red.png Binary files differnew file mode 100644 index 0000000..b8ccbb5 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/bg_red.png diff --git a/ElmSharp.Wearable.Test/res/icons/bg_white.png b/ElmSharp.Wearable.Test/res/icons/bg_white.png Binary files differnew file mode 100644 index 0000000..1041aa0 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/bg_white.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_aquamarine_260_me.png b/ElmSharp.Wearable.Test/res/icons/icon_aquamarine_260_me.png Binary files differnew file mode 100644 index 0000000..f6ea110 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_aquamarine_260_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_auamarine_260_me.png b/ElmSharp.Wearable.Test/res/icons/icon_auamarine_260_me.png Binary files differnew file mode 100644 index 0000000..d35eeca --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_auamarine_260_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_azure_215_me.png b/ElmSharp.Wearable.Test/res/icons/icon_azure_215_me.png Binary files differnew file mode 100644 index 0000000..17e613c --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_azure_215_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_beige_330_me.png b/ElmSharp.Wearable.Test/res/icons/icon_beige_330_me.png Binary files differnew file mode 100644 index 0000000..7bfac09 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_beige_330_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_blue_45_me.png b/ElmSharp.Wearable.Test/res/icons/icon_blue_45_me.png Binary files differnew file mode 100644 index 0000000..7da3ffa --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_blue_45_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_brown_90_me.png b/ElmSharp.Wearable.Test/res/icons/icon_brown_90_me.png Binary files differnew file mode 100644 index 0000000..4b176aa --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_brown_90_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_cyan_230_me.png b/ElmSharp.Wearable.Test/res/icons/icon_cyan_230_me.png Binary files differnew file mode 100644 index 0000000..c846907 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_cyan_230_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_firebrick_95_me.png b/ElmSharp.Wearable.Test/res/icons/icon_firebrick_95_me.png Binary files differnew file mode 100644 index 0000000..faaeb6c --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_firebrick_95_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_gold_75_me.png b/ElmSharp.Wearable.Test/res/icons/icon_gold_75_me.png Binary files differnew file mode 100644 index 0000000..b0a23b7 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_gold_75_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_green_60_me.png b/ElmSharp.Wearable.Test/res/icons/icon_green_60_me.png Binary files differnew file mode 100644 index 0000000..617703f --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_green_60_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_honeydew_285_me.png b/ElmSharp.Wearable.Test/res/icons/icon_honeydew_285_me.png Binary files differnew file mode 100644 index 0000000..b25e59c --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_honeydew_285_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_ivory_315_me.png b/ElmSharp.Wearable.Test/res/icons/icon_ivory_315_me.png Binary files differnew file mode 100644 index 0000000..1617f72 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_ivory_315_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_khaki_360_me.png b/ElmSharp.Wearable.Test/res/icons/icon_khaki_360_me.png Binary files differnew file mode 100644 index 0000000..89ee897 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_khaki_360_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_lime_300_me.png b/ElmSharp.Wearable.Test/res/icons/icon_lime_300_me.png Binary files differnew file mode 100644 index 0000000..685c002 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_lime_300_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_maroon_120_me.png b/ElmSharp.Wearable.Test/res/icons/icon_maroon_120_me.png Binary files differnew file mode 100644 index 0000000..822d1ec --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_maroon_120_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_me.png b/ElmSharp.Wearable.Test/res/icons/icon_me.png Binary files differnew file mode 100644 index 0000000..a0ec18c --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_orchid_160_me.png b/ElmSharp.Wearable.Test/res/icons/icon_orchid_160_me.png Binary files differnew file mode 100644 index 0000000..c063483 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_orchid_160_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_pink_145_me.png b/ElmSharp.Wearable.Test/res/icons/icon_pink_145_me.png Binary files differnew file mode 100644 index 0000000..d0934f0 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_pink_145_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_purple_200_me.png b/ElmSharp.Wearable.Test/res/icons/icon_purple_200_me.png Binary files differnew file mode 100644 index 0000000..69468e2 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_purple_200_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_red_30_me.png b/ElmSharp.Wearable.Test/res/icons/icon_red_30_me.png Binary files differnew file mode 100644 index 0000000..66bbd09 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_red_30_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_snow_75_me.png b/ElmSharp.Wearable.Test/res/icons/icon_snow_75_me.png Binary files differnew file mode 100644 index 0000000..e6d82d7 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_snow_75_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_snow_80_me.png b/ElmSharp.Wearable.Test/res/icons/icon_snow_80_me.png Binary files differnew file mode 100644 index 0000000..b419131 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_snow_80_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_teal_245_me.png b/ElmSharp.Wearable.Test/res/icons/icon_teal_245_me.png Binary files differnew file mode 100644 index 0000000..db1a10c --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_teal_245_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_violet_180_me.png b/ElmSharp.Wearable.Test/res/icons/icon_violet_180_me.png Binary files differnew file mode 100644 index 0000000..df07406 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_violet_180_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/icon_yellow_345_me.png b/ElmSharp.Wearable.Test/res/icons/icon_yellow_345_me.png Binary files differnew file mode 100644 index 0000000..9af0e0f --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/icon_yellow_345_me.png diff --git a/ElmSharp.Wearable.Test/res/icons/make_icon.sh b/ElmSharp.Wearable.Test/res/icons/make_icon.sh new file mode 100644 index 0000000..31f6fe8 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/make_icon.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +OPTIND=1 + +while getopts "h?c:r:" opt; do + case "$opt" in + h|\?) + echo "$0 [-c color] [-r degree]" + exit 0 + ;; + c) color=$OPTARG + ;; + r) rotate=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) +filename=$1 +iconname=$2 + +if [ -z $color ]; then + color="white" +fi + +if [ -z $rotate ]; then + rotate=0 +fi + +if [ -z $toname ]; then + iconname="icon_${color}_${rotate}_$filename" +fi + +convert $filename -resize 75x75 \ + -stroke $color -fill none -draw "stroke-width 5 circle 37, 37, 60, 60" \ + \( +clone -threshold -1 -negate -fill white -draw "ellipse 37, 37 36, 36 4, 176 ellipse 37, 37, 36, 36 184, 356" \) \ + -distort SRT $rotate \ + -alpha off -compose copy_opacity -composite $iconname + diff --git a/ElmSharp.Wearable.Test/res/icons/me.png b/ElmSharp.Wearable.Test/res/icons/me.png Binary files differnew file mode 100644 index 0000000..1653fa6 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/me.png diff --git a/ElmSharp.Wearable.Test/res/icons/me_circle.png b/ElmSharp.Wearable.Test/res/icons/me_circle.png Binary files differnew file mode 100644 index 0000000..f52d56a --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/me_circle.png diff --git a/ElmSharp.Wearable.Test/res/icons/me_small.png b/ElmSharp.Wearable.Test/res/icons/me_small.png Binary files differnew file mode 100644 index 0000000..f024c79 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/me_small.png diff --git a/ElmSharp.Wearable.Test/res/icons/pressed.png b/ElmSharp.Wearable.Test/res/icons/pressed.png Binary files differnew file mode 100644 index 0000000..a0a9abb --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/pressed.png diff --git a/ElmSharp.Wearable.Test/res/icons/round_bg_green.png b/ElmSharp.Wearable.Test/res/icons/round_bg_green.png Binary files differnew file mode 100644 index 0000000..c13f8c1 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/round_bg_green.png diff --git a/ElmSharp.Wearable.Test/res/icons/round_bg_white.png b/ElmSharp.Wearable.Test/res/icons/round_bg_white.png Binary files differnew file mode 100644 index 0000000..9499af8 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/round_bg_white.png diff --git a/ElmSharp.Wearable.Test/res/icons/round_bg_yellow.png b/ElmSharp.Wearable.Test/res/icons/round_bg_yellow.png Binary files differnew file mode 100644 index 0000000..a2e1d91 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/round_bg_yellow.png diff --git a/ElmSharp.Wearable.Test/res/icons/round_content_black.png b/ElmSharp.Wearable.Test/res/icons/round_content_black.png Binary files differnew file mode 100644 index 0000000..4034791 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/round_content_black.png diff --git a/ElmSharp.Wearable.Test/res/icons/round_content_blue.png b/ElmSharp.Wearable.Test/res/icons/round_content_blue.png Binary files differnew file mode 100644 index 0000000..f4e5be9 --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/round_content_blue.png diff --git a/ElmSharp.Wearable.Test/res/icons/round_content_red.png b/ElmSharp.Wearable.Test/res/icons/round_content_red.png Binary files differnew file mode 100644 index 0000000..1951a9d --- /dev/null +++ b/ElmSharp.Wearable.Test/res/icons/round_content_red.png diff --git a/ElmSharp.Wearable.Test/shared/res/ElmSharp.Wearable.Test.png b/ElmSharp.Wearable.Test/shared/res/ElmSharp.Wearable.Test.png Binary files differnew file mode 100644 index 0000000..9765b1b --- /dev/null +++ b/ElmSharp.Wearable.Test/shared/res/ElmSharp.Wearable.Test.png diff --git a/ElmSharp.Wearable.Test/tizen-manifest.xml b/ElmSharp.Wearable.Test/tizen-manifest.xml new file mode 100644 index 0000000..623eb7c --- /dev/null +++ b/ElmSharp.Wearable.Test/tizen-manifest.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="ElmSharpTest.Wearable" version="1.0.0"> + <profile name="wearable" /> + <ui-application appid="org.tizen.ElmSharp.Wearable.Test" + exec="ElmSharp.Wearable.Test.exe" + type="dotnet" + multiple="false" + taskmanage="true" + launch_mode="single"> + <icon>ElmSharp.Wearable.Test.png</icon> + <label>ElmSharp.Wearable.Test</label> + </ui-application> +</manifest> diff --git a/ElmSharp.Wearable/ElmSharp.Wearable.csproj b/ElmSharp.Wearable/ElmSharp.Wearable.csproj new file mode 100644 index 0000000..30674e5 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable.csproj @@ -0,0 +1,8 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <TargetFramework>netstandard1.3</TargetFramework> + </PropertyGroup> + <ItemGroup> + <ProjectReference Include="..\ElmSharp\ElmSharp.csproj" /> + </ItemGroup> +</Project> diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs b/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs new file mode 100644 index 0000000..7834970 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + /// <summary> + /// 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 + { + IntPtr circleHandle; + + /// <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) { } + + /// <summary> + /// Sets or gets the disabled state of the Circle DateTime Selector + /// </summary> + public bool Disabled + { + 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 color of the marker + /// </summary> + public Color MarkerColor + { + get + { + int r, g, b, 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); + } + } + + /// <summary> + /// Sets or gets the line width of the marker + /// </summary> + public int MarkerLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets the radius at which the center of the marker lies + /// </summary> + public double MarkerRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value); + } + } + + 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_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); + + return handle; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs b/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs new file mode 100644 index 0000000..c987009 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + /// <summary> + /// 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 + { + IntPtr circleHandle; + + /// <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) { } + + /// <summary> + /// Sets or gets the disabled state of the Circle GenList Selector + /// </summary> + public bool Disabled + { + 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 color of the scroll background + /// </summary> + public Color VerticalScrollBackgroundColor + { + 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); + 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); + } + } + + /// <summary> + /// Sets or gets the line width of the scroll background + /// </summary> + public int VerticalScrollBackgroundLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets the redius of the scroll background + /// </summary> + public double VerticalScrollBackgroundRadius + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets the color of the scroll bar + /// </summary> + public Color VerticalScrollBarColor + { + get + { + int r, g, b, 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); + } + } + + /// <summary> + /// Sets or gets the line width of the scroll bar + /// </summary> + public int VerticalScrollBarLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets the redius of the scroll bar + /// </summary> + public double VerticalScrollBarRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value); + } + } + + /// <summary> + /// Sets or gets the policy if the scroll bar is visible + /// </summary> + /// <remarks> + /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// </remarks> + public ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy + { + get + { + int 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); + } + } + + 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); + + return handle; + } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs b/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs new file mode 100644 index 0000000..95fcbae --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +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 + { + private IntPtr _circleHandle; + + /// <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) + { + } + + + /// <summary> + /// Sets or gets the value of ProgressBar. + /// </summary> + public double Value + { + get + { + return Interop.Eext.eext_circle_object_value_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_value_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets the maximum value of ProgressBar. + /// </summary> + public double Maximum + { + get + { + double max = 0; + double min = 0; + 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(_circleHandle, min, value); + } + } + + /// <summary> + /// Sets or gets the minimum value of ProgressBar. + /// </summary> + public double Minimum + { + get + { + double max = 0; + double min = 0; + 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(_circleHandle, value, max); + } + } + + /// <summary> + /// Sets or gets the angle value of ProgressBar. + /// </summary> + public double BarAngle + { + get + { + return Interop.Eext.eext_circle_object_angle_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_angle_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets the angle value of Background ProgressBar. + /// </summary> + public double BackgroundAngle + { + get + { + return Interop.Eext.eext_circle_object_item_angle_get(_circleHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_set(_circleHandle, "bg", value); + } + } + + /// <summary> + /// Sets or gets the angle offset value of ProgressBar. + /// </summary> + public double BarAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_angle_offset_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_angle_offset_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets the angle offset value of Background ProgressBar. + /// </summary> + public double BackgroundAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_item_angle_offset_get(_circleHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_offset_set(_circleHandle, "bg", value); + } + } + + /// <summary> + /// Sets or gets the maximum angle value of ProgressBar. + /// </summary> + public double BarAngleMaximum + { + get + { + double max = 0; + double min = 0; + 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(_circleHandle, min, value); + } + } + + /// <summary> + /// Sets or gets the minimum angle value of ProgressBar. + /// </summary> + public double BarAngleMinimum + { + get + { + double max = 0; + double min = 0; + 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(_circleHandle, value, max); + } + } + + /// <summary> + /// Sets or gets disable status of Circle ProgressBar. + /// </summary> + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets color of ProgressBar. + /// </summary> + public Color BarColor + { + get + { + int r = 0; + 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); + return Color.FromRgba(r, g, b, a); + } + set + { + 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 + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + 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(_circleHandle, "bg", value.R, value.G, value.B, value.A); + } + } + + /// <summary> + /// Sets or gets line width of ProgressBar. + /// </summary> + public int BarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_line_width_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_line_width_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets line width of Background ProgressBar. + /// </summary> + public int BackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "bg", value); + } + } + + /// <summary> + /// Sets or gets radius of ProgressBar. + /// </summary> + public double BarRadius + { + get + { + return Interop.Eext.eext_circle_object_radius_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_radius_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets radius of Background ProgressBar. + /// </summary> + public double BackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "bg"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "bg", value); + } + } + + 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); + } + + _circleHandle = 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(_circleHandle, w, h); + } + + Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true); + return parent.Handle; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs b/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs new file mode 100644 index 0000000..c786615 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + /// <summary> + /// Circle scroller provides scrollbar with circular movement and is scrolled by rotary event. + /// </summary> + public class CircleScroller : Scroller + { + private IntPtr _circleHandle; + + /// <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) + { + } + + /// <summary> + /// Sets or gets disabled state of the circle scroller object. + /// </summary> + public bool Disabled + { + 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 HorizontalScrollBarVisiblePolicy + /// </summary> + /// <remarks> + /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// </remarks> + public override ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy + { + get + { + int policy; + 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); + } + } + + /// <summary> + /// Sets or gets the value of VerticalScrollBarVisiblePolicy + /// </summary> + /// <remarks> + /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// </remarks> + public override ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy + { + get + { + int 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); + } + } + + /// <summary> + /// Sets or gets color of the vertical scroll bar. + /// </summary> + public Color VerticalScrollBarColor + { + get + { + int r = 0; + 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); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_color_set(_circleHandle, value.R, value.G, value.B, value.A); + } + } + + /// <summary> + /// Sets or gets color of the horizontal scroll bar. + /// </summary> + public Color HorizontalScrollBarColor + { + get + { + int r = 0; + 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); + 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); + } + } + + /// <summary> + /// Sets or gets color of the vertical scroll background. + /// </summary> + public Color VerticalScrollBackgroundColor + { + get + { + int r = 0; + 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); + 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); + } + } + + /// <summary> + /// Sets or gets color of the horizontal scroll background. + /// </summary> + public Color HorizontalScrollBackgroundColor + { + get + { + int r = 0; + 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); + 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); + } + } + + /// <summary> + /// Sets or gets line width of the vertical scroll bar. + /// </summary> + public int VerticalScrollBarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_line_width_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_line_width_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets line width of the horizontal scroll bar. + /// </summary> + public int HorizontalScrollBarLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets line width of the vertical scroll background. + /// </summary> + public int VerticalScrollBackgroundLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets line width of the horizontal scroll background. + /// </summary> + public int HorizontalScrollBackgroundLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets radius of the vertical scroll bar. + /// </summary> + public double VerticalScrollBarRadius + { + get + { + return Interop.Eext.eext_circle_object_radius_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_radius_set(_circleHandle, value); + } + } + + /// <summary> + /// Sets or gets radius of the horizontal scroll bar. + /// </summary> + public double HorizontalScrollBarRadius + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets radius of the vertical scroll background. + /// </summary> + public double VerticalScrollBackgroundRadius + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets radius of the horizontal scroll background. + /// </summary> + public double HorizontalScrollBackgroundRadius + { + get + { + 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); + } + } + + 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); + return handle; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs b/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs new file mode 100644 index 0000000..8cf026c --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +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 event EventHandler Changed; + + SmartEvent _changedEvent; + + /// <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) + { + _changedEvent = new SmartEvent(this, "value,changed"); + + _changedEvent.On += (s, e) => Changed?.Invoke(this, EventArgs.Empty); + } + + /// <summary> + /// Sets or gets the step by which the circle slider bar moves. + /// </summary> + /// <remarks> + /// This value is used when circle slider value is changed by an drag or rotary event + /// The value of the slider is increased/decreased by the step value. + /// </remarks> + public double Step + { + get + { + return Interop.Eext.eext_circle_object_slider_step_get(RealHandle); + } + set + { + Interop.Eext.eext_circle_object_slider_step_set(RealHandle, (double)value); + } + } + + /// <summary> + /// Sets or gets disabled state of the circle slider object. + /// </summary> + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_disabled_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets color of the circle slider bar. + /// </summary> + public Color BarColor + { + get + { + int r = 0; + 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); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_color_set(RealHandle, value.R, value.G, value.B, value.A); + } + } + + /// <summary> + /// Sets or gets color of the circle slider background. + /// </summary> + public Color BackgroundColor + { + get + { + int r = 0; + 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); + 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); + } + } + + /// <summary> + /// Sets or gets the line with of the circle slider bar. + /// </summary> + public int BarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_line_width_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_line_width_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets the line with of the circle slider background. + /// </summary> + public int BackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(RealHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(RealHandle, "bg", value); + } + } + + /// <summary> + /// Sets or gets the angle in degree of the circle slider bar. + /// </summary> + public double BarAngle + { + get + { + return Interop.Eext.eext_circle_object_angle_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_angle_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets the angle in degree of the circle slider background. + /// </summary> + public double BackgroundAngle + { + get + { + return Interop.Eext.eext_circle_object_item_angle_get(RealHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_set(RealHandle, "bg", value); + } + } + + /// <summary> + /// Sets or gets the angle offset for the slider bar. + /// offset value means start position of the slider bar. + /// </summary> + public double BarAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_angle_offset_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_angle_offset_set(RealHandle, value); + } + } + + /// <summary> + /// Sets or gets the angle offset for the circle slider background. + /// offset value means start position of the slider background. + /// </summary> + public double BackgroundAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_item_angle_offset_get(RealHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_offset_set(RealHandle, "bg", value); + } + } + + /// <summary> + /// Sets or gets the minimum angle of the circle slider bar. + /// </summary> + public double BarAngleMinimum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_angle_min_max_get(RealHandle, out min, out max); + return min; + } + set + { + double max = BarAngleMaximum; + Interop.Eext.eext_circle_object_angle_min_max_set(RealHandle, (double)value, max); + } + } + + /// <summary> + /// Sets or gets the maximum angle of the circle slider bar. + /// </summary> + public double BarAngleMaximum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_angle_min_max_get(RealHandle, out min, out max); + return max; + } + set + { + double min = BarAngleMinimum; + Interop.Eext.eext_circle_object_angle_min_max_set(RealHandle, min, (double)value); + } + } + + /// <summary> + /// Sets or gets the minimum values for the circle slider. + /// </summary> + /// <remarks> + /// This defines the allowed minimum values to be selected by the user. + /// If the actual value is less than min, it is updated to min. + /// Actual value can be obtained with Value.By default, min is equal to 0.0. + /// </remarks> + public double Minimum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_value_min_max_get(RealHandle, out min, out max); + return min; + } + set + { + double max = Maximum; + Interop.Eext.eext_circle_object_value_min_max_set(RealHandle, (double)value, max); + } + } + + /// <summary> + /// Sets or gets the maximum values for the circle slider. + /// </summary> + /// <remarks> + /// This defines the allowed maximum values to be selected by the user. + /// If the actual value is bigger then max, it is updated to max. + /// Actual value can be obtained with Value.By default, min is equal to 0.0, and max is equal to 1.0. + /// Maximum must be greater than minimum, otherwise the behavior is undefined. + /// </remarks> + public double Maximum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_value_min_max_get(RealHandle, out min, out max); + return max; + } + set + { + double min = Minimum; + Interop.Eext.eext_circle_object_value_min_max_set(RealHandle, min, (double)value); + } + } + + /// <summary> + /// Gets or sets the value displayed by the circle slider. + /// </summary> + /// <remarks> + /// The value must to be between Minimum and Maximum values. + /// </remarks> + public double Value + { + get + { + return Interop.Eext.eext_circle_object_value_get(RealHandle); + } + set + { + Interop.Eext.eext_circle_object_value_set(RealHandle, (double)value); + } + } + + /// <summary> + /// Gets or sets the radius value for the circle slider bar. + /// </summary> + public double BarRadius + { + get + { + return Interop.Eext.eext_circle_object_radius_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_radius_set(RealHandle, value); + } + } + + /// <summary> + /// Gets or sets the radius value for the circle slider background. + /// </summary> + public double BackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(RealHandle, "bg"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(RealHandle, "bg", value); + } + } + + 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; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs b/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs new file mode 100644 index 0000000..e85d589 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + + /// <summary> + /// The Circle Spinner is a widget to display and handle spinner value by rotary event + /// Inherits <see cref="Spinner"/>. + /// </summary> + public class CircleSpinner : Spinner + { + private IntPtr _circleHandle; + private double _angleRatio = 1.0; + + /// <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) + { + } + + /// <summary> + /// Sets or gets the circle spinner angle per each spinner value. + /// </summary> + public double AngleRatio + { + get + { + return _angleRatio; + } + set + { + _angleRatio = value; + Interop.Eext.eext_circle_object_spinner_angle_set(_circleHandle, _angleRatio); + } + } + + /// <summary> + /// Sets or gets disabled state of the circle spinner object. + /// </summary> + public bool Disabled + { + 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 line width of the marker + /// </summary> + public int MarkerLineWidth + { + get + { + 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); + } + } + + /// <summary> + /// Sets or gets the color of the marker + /// </summary> + public Color MarkerColor + { + get + { + int r, g, b, 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); + } + } + + /// <summary> + /// Sets or gets the radius at which the center of the marker lies + /// </summary> + public double MarkerRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "default", value); + } + } + + 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); + return handle; + } + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs new file mode 100644 index 0000000..7f75cc1 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs @@ -0,0 +1,89 @@ + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ElmSharp.Wearable +{ + public class MoreOption : Layout + { + + public IList<MoreOptionItem> Items { get; private set; } + + public event EventHandler<MoreOptionItemEventArgs> Selected; + public event EventHandler<MoreOptionItemEventArgs> Clicked; + public event EventHandler Opened; + public event EventHandler Closed; + + SmartEvent<PointerEventArgs> _selectedEvent; + SmartEvent<PointerEventArgs> _clickedEvent; + SmartEvent _openedEvent; + SmartEvent _closedEvent; + + public MoreOption(EvasObject parent) : base(parent) + { + Items = new MoreOptionList(this); + + _selectedEvent = new SmartEvent<PointerEventArgs>(this, "item,selected", (d, o, info) => new PointerEventArgs { Pointer = info }); + _clickedEvent = new SmartEvent<PointerEventArgs>(this, "item,clicked", (d, o, info) => new PointerEventArgs { Pointer = info }); + _openedEvent = new SmartEvent(this, "more,option,opened"); + _closedEvent = new SmartEvent(this, "more,option,closed"); + + _selectedEvent.On += (s, e) => + { + MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Selected?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected }); + }; + + _clickedEvent.On += (s, e) => + { + MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Clicked?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected }); + }; + + _openedEvent.On += (s, e) => Opened?.Invoke(this, EventArgs.Empty); + _closedEvent.On += (s, e) => Closed?.Invoke(this, EventArgs.Empty); + + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Eext.eext_more_option_add(parent); + } + + public MoreOptionDirection Direction + { + get + { + int dir = Interop.Eext.eext_more_option_direction_get(this); + return (MoreOptionDirection)dir; + } + + set + { + Interop.Eext.eext_more_option_direction_set(this, (int)value); + } + } + + public bool IsOpened + { + get + { + return Interop.Eext.eext_more_option_opened_get(this); + } + + set + { + Interop.Eext.eext_more_option_opened_set(this, value); + } + } + } + + public enum MoreOptionDirection + { + Top, + Bottom, + Left, + Right + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs new file mode 100644 index 0000000..ad5bf58 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class MoreOptionItem + { + const string MainTextPartName = "selector,main_text"; + const string SubTextPartName = "selector,sub_text"; + const string IconPartName = "item,icon"; + + string _mainText; + string _subText; + Image _icon; + IntPtr _handle; + + public IntPtr Handle + { + get + { + return _handle; + } + set + { + if (_handle == value) return; + _handle = value; + if (_mainText != null) + Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText); + if (_subText != null) + Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText); + if (_icon != null) + Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon); + } + } + + public MoreOptionItem() + { + _icon = null; + } + + public string MainText + { + set + { + if (_mainText == value) return; + _mainText = value; + if (Handle != IntPtr.Zero) + { + Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText); + } + } + + get + { + return _mainText; + } + } + + public string SubText + { + set + { + if (_subText == value) return; + _subText = value; + if (Handle != IntPtr.Zero) + { + Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText); + } + } + + get + { + return _subText; + } + } + + public Image Icon + { + set + { + if (_icon == value) return; + _icon = value; + if (Handle != IntPtr.Zero) + { + Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon); + } + } + get + { + return _icon; + } + } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs new file mode 100644 index 0000000..7bc9723 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs @@ -0,0 +1,10 @@ + +using System; + +namespace ElmSharp.Wearable +{ + public class MoreOptionItemEventArgs : EventArgs + { + public MoreOptionItem Item { get; set; } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs new file mode 100644 index 0000000..577bc8e --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + class MoreOptionList : IList<MoreOptionItem> + { + MoreOption Owner { get; set; } + + List<MoreOptionItem> Items { get; set; } + + public int Count => Items.Count; + + public bool IsReadOnly => false; + + public MoreOptionItem this[int index] + { + get + { + return Items[index]; + } + + set + { + Items[index] = value; + } + } + + public MoreOptionList(MoreOption owner) + { + Owner = owner; + Items = new List<MoreOptionItem>(); + } + + public void Add(MoreOptionItem item) + { + item.Handle = Interop.Eext.eext_more_option_item_append(Owner); + Items.Add(item); + } + + public void AddFirst(MoreOptionItem item) + { + item.Handle = Interop.Eext.eext_more_option_item_prepend(Owner); + Items.Insert(0, item); + } + + public void AddLast(MoreOptionItem item) + { + Add(item); + } + + public int IndexOf(MoreOptionItem item) + { + return Items.IndexOf(item); + } + + public void Insert(int index, MoreOptionItem item) + { + if (Items.Count < index + 1 || index < 0) + throw new ArgumentOutOfRangeException("index is not valid in the MoreOption"); + + MoreOptionItem target = Items[index]; + item.Handle = Interop.Eext.eext_more_option_item_insert_after(Owner, target.Handle); + Items.Insert(index, item); + } + + public void RemoveAt(int index) + { + if (Items.Count < index + 1 || index < 0) + throw new ArgumentOutOfRangeException("index is not valid in the MoreOptionList"); + + MoreOptionItem item = Items[index]; + Interop.Eext.eext_more_option_item_del(item.Handle); + item.Handle = IntPtr.Zero; + Items.RemoveAt(index); + } + + public void Clear() + { + Interop.Eext.eext_more_option_items_clear(Owner); + foreach (MoreOptionItem item in Items) + { + item.Handle = IntPtr.Zero; + } + Items.Clear(); + } + + public bool Contains(MoreOptionItem item) + { + return Items.Contains(item); + } + + public void CopyTo(MoreOptionItem[] array, int arrayIndex) + { + Items.CopyTo(array, arrayIndex); + } + + public bool Remove(MoreOptionItem item) + { + if (Items.Contains(item)) + { + Interop.Eext.eext_more_option_item_del(item.Handle); + Items.Remove(item); + return true; + } + return false; + } + + public IEnumerator<MoreOptionItem> GetEnumerator() + { + return Items.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return Items.GetEnumerator(); + } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs b/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs new file mode 100644 index 0000000..d746824 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + class PointerEventArgs : EventArgs + { + public IntPtr Pointer { get; set; } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs new file mode 100644 index 0000000..eb0181c --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class RotarySelector : Layout + { + const string IconPartName = "selector,icon"; + const string ContentPartName = "selector,content"; + const string BgPartName = "selector,bg_image"; + + const string ItemSelectedEventName = "item,selected"; + const string ItemClickedEventName = "item,clicked"; + + public event EventHandler<RotarySelectorItemEventArgs> Selected; + public event EventHandler<RotarySelectorItemEventArgs> Clicked; + + SmartEvent<PointerEventArgs> _selectedEvent; + SmartEvent<PointerEventArgs> _clickedEvent; + Image _normalBgImage; + + public IList<RotarySelectorItem> Items { get; private set; } + + public RotarySelector(EvasObject parent) : base(parent) + { + Items = new RotarySelectorList(this); + + _selectedEvent = new SmartEvent<PointerEventArgs>(this, "item,selected", (d, o, info) => new PointerEventArgs { Pointer = info }); + _clickedEvent = new SmartEvent<PointerEventArgs>(this, "item,clicked", (d, o, info) => new PointerEventArgs { Pointer = info }); + _selectedEvent.On += (s, e) => + { + RotarySelectorItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Selected?.Invoke(this, new RotarySelectorItemEventArgs { Item = selected }); + }; + + _clickedEvent.On += (s, e) => + { + RotarySelectorItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Clicked?.Invoke(this, new RotarySelectorItemEventArgs { Item = selected }); + }; + } + + public RotarySelectorItem SelectedItem + { + get + { + IntPtr selectedPtr = Interop.Eext.eext_rotary_selector_selected_item_get(this); + if (selectedPtr == IntPtr.Zero) return null; + RotarySelectorItem item = Items.FirstOrDefault(i => i.Handle == selectedPtr); + return item; + } + + set + { + if (!Items.Contains(value)) return; + Interop.Eext.eext_rotary_selector_selected_item_set(this, value.Handle); + } + } + + void setPart(ref Image prop, string partName, State state, Image img) + { + if (prop == img) return; + prop = img; + if (this != null) + { + Interop.Eext.eext_rotary_selector_part_content_set(this, partName, (int)state, prop); + } + } + void setPart(ref Color prop, string partName, State state, Color color) + { + if (prop == color) return; + if (this != null) + { + Interop.Eext.eext_rotary_selector_part_color_set(this, partName, (int)state, color.R, color.G, color.B, color.A); + } + } + + public Image BackgroundImage { set => setPart(ref _normalBgImage, BgPartName, State.Normal, value); get => _normalBgImage; } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr ptr = Interop.Eext.eext_rotary_selector_add(parent); + Interop.Eext.eext_rotary_object_event_activated_set(ptr, true); + return ptr; + } + + internal enum State + { + Normal, + Pressed + } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs new file mode 100644 index 0000000..d6abba8 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class RotarySelectorItem + { + const string MainTextPartName = "selector,main_text"; + const string SubTextPartName = "selector,sub_text"; + const string IconPartName = "item,icon"; + const string BgPartName = "item,bg_image"; + const string SelectorIconPartName = "selector,icon"; + + string _mainText; + string _subText; + + Color _mainTextColor; + Color _subTextColor; + + Image _normalIconImage; + Image _pressedIconImage; + Image _disabledIconImage; + Image _selectedIconImage; + + Image _normalBgImage; + Image _pressedBgImage; + Image _disabledBgImage; + Image _selectedBgImage; + + Color _normalBgColor; + Color _pressedBgColor; + Color _disabledBgColor; + Color _selectedBgColor; + + Image _selectorIconImage; + + IntPtr _handle; + + public IntPtr Handle + { + set + { + if (_handle == value) return; + _handle = value; + + if (_handle == null) return; + + setPart(ref _mainText, MainTextPartName); + setPart(ref _subText, SubTextPartName); + setPart(ref _mainTextColor, MainTextPartName, ItemState.Normal); + setPart(ref _subTextColor, SubTextPartName, ItemState.Normal); + + setPart(ref _normalIconImage, IconPartName, ItemState.Normal); + setPart(ref _pressedIconImage, IconPartName, ItemState.Pressed); + setPart(ref _disabledIconImage, IconPartName, ItemState.Disabled); + setPart(ref _selectedIconImage, IconPartName, ItemState.Selected); + + setPart(ref _normalBgImage, BgPartName, ItemState.Normal); + setPart(ref _pressedBgImage, BgPartName, ItemState.Pressed); + setPart(ref _disabledBgImage, BgPartName, ItemState.Disabled); + setPart(ref _selectedBgImage, BgPartName, ItemState.Selected); + + setPart(ref _normalBgColor, BgPartName, ItemState.Normal); + setPart(ref _pressedBgColor, BgPartName, ItemState.Pressed); + setPart(ref _disabledBgColor, BgPartName, ItemState.Disabled); + setPart(ref _selectedBgColor, BgPartName, ItemState.Selected); + + setPart(ref _selectorIconImage, SelectorIconPartName, ItemState.Normal); + } + + get + { + return _handle; + } + } + + void setPart(ref Image prop, string partName, ItemState state) + { + if (prop != null) + { + Interop.Eext.eext_rotary_selector_item_part_content_set(Handle, partName, (int)state, prop); + } + } + void setPart(ref Color prop, string partName, ItemState state) + { + if (prop != default(Color)) + { + Interop.Eext.eext_rotary_selector_item_part_color_set(Handle, partName, (int)state, prop.R, prop.G, prop.B, prop.A); + } + } + + void setPart(ref string prop, string partName) + { + if (prop != null) + { + Interop.Eext.eext_rotary_selector_item_part_text_set(Handle, partName, prop); + } + } + + void setPart(ref Image prop, string partName, ItemState state, Image img) + { + if (prop == img) return; + prop = img; + if (Handle != null) + { + Interop.Eext.eext_rotary_selector_item_part_content_set(Handle, partName, (int)state, img); + } + } + + void setPart(ref Color prop, string partName, ItemState state, Color color) + { + if (prop == color) return; + prop = color; + if (Handle != null) + { + Interop.Eext.eext_rotary_selector_item_part_color_set(Handle, partName, (int)state, color.R, color.G, color.B, color.A); + } + } + + void setPart(ref string prop, string partName, string txt) + { + if (prop == txt) return; + prop = txt; + if (Handle != null) + { + Interop.Eext.eext_rotary_selector_item_part_text_set(Handle, partName, txt); + } + } + + public string MainText { set => setPart(ref _mainText, MainTextPartName, value); get => _mainText; } + public string SubText { set => setPart(ref _subText, SubTextPartName, value); get => _subText; } + + public Color MainTextColor { set => setPart(ref _mainTextColor, MainTextPartName, ItemState.Normal, value); get => _mainTextColor; } + public Color SubextColor { set => setPart(ref _subTextColor, SubTextPartName, ItemState.Normal, value); get => _subTextColor; } + + public Image NormalIconImage { set => setPart(ref _normalIconImage, IconPartName, ItemState.Normal, value); get => _normalIconImage; } + public Image PressedIconImage { set => setPart(ref _pressedIconImage, IconPartName, ItemState.Pressed, value); get => _pressedIconImage; } + public Image DisabledIconImage { set => setPart(ref _disabledIconImage, IconPartName, ItemState.Disabled, value); get => _disabledIconImage; } + public Image SelectedIconImage { set => setPart(ref _selectedIconImage, IconPartName, ItemState.Selected, value); get => _selectedIconImage; } + + + public Image NormalBackgroundImage { set => setPart(ref _normalBgImage, BgPartName, ItemState.Normal, value); get => _normalBgImage; } + public Image PressedBackgroundImage { set => setPart(ref _pressedBgImage, BgPartName, ItemState.Pressed, value); get => _pressedBgImage; } + public Image DisabledBackgroundImage { set => setPart(ref _disabledBgImage, BgPartName, ItemState.Disabled, value); get => _disabledBgImage; } + public Image SelectedBackgroundImage { set => setPart(ref _selectedBgImage, BgPartName, ItemState.Selected, value); get => _selectedBgImage; } + + public Color NormalBackgroundColor { set => setPart(ref _normalBgColor, BgPartName, ItemState.Normal, value); get => _normalBgColor; } + public Color PressedBackgroundColor { set => setPart(ref _pressedBgColor, BgPartName, ItemState.Pressed, value); get => _pressedBgColor; } + public Color DisabledBackgroundColor { set => setPart(ref _disabledBgColor, BgPartName, ItemState.Disabled, value); get => _disabledBgColor; } + public Color SelectedBackgroundColor { set => setPart(ref _selectedBgColor, BgPartName, ItemState.Selected, value); get => _selectedBgColor; } + + public Image SelectorIconImage { set => setPart(ref _selectorIconImage, SelectorIconPartName, ItemState.Normal, value); get => _selectorIconImage; } + + internal enum ItemState + { + Normal, + Pressed, + Disabled, + Selected + } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs new file mode 100644 index 0000000..401be2f --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class RotarySelectorItemEventArgs : EventArgs + { + public RotarySelectorItem Item { get; set; } + } +} diff --git a/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs new file mode 100644 index 0000000..2f73984 --- /dev/null +++ b/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + class RotarySelectorList : IList<RotarySelectorItem> + { + RotarySelector _owner; + List<RotarySelectorItem> Items { get; set; } + + public RotarySelectorList(RotarySelector owner) + { + this._owner = owner; + Items = new List<RotarySelectorItem>(); + } + + public RotarySelectorItem this[int index] { get => Items[index]; set => Items[index] = value; } + + public int Count => Items.Count; + + public bool IsReadOnly => false; + + public void Add(RotarySelectorItem item) + { + item.Handle = Interop.Eext.eext_rotary_selector_item_append(_owner); + Items.Add(item); + } + + public void Clear() + { + Interop.Eext.eext_rotary_selector_items_clear(_owner); + } + + public bool Contains(RotarySelectorItem item) + { + return Items.Contains(item); + } + + public void CopyTo(RotarySelectorItem[] array, int arrayIndex) + { + Items.CopyTo(array, arrayIndex); + } + + public IEnumerator<RotarySelectorItem> GetEnumerator() + { + return Items.GetEnumerator(); + } + + public int IndexOf(RotarySelectorItem item) + { + return Items.IndexOf(item); + } + + public void Insert(int index, RotarySelectorItem item) + { + if (Items.Count <= index || index < 0) + { + throw new ArgumentOutOfRangeException("index is not valid in the RotarySelector"); + } + RotarySelectorItem target = Items[index]; + item.Handle = Interop.Eext.eext_rotary_selector_item_insert_after(_owner, target.Handle); + Items.Insert(index, item); + } + + public bool Remove(RotarySelectorItem item) + { + if (Items.Contains(item)) + { + Interop.Eext.eext_rotary_selector_item_del(item.Handle); + Items.Remove(item); + return true; + } + return false; + } + + public void RemoveAt(int index) + { + if (Items.Count < index + 1 || index < 0) + { + throw new ArgumentOutOfRangeException("index is not valid in the RotarySelector"); + } + + RotarySelectorItem target = Items[index]; + Interop.Eext.eext_rotary_selector_item_del(target.Handle); + target.Handle = IntPtr.Zero; + Items.RemoveAt(index); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return Items.GetEnumerator(); + } + } +} diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs new file mode 100644 index 0000000..4bbd8d9 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_datetime_add(IntPtr datetime, IntPtr surface); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs new file mode 100644 index 0000000..b3581ca --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_genlist_add(IntPtr genlist, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_set(IntPtr circleGenlist, int policyHorisontal, int policyVertical); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_get(IntPtr circleGenlist, out int policyHorisontal, out int policyVertical); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_get(IntPtr circleGenlist, out int policyHorisontal, IntPtr policyVertical); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_get(IntPtr circleGenlist, IntPtr policyHorisontal, out int policyVertical); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs new file mode 100644 index 0000000..e1940f6 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_add(IntPtr obj, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_circle_object_disabled_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_line_width_set(IntPtr obj, int lineWidth); + + [DllImport(Libraries.Eext)] + internal static extern int eext_circle_object_line_width_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_set(IntPtr obj, double angle); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_angle_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_offset_set(IntPtr obj, double offset); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_angle_offset_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_min_max_set(IntPtr obj, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_min_max_get(IntPtr obj, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_value_min_max_set(IntPtr obj, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_value_min_max_get(IntPtr obj, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_value_set(IntPtr obj, double value); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_value_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_color_get(IntPtr obj, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_radius_set(IntPtr obj, double radius); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_radius_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_line_width_set(IntPtr obj, string item, int lineWidth); + + [DllImport(Libraries.Eext)] + internal static extern int eext_circle_object_item_line_width_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_set(IntPtr obj, string item, double angle); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_angle_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_offset_set(IntPtr obj, string item, double offset); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_angle_offset_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_set(IntPtr obj, string item, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_get(IntPtr obj, string item, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_get(IntPtr obj, string item, out double min, IntPtr max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_get(IntPtr obj, string item, IntPtr min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_set(IntPtr obj, string item, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_get(IntPtr obj, string item, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_get(IntPtr obj, string item, out double min, IntPtr max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_get(IntPtr obj, string item, IntPtr min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_set(IntPtr obj, string item, double value); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_value_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_color_set(IntPtr obj, string item, int r, int g, int b, int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_color_get(IntPtr obj, string item, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_radius_set(IntPtr obj, string item, double radius); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_radius_get(IntPtr obj, string item); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs new file mode 100644 index 0000000..8c60209 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_progressbar_add(IntPtr parent, IntPtr surface); + + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs new file mode 100644 index 0000000..2502100 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_scroller_add(IntPtr scroller, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_set(IntPtr obj, int policy_h, int policy_v); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_get(IntPtr obj, IntPtr policy_h, IntPtr policy_v); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_get(IntPtr obj, out int policy_h, IntPtr policy_v); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_get(IntPtr obj, IntPtr policy_h, out int policy_v); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs new file mode 100644 index 0000000..d2eeef3 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_slider_add(IntPtr parent, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_slider_step_set(IntPtr obj, double value); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_slider_step_get(IntPtr obj); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs new file mode 100644 index 0000000..eb221eb --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_spinner_add(IntPtr spinner, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_spinner_angle_set(IntPtr spinner, double angle); + + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs b/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs new file mode 100644 index 0000000..4b5f820 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_conformant_add(IntPtr conformant); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_layout_add(IntPtr layout); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_naviframe_add(IntPtr naviframe); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_del(IntPtr surface); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs b/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs new file mode 100644 index 0000000..95b1de8 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs @@ -0,0 +1,65 @@ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_add(IntPtr parent); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_direction_set(IntPtr obj, int direction); + + [DllImport(Libraries.Eext)] + internal static extern int eext_more_option_direction_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_append(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_del(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_domain_translatable_part_text_set(IntPtr item, string part_name, string domain, string text); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_insert_after(IntPtr obj, IntPtr after); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_insert_before(IntPtr obj, IntPtr before); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_part_content_get(IntPtr obj, string part_name); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_part_content_set(IntPtr item, string part_name, IntPtr content); + + [DllImport(Libraries.Eext, EntryPoint = "eext_more_option_item_part_text_get")] + static extern IntPtr _eext_more_option_item_part_text_get(IntPtr item, string part_name); + + internal static string eext_more_option_item_part_text_get(IntPtr item, string part_name) + { + var ptr = _eext_more_option_item_part_text_get(item, part_name); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_part_text_set(IntPtr item, string part_name, string text); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_prepend(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_items_clear(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_items_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_more_option_opened_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_opened_set(IntPtr obj, bool opened); + } +} diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs b/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs new file mode 100644 index 0000000..5348d39 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_object_event_activated_set(IntPtr circleObject, bool activated); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs b/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs new file mode 100644 index 0000000..457cfbb --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs @@ -0,0 +1,51 @@ +using System; +using System.Runtime.InteropServices; + + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_add(IntPtr parent); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_append(IntPtr obj); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_prepend(IntPtr obj); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_insert_after(IntPtr obj, IntPtr after); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_insert_before(IntPtr obj, IntPtr before); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_del(IntPtr item); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_items_clear(IntPtr obj); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_text_set(IntPtr item, string part_name, string text); + [DllImport(Libraries.Eext)] + internal static extern string eext_rotary_selector_item_part_text_get(IntPtr item, string part_name); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_domain_translatable_part_text_set(IntPtr item, string part_name, string domain, string text); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_content_set(IntPtr item, string part_name, int state, IntPtr content); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_part_content_get(IntPtr item, string part_name, int state); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_part_content_set(IntPtr obj, string part_name, int state, IntPtr content); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_part_content_get(IntPtr obj, string part_name, int state); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_color_set(IntPtr item, string part_name, int state, int r, int g, int b, int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_color_get(IntPtr item, string part_name, int state, out int r, out int g, out int b, out int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_part_color_set(IntPtr obj, string part_name, int state, int r, int g, int b, int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_part_color_get(IntPtr obj, string part_name, int state, out int r, out int g, out int b, out int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_selected_item_set(IntPtr obj, IntPtr item); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_selected_item_get(IntPtr obj); + + } +} diff --git a/ElmSharp.Wearable/Interop/Interop.Evas.cs b/ElmSharp.Wearable/Interop/Interop.Evas.cs new file mode 100644 index 0000000..dbe48e8 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Evas.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Evas + { + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_resize(IntPtr obj, int w, int h); + } +}
\ No newline at end of file diff --git a/ElmSharp.Wearable/Interop/Interop.Libraries.cs b/ElmSharp.Wearable/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..3668358 --- /dev/null +++ b/ElmSharp.Wearable/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static class Libraries + { + internal const string Elementary = "libelementary.so.1"; + internal const string Eext = "libefl-extension.so.0"; + internal const string Evas = "libevas.so.1"; + } +} |