summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-07-26 14:08:12 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-26 14:29:04 +0900
commit8d0cb0110990cfaa8c9cf24c144ef848cd06df87 (patch)
tree3fba3dbbfe135c4997886aeed8c069129731ca34
parent3c0eb1f9ba37a3932cac15843c51d83b74652aab (diff)
downloadelm-sharp-8d0cb0110990cfaa8c9cf24c144ef848cd06df87.tar.gz
elm-sharp-8d0cb0110990cfaa8c9cf24c144ef848cd06df87.tar.bz2
elm-sharp-8d0cb0110990cfaa8c9cf24c144ef848cd06df87.zip
Adds Elementary.FocusAutoScrollMode
Change-Id: Ie9c5dd823f7baf47d15924f8fbcba49e4cded2bd
-rw-r--r--[-rwxr-xr-x]ElmSharp.Test/ElmSharp.Test.csproj1
-rw-r--r--ElmSharp.Test/TC/FocusAutoScrollModeTest.cs203
-rw-r--r--ElmSharp/ElmSharp.csproj2
-rw-r--r--ElmSharp/ElmSharp/Elementary.cs34
-rw-r--r--ElmSharp/Interop/Interop.Elementary.cs12
5 files changed, 251 insertions, 1 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index 0dcab8b..e044e7b 100755..100644
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -47,6 +47,7 @@
<Compile Include="TC\BackgroundTest1.cs" />
<Compile Include="TC\BackgroundTest2.cs" />
<Compile Include="TC\BackgroundTest3.cs" />
+ <Compile Include="TC\FocusAutoScrollModeTest.cs" />
<Compile Include="TC\GestureLayerTest1.cs" />
<Compile Include="TC\ProgressBarTest2.cs" />
<Compile Include="TC\ScrollerTest3.cs" />
diff --git a/ElmSharp.Test/TC/FocusAutoScrollModeTest.cs b/ElmSharp.Test/TC/FocusAutoScrollModeTest.cs
new file mode 100644
index 0000000..c0aa049
--- /dev/null
+++ b/ElmSharp.Test/TC/FocusAutoScrollModeTest.cs
@@ -0,0 +1,203 @@
+/*
+ * 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 class FocusAutoScrollModeTest : TestCaseBase
+ {
+ public override string TestName => "FocusAutoScrollModeTest";
+ public override string TestDescription => "To test basic operation of Elementary.FocusAutoScrollMode";
+
+ 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();
+ Box box = new Box(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ };
+ box.Show();
+ conformant.SetContent(box);
+
+ box.PackEnd(grid);
+
+ Button show = new Button(window)
+ {
+ Text = "Show",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ Button none = new Button(window)
+ {
+ Text = "None",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+ Button bringIn = new Button(window)
+ {
+ Text = "BringIn",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+
+ show.Clicked += (s, e) =>
+ {
+ Elementary.FocusAutoScrollMode = FocusAutoScrollMode.Show;
+ Console.WriteLine("FocusAutoScrollMode : {0}", Elementary.FocusAutoScrollMode);
+ };
+ none.Clicked += (s, e) =>
+ {
+ Elementary.FocusAutoScrollMode = FocusAutoScrollMode.None;
+ Console.WriteLine("FocusAutoScrollMode : {0}", Elementary.FocusAutoScrollMode);
+ };
+ bringIn.Clicked += (s, e) =>
+ {
+ Elementary.FocusAutoScrollMode = FocusAutoScrollMode.BringIn;
+ Console.WriteLine("FocusAutoScrollMode : {0}", Elementary.FocusAutoScrollMode);
+ };
+
+ show.Show();
+ none.Show();
+ bringIn.Show();
+
+ box.PackEnd(show);
+ box.PackEnd(none);
+ box.PackEnd(bringIn);
+
+ 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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{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;
+ Console.WriteLine("#{0:X}{1:X}{2:X} is Activated", color.R, color.G, color.B);
+ }
+ }
+}
diff --git a/ElmSharp/ElmSharp.csproj b/ElmSharp/ElmSharp.csproj
index ed2b646..3016921 100644
--- a/ElmSharp/ElmSharp.csproj
+++ b/ElmSharp/ElmSharp.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <Version>1.2.2</Version>
+ <Version>1.2.3</Version>
<Authors>Samsung Electronics</Authors>
<Copyright>© Samsung Electronics Co., Ltd All Rights Reserved</Copyright>
<Description>
diff --git a/ElmSharp/ElmSharp/Elementary.cs b/ElmSharp/ElmSharp/Elementary.cs
index cf26c57..a83be9f 100644
--- a/ElmSharp/ElmSharp/Elementary.cs
+++ b/ElmSharp/ElmSharp/Elementary.cs
@@ -21,6 +21,25 @@ using System.IO;
namespace ElmSharp
{
/// <summary>
+ /// Focus Autoscroll Mode
+ /// </summary>
+ public enum FocusAutoScrollMode
+ {
+ /// <summary>
+ /// Directly show the focused region or item automatically
+ /// </summary>
+ Show,
+ /// <summary>
+ /// Do not show the focused region or item automatically
+ /// </summary>
+ None,
+ /// <summary>
+ /// Bring in the focused region or item automatically which might invole the scrolling
+ /// </summary>
+ BringIn
+ }
+
+ /// <summary>
/// The Elementary is a General Elementary,a VERY SIMPLE toolkit.
/// </summary>
public static class Elementary
@@ -134,6 +153,21 @@ namespace ElmSharp
}
/// <summary>
+ /// Gets of sets focus auto scroll mode.
+ /// </summary>
+ public static FocusAutoScrollMode FocusAutoScrollMode
+ {
+ get
+ {
+ return (FocusAutoScrollMode)Interop.Elementary.elm_config_focus_autoscroll_mode_get();
+ }
+ set
+ {
+ Interop.Elementary.elm_config_focus_autoscroll_mode_set((Interop.Elementary.Elm_Focus_Autoscroll_Mode)value);
+ }
+ }
+
+ /// <summary>
/// Initializes Elementary.
/// </summary>
public static void Initialize()
diff --git a/ElmSharp/Interop/Interop.Elementary.cs b/ElmSharp/Interop/Interop.Elementary.cs
index 3791d11..2da2a60 100644
--- a/ElmSharp/Interop/Interop.Elementary.cs
+++ b/ElmSharp/Interop/Interop.Elementary.cs
@@ -55,6 +55,12 @@ internal static partial class Interop
// A message with a struct containing a string and list of floating point numbers as value. Use #Edje_Message_String_Float_Set structs as message body, for this type.
EDJE_MESSAGE_STRING_FLOAT_SET = 11
}
+ internal enum Elm_Focus_Autoscroll_Mode
+ {
+ ELM_FOCUS_AUTOSCROLL_MODE_SHOW,
+ ELM_FOCUS_AUTOSCROLL_MODE_NONE,
+ ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN
+ }
[DllImport(Libraries.Elementary)]
internal static extern void elm_config_scroll_bring_in_scroll_friction_set(double time);
@@ -63,6 +69,12 @@ internal static partial class Interop
internal static extern double elm_config_scroll_bring_in_scroll_friction_get();
[DllImport(Libraries.Elementary)]
+ internal static extern void elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern Elm_Focus_Autoscroll_Mode elm_config_focus_autoscroll_mode_get();
+
+ [DllImport(Libraries.Elementary)]
internal static extern IntPtr elm_config_accel_preference_set(string preference);
[DllImport(Libraries.Elementary)]