<Compile Include="TC\Wearable\ClipperTest1.cs" />
<Compile Include="TC\Wearable\ContextPopupTest1.cs" />
<Compile Include="TC\Wearable\DateTimeSelectorTest1.cs" />
+ <Compile Include="TC\Wearable\DateTimeSelectorTest2.cs" />
+ <Compile Include="TC\Wearable\EcoreTimerTest1.cs" />
+ <Compile Include="TC\Wearable\EntryTest1.cs" />
+ <Compile Include="TC\Wearable\EntryTest2.cs" />
+ <Compile Include="TC\Wearable\EntryTest3.cs" />
+ <Compile Include="TC\Wearable\EntryTest4.cs" />
+ <Compile Include="TC\Wearable\EvasMapTest1.cs" />
+ <Compile Include="TC\Wearable\EvasMapTest2.cs" />
+ <Compile Include="TC\Wearable\FocusTest1.cs" />
+ <Compile Include="TC\Wearable\GenGridTest1.cs" />
+ <Compile Include="TC\Wearable\GenGridTest2.cs" />
+ <Compile Include="TC\Wearable\GenListTest1.cs" />
+ <Compile Include="TC\Wearable\GenListTest10.cs" />
+ <Compile Include="TC\Wearable\GenListTest9.cs" />
+ <Compile Include="TC\Wearable\GenListTest2.cs" />
+ <Compile Include="TC\Wearable\GenListTest3.cs" />
+ <Compile Include="TC\Wearable\GenListTest4.cs" />
+ <Compile Include="TC\Wearable\GenListTest5.cs" />
+ <Compile Include="TC\Wearable\GenListTest6.cs" />
+ <Compile Include="TC\Wearable\GenListTest7.cs" />
+ <Compile Include="TC\Wearable\GenListTest8.cs" />
+ <Compile Include="TC\Wearable\GestureLayerTest1.cs" />
+ <Compile Include="TC\Wearable\IconTest1.cs" />
<Compile Include="TC\WindowInternalTest.cs" />
<Compile Include="TestCaseBase.cs" />
<Compile Include="TestRunner.cs" />
<HintPath>..\ElmSharp\bin\Debug\netstandard1.3\ElmSharp.dll</HintPath>
</Reference>
</ItemGroup>
- <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.
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class BackgroundColorTest : WearableTestCase
{
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class BackgroundTest1 : WearableTestCase
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class BackgroundTest2 : WearableTestCase
{
-using System;
+/*
+ * 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.Collections.Generic;
using System.Linq;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
// under construct
class BoxLayoutTest1 : WearableTestCase
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class ButtonTest1 : WearableTestCase
{
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class ButtonTest2 : WearableTestCase
{
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class CheckTest1 : WearableTestCase
{
Rect square = window.GetInnerSquare();
Background bg = new Background(window);
- bg.Color = Color.White;
+ bg.Color = Color.Black;
bg.Geometry = square;
bg.Show();
Check check = new Check(window)
{
Text = "This is Check",
- Style = "default",
+ Style = "default"
};
- Label label1 = new Label(window)
+ Check onoff = new Check(window)
{
- Text = string.Format("IsChecked ={0}, Style={1}", check.IsChecked, check.Style),
+ Text = "On or Off",
+ Style = "on&off"
};
+ Label label1 = new Label(window);
Label label2 = new Label(window);
-
Label label3 = new Label(window);
+ Label label4 = new Label(window);
- check.StateChanged += (object sender, CheckStateChangedEventArgs e) =>
+ EventHandler<CheckStateChangedEventArgs> update = (s, e) =>
{
- check.Style = check.Style == "default" ? "on&off" : "default";
- label1.Text = string.Format("IsChecked ={0}, Style={1}", check.IsChecked, check.Style);
- label2.Text = string.Format("OldState={0}", e.OldState);
- label3.Text = string.Format("NewState={0}", e.NewState);
+ Check c = s as Check;
+ label1.Text = string.Format("IsChecked ={0}", c.IsChecked);
+ label2.Text = string.Format("Style={0}", c.Style);
+ if (e != null)
+ {
+ label3.Text = string.Format("OldState={0}", e.OldState);
+ label4.Text = string.Format("NewState={0}", e.NewState);
+ }
};
- Rect quater = square;
- quater.Height /= 4;
+ check.StateChanged += (s, e) => update(s, e);
+
+ onoff.StateChanged += (s, e) => update(s, e);
- label1.Geometry = new Rect(quater.X, quater.Y, quater.Width, quater.Height);
+ Rect pieces = square;
+ pieces.Height /= 5;
+
+ label1.Geometry = new Rect(pieces.X, pieces.Y, pieces.Width, pieces.Height);
label1.Show();
- label2.Geometry = new Rect(quater.X, quater.Y + quater.Height, quater.Width, quater.Height);
+ label2.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height, pieces.Width, pieces.Height);
label2.Show();
- label3.Geometry = new Rect(quater.X, quater.Y + quater.Height * 2, quater.Width, quater.Height);
+ label3.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height * 2, pieces.Width, pieces.Height);
label3.Show();
- check.Geometry = new Rect(quater.X, quater.Y + quater.Height * 3, quater.Width, quater.Height);
+ label4.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height * 3, pieces.Width, pieces.Height);
+ label4.Show();
+
+ check.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height * 4, pieces.Width/2, pieces.Height);
check.Show();
+
+ onoff.Geometry = new Rect(pieces.X + pieces.Width/2, pieces.Y + pieces.Height * 4, pieces.Width / 2, pieces.Height);
+ onoff.Show();
}
}
}
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
public static class CircleTool
{
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class ClipperTest1 : WearableTestCase
{
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class ContextPopupTest1 : WearableTestCase
{
Rect square = window.GetInnerSquare();
Background bg = new Background(window);
- bg.Color = Color.White;
+ bg.Color = Color.Olive;
bg.Move(0, 0);
bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
bg.Show();
-using System;
+/*
+ * 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.Collections.Generic;
using System.Text;
-namespace ElmSharp.Test.TC
+namespace ElmSharp.Test.Wearable
{
class DateTimeSelectorTest1 : WearableTestCase
{
--- /dev/null
+/*
+ * 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.Collections.Generic;
+using System.Text;
+
+namespace ElmSharp.Test.Wearable
+{
+ class DateTimeSelectorTest2 : WearableTestCase
+ {
+ public override string TestName => "DateTimeSelectorTest2";
+ public override string TestDescription => "To test basic operation of DateTimeSelector";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ Background bg = new Background(window);
+ bg.Color = Color.Black;
+ bg.Show();
+ conformant.SetContent(bg);
+
+ DateTimeSelector dateTime = new DateTimeSelector(window)
+ {
+ DateTime = DateTime.Today,
+ Style = "time_layout",
+ Format = "%I:%M %p"
+ };
+
+ dateTime.Geometry = new Rect(0, 0, window.ScreenSize.Width, window.ScreenSize.Height);
+ dateTime.Show();
+
+ dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) =>
+ {
+ Log.Debug($"Old DateTime={e.OldDate}");
+ Log.Debug($"New DateTime={e.NewDate}");
+ Log.Debug($"Current DateTime={dateTime.DateTime}");
+ };
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Test.Wearable
+{
+ class EcoreTimerTest1 : WearableTestCase
+ {
+ public override string TestName => "EcoreTimerTest1";
+ public override string TestDescription => "To timer operation of EcoreMainLoop";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+
+ Background bg = new Background(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Gray
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+
+ int number = 0;
+ bool bReturn = true;
+ Label label1 = new Label(window);
+ label1.Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 2);
+
+ Button btnTimerSwitch = new Button(window);
+ btnTimerSwitch.Text = "Timer : On";
+ btnTimerSwitch.Geometry = new Rect(square.X, square.Y + square.Height / 2, square.Width, square.Height / 2);
+
+ Func<bool> handler = () =>
+ {
+ label1.Text = (++number).ToString();
+ label1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#000000 font_size=64 align=left valign=bottom wrap=word'";
+ return bReturn;
+ };
+ IntPtr prevId = EcoreMainloop.AddTimer(1.0, handler);
+ btnTimerSwitch.Clicked += (s, e) =>
+ {
+ if (bReturn)
+ {
+ bReturn = false;
+ btnTimerSwitch.Text = "Timer : Off";
+ }
+ else
+ {
+ bReturn = true;
+ btnTimerSwitch.Text = "Timer : On";
+ EcoreMainloop.RemoveTimer(prevId);
+ prevId = EcoreMainloop.AddTimer(1.0, handler);
+ }
+ };
+
+ window.BackButtonPressed += (s, e) =>
+ {
+ EcoreMainloop.RemoveTimer(prevId);
+ };
+
+ label1.Show();
+ btnTimerSwitch.Show();
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class EntryTest1 : WearableTestCase
+ {
+ public override string TestName => "EntryTest1";
+ public override string TestDescription => "To test basic operation of Entry";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+
+ Background bg = new Background(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Black
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ //conformant.SetContent(box);
+ box.Show();
+ box.Geometry = square;
+
+ Entry entry1 = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ IsSingleLine = true,
+ };
+ entry1.SetPartText("guide", "<span color=#999999>Single Line</span>");
+
+ Entry entry2 = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ IsPassword = true
+ };
+ entry2.SetPartText("guide", "<span color=#999999>Password</span>");
+
+ Entry entry3 = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ IsSingleLine = true,
+ Scrollable = true,
+ };
+ entry3.SetPartText("guide", "<span color=#808080FF font_size=28 align=left valign=top wrap=mixed>Enter a System.Double</span>");
+ entry3.Show();
+
+ box.PackEnd(entry1);
+ box.PackEnd(entry2);
+ box.PackEnd(entry3);
+
+ entry1.Show();
+ entry2.Show();
+ entry3.Show();
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class EntryTest2 : WearableTestCase
+ {
+ public override string TestName => "EntryTest2";
+ public override string TestDescription => "To test basic operation of Entry";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Black
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ box.Geometry = window.GetInnerSquare();
+ box.Show();
+
+ var capital1 = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = " Word",
+ AutoCapital = AutoCapital.Word
+ };
+
+ var capital2 = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Sentence",
+ AutoCapital = AutoCapital.Sentence
+ };
+
+ var capital3 = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "All",
+ AutoCapital = AutoCapital.All
+ };
+
+ var getText = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "get cursor content test",
+ };
+
+ var label = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ };
+
+ getText.CursorChanged += (s, e) =>
+ {
+ label.Text = getText.GetCursorContent();
+ };
+
+ box.PackEnd(capital1);
+ box.PackEnd(capital2);
+ box.PackEnd(capital3);
+ box.PackEnd(getText);
+ box.PackEnd(label);
+
+ capital1.Show();
+ capital2.Show();
+ capital3.Show();
+ getText.Show();
+ label.Show();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class EntryTest3 : WearableTestCase
+ {
+ public override string TestName => "EntryTest3";
+ public override string TestDescription => "To test basic operation of Entry";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window) {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Black
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ box.Geometry = window.GetInnerSquare();
+ box.Show();
+
+ Check check = new Check(window) {
+ AlignmentX = -1,
+ AlignmentY = 0.9,
+ WeightX = 1,
+ WeightY = 0.1,
+ Text = "Select All",
+ };
+ check.Show();
+
+ Entry entry = new Entry(window) {
+ AlignmentX = -1,
+ AlignmentY = 0.1,
+ WeightX = 1,
+ WeightY = 1,
+ IsSingleLine = true,
+ Text = "Hello, Tizen !!!"
+ };
+ entry.Show();
+
+ check.StateChanged += (object sender, CheckStateChangedEventArgs e) =>
+ {
+ if (e.NewState == true)
+ {
+ entry.SelectAll();
+ }
+ else
+ {
+ entry.SelectNone();
+ }
+ };
+
+ box.PackEnd(check);
+ box.PackEnd(entry);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class EntryTest4 : WearableTestCase
+ {
+ public override string TestName => "EntryTest4";
+ public override string TestDescription => "To test basic operation of Entry";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Black
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ box.Geometry = window.GetInnerSquare();
+ box.Show();
+
+ Entry entry = new Entry(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 1,
+ WeightX = 1,
+ WeightY = 1,
+ IsSingleLine = true,
+ Text = "Hello, Tizen"
+ };
+
+ var btn = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 1,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Set Filter"
+ };
+ btn.Show();
+
+ //var filter = new Entry.TextFilter(SetFilter);
+ btn.Clicked += (s, e) =>
+ {
+ entry.AppendMarkUpFilter(SetFilter);
+ };
+
+ var btn1 = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 1,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Remove Filter"
+ };
+ btn1.Show();
+ btn1.Clicked += (s, e) =>
+ {
+ entry.RemoveMarkUpFilter(SetFilter);
+ };
+
+ //entry.AppendMarkUpFilter(new Entry.Filter(SetFilter));
+
+ entry.Show();
+ box.PackEnd(entry);
+ box.PackEnd(btn);
+ box.PackEnd(btn1);
+ }
+
+ public string SetFilter(Entry entry, string text)
+ {
+ if (text.Equals("a") || text.Equals("b") || text.Equals("c") || text.Equals("d"))
+ return text;
+ else
+ return "Tizen";
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class EvasMapTest1 : WearableTestCase
+ {
+ public override string TestName => "EvasMapTest1";
+ public override string TestDescription => "Test EvasMap on different levels of hierarchy";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+
+ var box = new Box(window)
+ {
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 2),
+ BackgroundColor = Color.Gray
+ };
+ box.Show();
+
+ var text = new Label(box)
+ {
+ Text = "<span color=#ffffff font_size=30>Target</span>",
+ AlignmentX = -1.0,
+ AlignmentY = -1.0,
+ WeightX = 1.0,
+ WeightY = 1.0,
+ };
+ text.Show();
+
+ box.PackEnd(text);
+
+ double angle = 0.0;
+
+ var reset = new Button(box)
+ {
+ Text = "Reset",
+ Geometry = new Rect(square.X, square.Y + square.Height / 2, square.Width, square.Height / 6)
+ };
+ reset.Show();
+
+ double zx = 1.0;
+ double zy = 1.0;
+ reset.Clicked += (object sender, EventArgs e) =>
+ {
+ text.IsMapEnabled = false;
+ angle = 0.0;
+ zx = 1.0;
+ zy = 1.0;
+ };
+
+ var zoom = new Button(box)
+ {
+ Text = "Zoom Target",
+ Geometry = new Rect(square.X, square.Y + square.Height / 2 + square.Height / 6, square.Width, square.Height / 6)
+ };
+ zoom.Show();
+
+ zoom.Clicked += (object sender, EventArgs e) =>
+ {
+ zx += 0.1;
+ zy += 0.1;
+ var map = new EvasMap(4);
+ var g = text.Geometry;
+ map.PopulatePoints(g, 0);
+ map.Rotate3D(0, 0, angle, g.X + g.Width / 2, g.Y + g.Height / 2, 0);
+ map.Zoom(zx, zy, g.X, g.Y);
+ text.EvasMap = map;
+ text.IsMapEnabled = true;
+ };
+
+ var rotate = new Button(box)
+ {
+ Text = "Rotate Target",
+ Geometry = new Rect(square.X, square.Y + square.Height / 2 + square.Height * 2 / 6, square.Width, square.Height / 6)
+ };
+ rotate.Show();
+
+ rotate.Clicked += (object sender, EventArgs e) =>
+ {
+ angle += 5.0;
+ var map = new EvasMap(4);
+ var g = text.Geometry;
+ map.PopulatePoints(g, 0);
+ map.Rotate3D(0, 0, angle, g.X + g.Width / 2, g.Y + g.Height / 2, 0);
+ map.Zoom(zx, zy, g.X, g.Y);
+ text.EvasMap = map;
+ text.IsMapEnabled = true;
+ };
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class EvasMapTest2 : WearableTestCase
+ {
+ public override string TestName => "EvasMapTest2";
+ public override string TestDescription => "Test EvasMap on different levels of hierarchy";
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+ var box = new Box(window)
+ {
+ Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 2),
+ BackgroundColor = Color.Gray
+ };
+ box.Show();
+
+ var group = new Box(box)
+ {
+ IsHorizontal = true,
+ BackgroundColor = Color.White,
+ };
+ group.Show();
+
+ var x = new Label(group)
+ {
+ Text = "X",
+ };
+ x.Show();
+
+ var y = new Label(group)
+ {
+ Text = "Y",
+ };
+ y.Show();
+
+ var z = new Label(group)
+ {
+ Text = "Z",
+ };
+ z.Show();
+ group.PackEnd(x);
+ group.PackEnd(y);
+ group.PackEnd(z);
+
+ var top = new Rectangle(box)
+ {
+ Color = Color.Red,
+ };
+ top.SetAlignment(-1.0, -1.0); // fill
+ top.SetWeight(1.0, 1.0); // expand
+ top.Show();
+
+ var bottom = new Rectangle(box)
+ {
+ Color = Color.Green,
+ };
+ bottom.SetAlignment(-1.0, -1.0); // fill
+ bottom.SetWeight(1.0, 1.0); // expand
+ bottom.Show();
+
+ double angle = 0.0;
+
+ var reset = new Button(box)
+ {
+ Text = "Reset",
+ Geometry = new Rect(square.X, square.Y + square.Height / 2, square.Width, square.Height / 6)
+ };
+ reset.Show();
+
+ reset.Clicked += (object sender, EventArgs e) =>
+ {
+ group.IsMapEnabled = false;
+ x.IsMapEnabled = false;
+ angle = 0.0;
+ };
+
+ var zoom = new Button(box)
+ {
+ Text = "Zoom group",
+ Geometry = new Rect(square.X, square.Y + square.Height / 2 + square.Height / 6, square.Width, square.Height / 6)
+ };
+ zoom.Show();
+
+ zoom.Clicked += (object sender, EventArgs e) =>
+ {
+ var map = new EvasMap(4);
+ var g = group.Geometry;
+ map.PopulatePoints(g, 0);
+ map.Zoom(3.0, 3.0, g.X + g.Width / 2, g.Y + g.Height / 2);
+ group.EvasMap = map;
+ group.IsMapEnabled = true;
+ };
+
+ var rotate = new Button(box)
+ {
+ Text = "Rotate X",
+ Geometry = new Rect(square.X, square.Y + square.Height / 2 + square.Height * 2 / 6, square.Width, square.Height / 6)
+ };
+ rotate.Show();
+
+ rotate.Clicked += (object sender, EventArgs e) =>
+ {
+ angle += 5.0;
+
+ var map = new EvasMap(4);
+ var g = x.Geometry;
+ map.PopulatePoints(g, 0);
+ map.Rotate3D(0, 0, angle, g.X + g.Width / 2, g.Y + g.Height / 2, 0);
+ x.EvasMap = map;
+ x.IsMapEnabled = true;
+ };
+
+ box.PackEnd(top);
+ box.PackEnd(group);
+ box.PackEnd(bottom);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.Test.Wearable
+{
+ public class FocusTest1 : WearableTestCase
+ {
+ public override string TestName => "FocusTest1";
+ public override string TestDescription => "To test basic operation of Focus";
+
+ string[] btn_names = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i" };
+ string previous;
+
+ Button current;
+
+ public override void Run(Window window)
+ {
+ var square = window.GetInnerSquare();
+
+ Button[] btns = new Button[9];
+
+ Size btnSize = new Size(square.Width / 3 - 2, square.Height / 4 - 2);
+ for (int i=0; i<3; i++)
+ {
+ for (int j=0; j<3; j++)
+ {
+ btns[i*3+j] = new Button(window) { Text = btn_names[i * 3 + j] };
+ int x = i * btnSize.Width + i * 2;
+ int y = j * btnSize.Height + j*2;
+ btns[i*3+j].Geometry = new Rect(square.X + x, square.Y + y, btnSize.Width, btnSize.Height);
+
+ btns[i * 3 + j].Focused += Button_Focused;
+ btns[i * 3 + j].Unfocused += Button_Unfocused;
+ btns[i * 3 + j].Show();
+ }
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j=0; j<3; j++)
+ {
+ if (j > 0)
+ {
+ btns[i * 3 + j].SetNextFocusObject(btns[i * 3 + (j - 1)], FocusDirection.Up);
+ }
+ if (i > 0)
+ {
+ btns[i * 3 + j].SetNextFocusObject(btns[(i - 1) * 3 + j], FocusDirection.Left);
+ }
+ if (j < 2)
+ {
+ btns[i * 3 + j].SetNextFocusObject(btns[i * 3 + (j + 1)], FocusDirection.Down);
+ }
+ if (i < 2)
+ {
+ btns[i * 3 + j].SetNextFocusObject(btns[(i + 1) * 3 + j], FocusDirection.Right);
+ }
+ }
+ }
+
+ Size arrowSize = new Size(square.Width / 4, square.Height / 4);
+
+ Button left= new Button(window) { Text = "<", Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, arrowSize.Width, arrowSize.Height) };
+ Button right = new Button(window) { Text = ">", Geometry = new Rect(square.X + arrowSize.Width, square.Y + square.Height * 3 / 4, arrowSize.Width, arrowSize.Height) };
+ Button up = new Button(window) { Text = "^", Geometry = new Rect(square.X + arrowSize.Width*2, square.Y + square.Height * 3 / 4, arrowSize.Width, arrowSize.Height) };
+ Button down = new Button(window) { Text = "v", Geometry = new Rect(square.X + arrowSize.Width*3, square.Y + square.Height * 3 / 4, arrowSize.Width, arrowSize.Height) };
+
+ current = btns[0];
+ previous = current.Text;
+
+ current.Text = "X";
+
+ left.Clicked += (s, e) => current.FocusNext(FocusDirection.Left);
+ right.Clicked += (s, e) => current.FocusNext(FocusDirection.Right);
+ up.Clicked += (s, e) => current.FocusNext(FocusDirection.Up);
+ down.Clicked += (s, e) => current.FocusNext(FocusDirection.Down);
+
+ left.AllowFocus(false);
+ right.AllowFocus(false);
+ up.AllowFocus(false);
+ down.AllowFocus(false);
+
+ left.Show();
+ right.Show();
+ up.Show();
+ down.Show();
+ }
+
+ void Button_Focused(object sender, EventArgs e)
+ {
+ var btn = sender as Button;
+ if (btn != null)
+ {
+ btn.BackgroundColor = Color.Red;
+ current = btn;
+ previous = btn.Text;
+ btn.Text = "X";
+ }
+ }
+
+ void Button_Unfocused(object sender, EventArgs e)
+ {
+ var btn = sender as Button;
+ if (btn != null)
+ {
+ btn.BackgroundColor = Color.Default;
+ current = btn;
+ btn.Text = previous;
+ previous = "";
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ public class GenGridTest1 : WearableTestCase
+ {
+ public override string TestName => "GenGridTest1";
+ public override string TestDescription => "To test basic operation of GenGrid";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenGrid grid = new GenGrid(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ ItemAlignmentX = -1,
+ ItemAlignmentY = -1,
+ ItemWidth = window.ScreenSize.Width / 3,
+ ItemHeight = window.ScreenSize.Width / 3,
+ HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
+ VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible
+ };
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ Color item = (Color)obj;
+ return String.Format("#{0:X}{1:X}{2:X}", item.R, item.G, item.B);
+ },
+ GetContentHandler = (obj, part) =>
+ {
+ Color item = (Color)obj;
+ Console.WriteLine("{0} part create requested", part);
+ if (part == "elm.swallow.icon")
+ {
+ var colorbox = new Rectangle(window)
+ {
+ Color = item
+ };
+ return colorbox;
+ }
+ return null;
+ }
+ };
+
+ 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);
+ var griditem = grid.Append(defaultClass, color);
+ griditem.SetTooltipText("AAAAAA");
+ //griditem.TooltipStyle = "transparent";
+
+ griditem.TooltipContentDelegate = () => { return new Button(window); };
+
+ }
+
+ grid.Show();
+ grid.Geometry = window.GetInnerSquare();
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.Wearable
+{
+ public class GenGridTest2 : WearableTestCase
+ {
+ public override string TestName => "GenGridTest2";
+ public override string TestDescription => "To test basic operation of GenGrid";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenGrid grid = new GenGrid(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ ItemAlignmentX = -1,
+ ItemAlignmentY = -1,
+ ItemWidth = window.ScreenSize.Width / 3,
+ ItemHeight = window.ScreenSize.Width / 3,
+ };
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ Color item = (Color)obj;
+ return String.Format("#{0:X}{1:X}{2:X}", item.R, item.G, item.B);
+ },
+ GetContentHandler = (obj, part) =>
+ {
+ Color item = (Color)obj;
+ if (part == "elm.swallow.icon")
+ {
+ var colorbox = new Rectangle(window)
+ {
+ Color = item
+ };
+ return colorbox;
+ }
+ return null;
+ }
+
+ };
+
+ GenGridItem firstitem = null;
+ GenGridItem lastitem = null;
+
+ var rnd = new Random();
+ for (int i = 0; i < 102; i++)
+ {
+ int r = rnd.Next(255);
+ int g = rnd.Next(255);
+ int b = rnd.Next(255);
+ Color color = Color.FromRgb(r, g, b);
+ var item = grid.Append(defaultClass, color);
+ if (i == 0)
+ firstitem = item;
+ if (i == 101)
+ lastitem = item;
+ }
+ grid.Show();
+ var square = window.GetInnerSquare();
+ grid.Geometry = new Rect(square.X, square.Y, square.Width, square.Height * 3/ 4);
+
+ Button first = new Button(window)
+ {
+ Text = "First",
+ BackgroundColor = Color.Red
+ };
+ Button last = new Button(window)
+ {
+ Text = "Last",
+ BackgroundColor = Color.Blue
+ };
+ first.Clicked += (s, e) =>
+ {
+ grid.ScrollTo(firstitem, ScrollToPosition.In, true);
+ Log.Debug(first.Text);
+ };
+ last.Clicked += (s, e) =>
+ {
+ grid.ScrollTo(lastitem, ScrollToPosition.In, true);
+ Log.Debug(last.Text);
+ };
+ first.Show();
+ last.Show();
+
+ first.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width / 2, square.Height);
+ last.Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height * 3 / 4, square.Width / 2, square.Height);
+
+ grid.ItemActivated += Grid_ItemActivated;
+ grid.ItemSelected += Grid_ItemSelected;
+ grid.ItemUnselected += Grid_ItemUnselected;
+ grid.ItemRealized += Grid_ItemRealized;
+ grid.ItemUnrealized += Grid_ItemUnrealized;
+ grid.ItemPressed += Grid_ItemPressed;
+ grid.ItemReleased += Grid_ItemReleased;
+ grid.ItemLongPressed += Grid_ItemLongPressed;
+ grid.ItemDoubleClicked += Grid_ItemDoubleClicked;
+ }
+
+ private void Grid_ItemDoubleClicked(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Double clicked", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemLongPressed(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is LongPressed", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemReleased(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Released", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemPressed(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Pressed", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemUnselected(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Unselected", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemRealized(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Realized", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemUnrealized(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Unrealized", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemSelected(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Selected", color.R, color.G, color.B));
+ }
+
+ private void Grid_ItemActivated(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Log.Debug(string.Format("#{0:X}{1:X}{2:X} is Activated", color.R, color.G, color.B));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class GenListTest1 : WearableTestCase
+ {
+ public override string TestName => "GenListTest1";
+ public override string TestDescription => "To test basic operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenList list = new GenList(window)
+ {
+ Homogeneous = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ 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.Show();
+ list.ItemSelected += List_ItemSelected; ;
+ list.Geometry = window.GetInnerSquare();
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Collections.Generic;
+using ElmSharp;
+
+namespace ElmSharp.Test.Wearable
+{
+ class GenListTest10 : WearableTestCase
+ {
+ public override string TestName => "GenListTest10";
+ public override string TestDescription => "To test InsertBefore operation of GenList with full style";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ GenList list = new GenList(window)
+ {
+ Homogeneous = false,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass defaultClass = new GenItemClass("full")
+ {
+ GetContentHandler = (obj, part) =>
+ {
+ Console.WriteLine("{0} part create requested", part);
+ var btn = new Button(window)
+ {
+ Text = obj.ToString(),
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ return btn;
+ }
+ };
+
+ GenItemClass headerClass = new GenItemClass("full")
+ {
+ GetContentHandler = (obj, part) =>
+ {
+ Console.WriteLine("{0} part create requested", part);
+ var btn = new Button(window)
+ {
+ Text = obj.ToString(),
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ btn.Show();
+
+ var label = new Label(window)
+ {
+ Text = "GenItem with full style"
+ };
+ label.Show();
+
+ Box hBox = new Box(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ };
+ hBox.Show();
+ hBox.PackEnd(btn);
+ hBox.PackEnd(label);
+ return hBox;
+ }
+
+ };
+
+ List<GenListItem> itemList = new List<GenListItem>();
+ GenListItem firstItem = null;
+
+ for (int i = 0; i < 5; i++)
+ {
+ GenListItem now = list.Append(defaultClass, string.Format("{0} Item", i));
+ itemList.Add(now);
+
+ if (firstItem == null)
+ {
+ firstItem = now;
+ }
+ }
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+
+ Button first = new Button(window)
+ {
+ Text = "First",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ Button last = new Button(window)
+ {
+ Text = "last",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+
+ first.Clicked += (s, e) =>
+ {
+ firstItem = list.InsertBefore(headerClass, "Header", firstItem);
+ };
+ last.Clicked += (s, e) =>
+ {
+ list.Append(headerClass, "Footer");
+ };
+
+ first.Show();
+ last.Show();
+
+ var square = window.GetInnerSquare();
+ list.Geometry = new Rect(square.X, square.Y, square.Width, square.Height * 3 / 4);
+ first.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width / 2, square.Height / 4);
+ last.Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height * 3 / 4, square.Width / 2, square.Height / 4);
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test.Wearable
+{
+ class GenListTest2 : WearableTestCase
+ {
+ public override string TestName => "GenListTest2";
+ public override string TestDescription => "To test ScrollTo operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ GenList list = new GenList(window)
+ {
+ Homogeneous = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return string.Format("{0} - {1}", (string)obj, part);
+ }
+ };
+
+ GenListItem[] items = new GenListItem[100];
+ int i = 0;
+ for (i = 0; i < 100; i++)
+ {
+ items[i] = list.Append(defaultClass, string.Format("{0} Item", i));
+ }
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+
+ GenListItem scroll = items[0];
+
+ Button first = new Button(window)
+ {
+ Text = "F",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ Button last = new Button(window)
+ {
+ Text = "L",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ Button add = new Button(window)
+ {
+ Text = "A",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ add.Clicked += (s, e) =>
+ {
+ scroll = list.InsertBefore(defaultClass, string.Format("{0} Item", i++), scroll);
+ list.ScrollTo(scroll, ScrollToPosition.In, false);
+ };
+ first.Clicked += (s, e) =>
+ {
+ list.ScrollTo(scroll, ScrollToPosition.In, true);
+ };
+ last.Clicked += (s, e) =>
+ {
+ list.ScrollTo(items[99], ScrollToPosition.In, true);
+ };
+ first.Show();
+ last.Show();
+ add.Show();
+
+ var square = window.GetInnerSquare();
+
+ list.Geometry = new Rect(square.X, square.Y, square.Width, square.Height * 3 / 4);
+ first.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width / 3, square.Height / 4);
+ last.Geometry = new Rect(square.X + square.Width / 3, square.Y + square.Height * 3 / 4, square.Width / 3, square.Height / 4);
+ add.Geometry = new Rect(square.X + square.Width * 2 / 3, square.Y + square.Height * 3 / 4, square.Width / 3, square.Height / 4);
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class GenListTest3 : WearableTestCase
+ {
+ public override string TestName => "GenListTest3";
+ public override string TestDescription => "To test group operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenList list = new GenList(window)
+ {
+ Homogeneous = false,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass groupClass = new GenItemClass("group_index")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return string.Format("{0} - {1}", (string)obj, part);
+ }
+ };
+
+ GenListItem[] groups = new GenListItem[10];
+
+ for (int i = 0; i < 10; i++)
+ {
+ groups[i] = list.Append(groupClass, string.Format("{0}", i), GenListItemType.Group);
+ }
+
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return string.Format("{0} - {1}", (string)obj, part);
+ },
+ GetContentHandler = (obj, part) =>
+ {
+ Console.WriteLine("{0} - {1}", (string)obj, part);
+ return null;
+ }
+ };
+
+ GenItemClass fullyCustomizeClass = new GenItemClass("full")
+ {
+ GetContentHandler = (obj, part) =>
+ {
+ Console.WriteLine("{0} part create requested", part);
+ var btn = new Button(window)
+ {
+ Text = "Button in List",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ return btn;
+ }
+ };
+
+ for (int j = 0; j < 10; j++)
+ {
+ for (int i = 0; i < 20; i++)
+ {
+ list.Append(j == 0 ? fullyCustomizeClass : defaultClass, string.Format("{0} Item", i), GenListItemType.Normal, groups[j]);
+ }
+ }
+
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+ list.Geometry = window.GetInnerSquare();
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class GenListTest4 : WearableTestCase
+ {
+ public override string TestName => "GenListTest4";
+ public override string TestDescription => "To test Append/Prepend/InsertBefore operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenList list = new GenList(window)
+ {
+ Homogeneous = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return string.Format("{0} - {1}", (string)obj, part);
+ }
+ };
+
+ GenListItem[] items = new GenListItem[100];
+ for (int i = 0; i < 100; i++)
+ {
+ if (i < 30)
+ {
+ items[i] = list.Append(defaultClass, string.Format("{0} Item", i));
+ }
+ else if (i < 60)
+ {
+ items[i] = list.Prepend(defaultClass, string.Format("{0} Item", i));
+ }
+ else
+ {
+ items[i] = list.InsertBefore(defaultClass, string.Format("{0} Item", i), items[50]);
+ }
+ }
+ list.Show();
+ list.ItemSelected += List_ItemSelected; ;
+ conformant.SetContent(list);
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ public class GenListTest5 : WearableTestCase
+ {
+ public override string TestName => "GenListTest5";
+ public override string TestDescription => "To test event operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenList list = new GenList(window)
+ {
+ Homogeneous = true
+ };
+
+ 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.Show();
+ list.ItemSelected += List_ItemSelected; ;
+ list.ItemActivated += List_ItemActivated;
+ list.ItemUnselected += List_ItemUnselected;
+ list.ItemPressed += List_ItemPressed;
+ list.ItemRealized += List_ItemRealized;
+ list.ItemReleased += List_ItemReleased;
+ list.ItemUnrealized += List_ItemUnrealized;
+ list.ItemLongPressed += List_ItemLongPressed;
+ list.ItemDoubleClicked += List_ItemDoubleClicked;
+
+ list.Geometry = window.GetInnerSquare();
+ }
+
+ private void List_ItemDoubleClicked(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was double clicked", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemLongPressed(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was Long pressed", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemUnrealized(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was unrealzed", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemReleased(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was released", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemRealized(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was Realized", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemPressed(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was Pressed", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemUnselected(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was unselected", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemActivated(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was Activated", (string)(e.Item.Data)));
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was selected", (string)(e.Item.Data)));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.Wearable
+{
+ class GenListTest6 : WearableTestCase
+ {
+ public override string TestName => "GenListTest6";
+ public override string TestDescription => "To test deletion of GenListItem";
+ GenListItem selected = null;
+
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ GenList list = new GenList(window)
+ {
+ Homogeneous = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return string.Format("{0} - {1}", (string)obj, part);
+ },
+ DeleteHandler = new GenItemClass.DeleteDelegate((obj) =>
+ {
+ Log.Debug($"DeleteHandler was called with... {(string)obj}");
+ }),
+ };
+ GenListItem[] items = new GenListItem[100];
+ for (int i = 0; i < 100; i++)
+ {
+ items[i] = list.Append(defaultClass, string.Format("{0} Item", i));
+ }
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+ list.ItemActivated += List_ItemActivated;
+ list.ItemUnselected += List_ItemUnselected;
+ list.ItemPressed += List_ItemPressed;
+ list.ItemRealized += List_ItemRealized;
+ list.ItemReleased += List_ItemReleased;
+ list.ItemUnrealized += List_ItemUnrealized;
+ list.ItemLongPressed += List_ItemLongPressed;
+ list.ItemDoubleClicked += List_ItemDoubleClicked;
+
+ var square = window.GetInnerSquare();
+
+ list.Geometry = new Rect(square.X, square.Y, square.Width, square.Height * 3 / 4);
+
+ Button first = new Button(window)
+ {
+ Text = "Delete",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ first.Clicked += (s, e) =>
+ {
+ selected?.Delete();
+ };
+ first.Show();
+ first.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width, square.Height / 4);
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ selected = e.Item;
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ private void List_ItemDoubleClicked(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was double clicked", (string)(e.Item.Data));
+ }
+
+ private void List_ItemLongPressed(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was Long pressed", (string)(e.Item.Data));
+ }
+
+ private void List_ItemUnrealized(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("!!!! Item was Unrealized!!!");
+ Console.WriteLine("{0} Item was unrealzed", (string)(e.Item.Data));
+ }
+
+ private void List_ItemReleased(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was released", (string)(e.Item.Data));
+ }
+
+ private void List_ItemRealized(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was Realized", (string)(e.Item.Data));
+ }
+
+ private void List_ItemPressed(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was Pressed", (string)(e.Item.Data));
+ }
+
+ private void List_ItemUnselected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was unselected", (string)(e.Item.Data));
+ }
+
+ private void List_ItemActivated(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was Activated", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test.Wearable
+{
+ class GenListTest7 : WearableTestCase
+ {
+ public override string TestName => "GenListTest7";
+ public override string TestDescription => "To test basic operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+ GenList list = new GenList(window)
+ {
+ Homogeneous = true,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ Button button = new Button(window)
+ {
+ Text = "Remove",
+ AlignmentX = -1,
+ AlignmentY = -1,
+ };
+
+ GenItemClass defaultClass = new GenItemClass("default")
+ {
+ GetTextHandler = (obj, part) =>
+ {
+ return string.Format("{0} - {1}", (string)obj, part);
+ }
+ };
+
+ GenListItem[] itemArr = new GenListItem[9];
+ for (int i = 0; i < 9; i++)
+ {
+ itemArr[i] = list.Append(defaultClass, string.Format("{0} Item", i));
+ }
+
+ int idx = 0;
+ button.Clicked += (s, e) =>
+ {
+ if (idx < 9)
+ {
+ Console.WriteLine("GenListItem deleted");
+ itemArr[idx++].Delete();
+ }
+ };
+ button.Show();
+
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+ list.ItemRealized += List_ItemRealized;
+ list.ItemUnrealized += List_ItemUnrealized;
+
+ var square = window.GetInnerSquare();
+ list.Geometry = new Rect(square.X, square.Y, square.Width, square.Height * 3 / 4);
+ button.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width, square.Height / 4);
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was selected", (string)(e.Item.Data));
+ }
+ private void List_ItemRealized(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was realized", (string)(e.Item.Data));
+ }
+ private void List_ItemUnrealized(object sender, GenListItemEventArgs e)
+ {
+ Console.WriteLine("{0} Item was unrealized", (string)(e.Item.Data));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test.Wearable
+{
+ class GenListTest8 : WearableTestCase
+ {
+
+ Dictionary<EvasObject, Button> _cacheMap = new Dictionary<EvasObject, Button>();
+ public override string TestName => "GenListTest8";
+ public override string TestDescription => "To test group operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window)
+ {
+ Color = Color.Gray,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ bg.Show();
+ bg.Lower();
+
+ window.AddResizeObject(bg);
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Check check = new Check(window);
+ check.Show();
+ check.IsChecked = true;
+ check.Text = "Reuse?";
+
+ GenList list = new GenList(window)
+ {
+ Homogeneous = false,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass fullyCustomizeClass = new GenItemClass("full")
+ {
+ GetContentHandler = (obj, part) =>
+ {
+ Log.Debug(string.Format("{0} part create requested", part));
+ var btn = new Button(window)
+ {
+ AlignmentX = -1,
+ WeightX = 1,
+ Text = (string)obj
+ };
+ return btn;
+ },
+ ReusableContentHandler = (object data, string part, EvasObject old) =>
+ {
+ Log.Debug(string.Format("{0} part reuse requested", part));
+ if (!check.IsChecked)
+ {
+ return null;
+ }
+ var btn = old as Button;
+ btn.Text = (string)data;
+ return old;
+ }
+ };
+
+ for (int i = 0; i < 100; i++)
+ {
+ list.Append(fullyCustomizeClass, string.Format("{0} Item", i), GenListItemType.Normal);
+ }
+
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+
+ var square = window.GetInnerSquare();
+
+ check.Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 4);
+ list.Geometry = new Rect(square.X, square.Y + square.Height / 4, square.Width, square.Height * 3 / 4);
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ Log.Debug(string.Format("{0} Item was selected", (string)(e.Item.Data)));
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test.Wearable
+{
+ class GenListTest9 : WearableTestCase
+ {
+
+ public class ItemContext
+ {
+ public object Data;
+ public GenListItem Item;
+ public EvasObject Realized;
+ }
+
+ Dictionary<EvasObject, Button> _cacheMap = new Dictionary<EvasObject, Button>();
+
+ Dictionary<ItemObject, EvasObject> _realizedMap = new Dictionary<ItemObject, EvasObject>();
+ public override string TestName => "GenListTest9";
+ public override string TestDescription => "To test FieldUpdate operation of GenList";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window)
+ {
+ Color = Color.Gray,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+ bg.Show();
+ bg.Lower();
+
+ window.AddResizeObject(bg);
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ GenList list = new GenList(window)
+ {
+ Homogeneous = false,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ GenItemClass fullyCustomizeClass = new GenItemClass("full")
+ {
+ GetContentHandler = (obj, part) =>
+ {
+ Log.Debug(string.Format("{0} part create requested", part));
+ var btn = new Button(window)
+ {
+ AlignmentX = -1,
+ WeightX = 1,
+ Text = (string)(obj as ItemContext).Data
+ };
+ btn.MinimumHeight = 100;
+ (obj as ItemContext).Realized = btn;
+ (obj as ItemContext).Item?.UpdateField("elm.swallow.content", GenListItemFieldType.None);
+ return btn;
+ },
+ };
+
+ for (int i = 0; i < 100; i++)
+ {
+ var context = new ItemContext();
+ context.Data = string.Format("{0} Item", i);
+ context.Item = list.Append(fullyCustomizeClass, context, GenListItemType.Normal);
+ }
+
+ list.Show();
+ list.ItemSelected += List_ItemSelected;
+
+ list.Geometry = window.GetInnerSquare();
+ }
+
+ private void List_ItemSelected(object sender, GenListItemEventArgs e)
+ {
+ var itemContext = e.Item.Data as ItemContext;
+ Log.Debug(string.Format("{0} Item was selected", (string)(itemContext.Data)));
+ itemContext.Realized.MinimumHeight += 20;
+ e.Item.UpdateField("elm.swallow.content", GenListItemFieldType.None);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test.Wearable
+{
+ class GestureLayerTest1 : WearableTestCase
+ {
+ public override string TestName => "GestureLayerTest1";
+ public override string TestDescription => "Demonstrate GestureLayer features: Tap, DoubleTap, Rotate, Zoom detection.";
+
+ private GestureLayer _glayer;
+ private Background _background;
+ private Rectangle _box1;
+
+ public override void Run(Window window)
+ {
+ _background = new Background(window);
+ var windowSize = window.ScreenSize;
+ _background.Color = Color.White;
+ _background.Resize(windowSize.Width, windowSize.Height);
+ _background.Show();
+
+ _box1 = new Rectangle(window)
+ {
+ Color = Color.Yellow
+ };
+ _box1.Geometry = window.GetInnerSquare();
+ _box1.Show();
+
+ Msg("Double tap to register additional gestures. Tripple tap to unregister them.");
+
+ _glayer = new GestureLayer(_box1);
+ _glayer.Attach(_box1);
+
+ _glayer.SetTapCallback(GestureLayer.GestureType.Tap, GestureLayer.GestureState.End, (info) => {
+ Msg("Tap {0},{1}", info.X, info.Y);
+ });
+
+ _glayer.SetTapCallback(GestureLayer.GestureType.DoubleTap, GestureLayer.GestureState.End, (info) => {
+ Msg("DoubleTap {0},{1} {2}", info.X, info.Y, info.FingersCount);
+ _glayer.SetLineCallback(GestureLayer.GestureState.End, (line) => {
+ Msg("Line {0},{1}-{2},{3}, M:{4},{5}", line.X1, line.Y1, line.X2, line.Y2, line.HorizontalMomentum, line.VerticalMomentum);
+ });
+ _glayer.SetFlickCallback(GestureLayer.GestureState.End, (flick) => {
+ Msg("Flick {0},{1}-{2},{3}, M:{4},{5}", flick.X1, flick.Y1, flick.X2, flick.Y2, flick.HorizontalMomentum, flick.VerticalMomentum);
+ });
+ _glayer.RotateStep = 3;
+ _glayer.SetRotateCallback(GestureLayer.GestureState.Move, (rotate) => {
+ Msg("Rotation {0},{1} a:{2:F3} ba:{3:F3}", rotate.X, rotate.Y, rotate.Angle, rotate.BaseAngle);
+ });
+ _glayer.SetZoomCallback(GestureLayer.GestureState.End, (zoom) => {
+ Msg("Zoom {0},{1} r:{2} z:{3:F3}", zoom.X, zoom.Y, zoom.Radius, zoom.Zoom);
+ });
+ Msg("Line, Flick, Rotate, and Zoom callbacks enabled.");
+ });
+
+ _glayer.SetTapCallback(GestureLayer.GestureType.TripleTap, GestureLayer.GestureState.End, (info) => {
+ Msg("TrippleTap {0},{1} {2}", info.X, info.Y, info.FingersCount);
+ _glayer.SetLineCallback(GestureLayer.GestureState.End, null);
+ _glayer.SetFlickCallback(GestureLayer.GestureState.End, null);
+ _glayer.SetRotateCallback(GestureLayer.GestureState.Move, null);
+ _glayer.SetZoomCallback(GestureLayer.GestureState.End, null);
+ Msg("Cleared Line, Flick, Rotate, and Zoom callbacks.");
+ });
+ // Momentum is not used, it seems that it conflicts with Rotate and Zoom
+ }
+
+ private void Msg(string format, params object[] args)
+ {
+ var entry = string.Format(format, args);
+ Log.Debug(entry);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test.Wearable
+{
+ public class IconTest1 : WearableTestCase
+ {
+ public override string TestName => "IconTest1";
+ public override string TestDescription => "To test basic operation of Icon";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.Gray
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Scroller scroller = new Scroller(window);
+ scroller.Show();
+ scroller.Geometry = window.GetInnerSquare();
+ Box box = new Box(window);
+ box.Show();
+ scroller.SetContent(box);
+
+ List<string> iconList = new List<string>{ "home", "close", "apps", "arrow_up", "arrow_down", "arrow_left", "arrow_right", "chat", "clock", "delete", "edit", "refresh", "folder", "file",
+ "menu/home", "menu/close", "menu/apps", "menu/arrow_up", "menu/arrow_down", "menu/arrow_left", "menu/arrow_right", "menu/chat", "menu/clock", "menu/delete", "menu/edit", "menu/refresh", "menu/folder",
+ "menu/file", "media_player/forward", "media_player/info", "media_player/next", "media_player/pause", "media_player/play", "media_player/prev", "media_player/rewind", "media_player/stop"};
+
+ foreach (var iconName in iconList)
+ {
+ Label label = new Label(window)
+ {
+ Text = iconName,
+ };
+ Icon icon = new Icon(window)
+ {
+ IconLookupOrder = IconLookupOrder.ThemeFirst,
+ StandardIconName = iconName,
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ MinimumHeight = 100,
+ MinimumWidth = 100,
+ };
+ icon.Show();
+ label.Show();
+ box.PackEnd(icon);
+ box.PackEnd(label);
+ }
+
+
+ }
+ }
+}