summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-01-09 16:56:43 -0800
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-01-09 16:56:43 -0800
commitb3c56cd2017e55dcc107a144b17a796ab87748d8 (patch)
treeb48a63c37ef1e98721d61bfbb41bba6b88ffa47d
parent145eb051982060b3de0029244ea922b5f878e93b (diff)
parentf3484fb48889f692f63e95216458676c98ab50f9 (diff)
downloadelm-sharp-b3c56cd2017e55dcc107a144b17a796ab87748d8.tar.gz
elm-sharp-b3c56cd2017e55dcc107a144b17a796ab87748d8.tar.bz2
elm-sharp-b3c56cd2017e55dcc107a144b17a796ab87748d8.zip
Merge "Add ScreenDpi API in Window class" into tizen
-rw-r--r--ElmSharp.Test/ElmSharp.Test.csproj3
-rw-r--r--ElmSharp.Test/TC/ScreenInformationTest.cs111
-rw-r--r--ElmSharp.Test/TestRunner.cs1
-rw-r--r--ElmSharp/ElmSharp/Window.cs11
-rw-r--r--ElmSharp/Interop/Interop.Elementary.Win.cs3
5 files changed, 127 insertions, 2 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index ac91e1b..4eeca22 100644
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -43,6 +43,7 @@
<Compile Include="TC\BackgroundTest1.cs" />
<Compile Include="TC\BackgroundTest2.cs" />
<Compile Include="TC\BackgroundTest3.cs" />
+ <Compile Include="TC\ScreenInformationTest.cs" />
<Compile Include="TC\BoxLayoutTest1.cs" />
<Compile Include="TC\BoxTest1.cs" />
<Compile Include="TC\BackgroundColorTest1.cs" />
@@ -188,4 +189,4 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project> \ No newline at end of file
+</Project>
diff --git a/ElmSharp.Test/TC/ScreenInformationTest.cs b/ElmSharp.Test/TC/ScreenInformationTest.cs
new file mode 100644
index 0000000..92a5d4a
--- /dev/null
+++ b/ElmSharp.Test/TC/ScreenInformationTest.cs
@@ -0,0 +1,111 @@
+/*
+ * 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.Linq;
+
+namespace ElmSharp.Test
+{
+ public class ScreenInformationTest : TestCaseBase
+ {
+ public override string TestName => "ScreenInformationTest";
+ public override string TestDescription => "To get screen information";
+
+ Naviframe _navi;
+ int _sequence = 0;
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window);
+ box.Show();
+ conformant.SetContent(box);
+ Label label = new Label(window);
+ label.SetAlignment(-1, 0);
+ label.SetWeight(1, 0);
+ label.Text = string.Format("<span color=#FFFFFF , font_size=50>ScreenSize : {0}x{1}", window.ScreenSize.Width, window.ScreenSize.Height);
+ label.Show();
+ box.PackEnd(label);
+ Label label2 = new Label(window);
+ label2.SetAlignment(-1, 0);
+ label2.SetWeight(1, 0);
+ label2.Text = string.Format("<span color=#FFFFFF , font_size=50>ScreenDPI : xdpi : {0} ydpi : {1}", window.ScreenDpi.X, window.ScreenDpi.Y);
+ label2.Show();
+ box.PackEnd(label2);
+ }
+
+ EvasObject CreatePage(Window parent)
+ {
+ Box box = new Box(parent);
+ box.Show();
+
+ Label label = new Label(parent)
+ {
+ Text = string.Format("{0} Page", _sequence++),
+ WeightX = 1,
+ AlignmentX = -1,
+ };
+ Button push = new Button(parent)
+ {
+ Text = "Push",
+ WeightX = 1,
+ AlignmentX = -1,
+ };
+ Button pop = new Button(parent)
+ {
+ Text = "pop",
+ WeightX = 1,
+ AlignmentX = -1,
+ };
+
+ label.Show();
+ push.Show();
+ pop.Show();
+
+ push.Clicked += (s, e) =>
+ {
+ _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence - 1));
+ };
+
+ pop.Clicked += (s, e) =>
+ {
+ var item = _navi.NavigationStack.LastOrDefault();
+ int nativePointer = (int)(IntPtr)(item.Content);
+ Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer);
+ _navi.Pop();
+ Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer);
+ };
+
+ push.Resize(500, 100);
+ pop.Resize(500, 100);
+ label.Resize(500, 100);
+ box.SetLayoutCallback(() =>
+ {
+ Console.WriteLine("Layout callback with : {0}", box.Geometry);
+ var rect = box.Geometry;
+ label.Move(rect.X, rect.Y);
+ push.Move(rect.X, rect.Y + 100);
+ pop.Move(rect.X, rect.Y + 200);
+ });
+
+ box.PackEnd(label);
+ box.PackEnd(push);
+ box.PackEnd(pop);
+ return box;
+ }
+ }
+}
diff --git a/ElmSharp.Test/TestRunner.cs b/ElmSharp.Test/TestRunner.cs
index 0d7afa2..b359d20 100644
--- a/ElmSharp.Test/TestRunner.cs
+++ b/ElmSharp.Test/TestRunner.cs
@@ -128,6 +128,7 @@ namespace ElmSharp.Test
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)
diff --git a/ElmSharp/ElmSharp/Window.cs b/ElmSharp/ElmSharp/Window.cs
index 1b4d54d..3409b2d 100644
--- a/ElmSharp/ElmSharp/Window.cs
+++ b/ElmSharp/ElmSharp/Window.cs
@@ -90,6 +90,16 @@ namespace ElmSharp
}
}
+ public Point ScreenDpi
+ {
+ get
+ {
+ Point point = default(Point);
+ Interop.Elementary.elm_win_screen_dpi_get(Handle, out point.X, out point.Y);
+ return point;
+ }
+ }
+
public int Rotation
{
get
@@ -151,7 +161,6 @@ namespace ElmSharp
}
}
-
public void Active()
{
Interop.Elementary.elm_win_activate(Handle);
diff --git a/ElmSharp/Interop/Interop.Elementary.Win.cs b/ElmSharp/Interop/Interop.Elementary.Win.cs
index bc7c0b9..aadc2de 100644
--- a/ElmSharp/Interop/Interop.Elementary.Win.cs
+++ b/ElmSharp/Interop/Interop.Elementary.Win.cs
@@ -115,5 +115,8 @@ internal static partial class Interop
rotations = null;
return false;
}
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern void elm_win_screen_dpi_get(IntPtr obj, out int xdpi, out int ydpi);
}
}