sibling order test 12/119612/2
authordongsug.song <dongsug.song@samsung.com>
Fri, 17 Mar 2017 13:36:07 +0000 (22:36 +0900)
committerdongsug song <dongsug.song@samsung.com>
Mon, 20 Mar 2017 00:36:02 +0000 (17:36 -0700)
Signed-off-by: dongsug.song <dongsug.song@samsung.com>
Change-Id: I2c59402b5e7d0f3ee53c979488816d73f6d070e5

NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj
NUISamples/NUISamples.TizenTV/examples/test1.cs [new file with mode: 0755]

index 8838591..4e100de 100755 (executable)
@@ -58,6 +58,7 @@
     <Compile Include="examples\date-picker-using-json.cs" />\r
     <Compile Include="examples\date-picker.cs" />\r
     <Compile Include="examples\flex-container.cs" />\r
+    <Compile Include="examples\test1.cs" />\r
     <Compile Include="examples\visual-view-test.cs" />\r
     <Compile Include="examples\hello-world.cs" />\r
     <Compile Include="Properties\AssemblyInfo.cs" />\r
diff --git a/NUISamples/NUISamples.TizenTV/examples/test1.cs b/NUISamples/NUISamples.TizenTV/examples/test1.cs
new file mode 100755 (executable)
index 0000000..0a7f970
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright (c) 2017 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.NUI;
+using System.Collections.Generic;
+
+
+// 1) sibling order test\r
+namespace Test1
+{
+    class Example : NUIApplication
+    {
+        public Example() : base()
+        {
+        }
+
+        public Example(string stylesheet) : base(stylesheet)
+        {
+        }
+
+        public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
+        {
+        }
+
+        protected override void OnCreate()
+        {
+            base.OnCreate();
+            Initialize();
+        }
+
+        Stage _stage;
+        public void Initialize()
+        {
+            _stage = Stage.Instance;
+            _stage.BackgroundColor = Color.White;\r
+\r
+            // 1) sibling order test\r
+            SiblingTest();\r
+\r
+\r
+        }\r
+\r
+        public void SiblingTest()\r
+        {\r
+            View _prev = null;\r
+            Position2D _myPos = new Position2D(100, 100);\r
+            List<View> list_view = new List<View>();\r
+            TextLabel _txt = new TextLabel();\r
+\r
+            for (int i = 0; i < 10; i++)\r
+            {\r
+                View _view0 = new PushButton();\r
+                PushButton _view = _view0 as PushButton;\r
+\r
+                _view.Name = "sibling" + i;\r
+                _view.MinimumSize = new Size2D(100, 50);\r
+                _view.LabelText = "sibling" + i;\r
+                _view.ParentOrigin = ParentOrigin.TopLeft;\r
+                _view.AnchorPoint = AnchorPoint.TopLeft;\r
+                _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);\r
+                _view.Clicked += (sender, ee) =>\r
+                {\r
+                    View curr = sender as View;\r
+                    Tizen.Log.Debug("NUI", "clicked curr view name=" + curr.Name + "  sibling=" + curr.SiblingOrder);\r
+                    curr.RaiseToTop();\r
+                    if (_prev)\r
+                    {\r
+                        _prev.LowerToBottom();\r
+                        Tizen.Log.Debug("NUI", "raise on top is called!curr sibling=" + curr.SiblingOrder + " prev name=" + _prev.Name + " sibling=" + _prev.SiblingOrder);\r
+                    }\r
+                    _prev = curr;\r
+                    _txt.Text = "on top: " + curr.Name + ", sibling order=" + curr.SiblingOrder;\r
+                    return true;\r
+                };\r
+                list_view.Add(_view);\r
+            }\r
+\r
+            for (int i = 0; i < 10; i++)\r
+            {\r
+                _stage.GetDefaultLayer().Add(list_view[i]);\r
+                Tizen.Log.Debug("NUI", list_view[i].Name + "'s sibling order=" + list_view[i].SiblingOrder);\r
+            }\r
+\r
+            _txt.ParentOrigin = ParentOrigin.TopLeft;\r
+            _txt.AnchorPoint = AnchorPoint.TopLeft;\r
+            _txt.Text = "on top: sibling#, sibling order=?";\r
+            _txt.Position2D = _myPos + new Position2D(-50, 200);\r
+            _txt.TextColor = Color.Blue;\r
+            _stage.GetDefaultLayer().Add(_txt);\r
+        }\r
+
+        [STAThread]
+        static void _Main(string[] args)
+        {
+            Example example = new Example();
+            example.Run(args);
+        }
+    }
+}