1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
18 using Tizen.NUI.UIComponents;
19 using Tizen.NUI.BaseComponents;
20 using System.Collections.Generic;
23 // 1) sibling order test
24 namespace SiblingOrderTest
26 class Example : NUIApplication
28 public Example() : base()
32 public Example(string stylesheet) : base(stylesheet)
36 public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
40 protected override void OnCreate()
48 public void Initialize()
50 _window = Window.Instance;
51 _window.BackgroundColor = Color.White;
54 // By default, the SiblingOrder is 0.
58 // Set the SiblingOrder 0 -> 9
62 // Set the SiblingOrder 10 -> 1
66 // Set the SiblingOrder 5 -> 1 & 0 -> 4
70 // Set the SiblingOrder 0 -> 4 & 5 -> 1
74 public void SiblingTest1()
76 Position2D _myPos = new Position2D(100, 30);
78 for (int i = 0; i < 10; i++)
80 PushButton _view = new PushButton();
82 _view.Name = "sibling" + i;
83 _view.LabelText = "view" + i;
84 _view.MinimumSize = new Size2D(100, 50);
85 _view.ParentOrigin = ParentOrigin.TopLeft;
86 _view.PivotPoint = PivotPoint.TopLeft;
87 _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
93 public void SiblingTest2()
95 Position2D _myPos = new Position2D(100, 180);
97 for (int i = 0; i < 10; i++)
99 PushButton _view = new PushButton();
101 _view.Name = "sibling" + i;
102 _view.LabelText = "view" + i;
103 _view.MinimumSize = new Size2D(100, 50);
104 _view.ParentOrigin = ParentOrigin.TopLeft;
105 _view.PivotPoint = PivotPoint.TopLeft;
106 _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
109 _view.SiblingOrder = i;
113 public void SiblingTest3()
115 Position2D _myPos = new Position2D(100, 330);
117 for (int i = 0; i < 10; i++)
119 PushButton _view = new PushButton();
121 _view.Name = "sibling" + i;
122 _view.LabelText = "view" + i;
123 _view.MinimumSize = new Size2D(100, 50);
124 _view.ParentOrigin = ParentOrigin.TopLeft;
125 _view.PivotPoint = PivotPoint.TopLeft;
126 _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
129 _view.SiblingOrder = 10-i;
133 public void SiblingTest4()
135 Position2D _myPos = new Position2D(100, 480);
137 for (int i = 0; i < 10; i++)
139 PushButton _view = new PushButton();
141 _view.Name = "sibling" + i;
142 _view.LabelText = "view" + i;
143 _view.MinimumSize = new Size2D(100, 50);
144 _view.ParentOrigin = ParentOrigin.TopLeft;
145 _view.PivotPoint = PivotPoint.TopLeft;
146 _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
152 _view.SiblingOrder = 5-i;
156 _view.SiblingOrder = i-5;
161 public void SiblingTest5()
163 Position2D _myPos = new Position2D(100, 630);
165 for (int i = 0; i < 10; i++)
167 PushButton _view = new PushButton();
169 _view.Name = "sibling" + i;
170 _view.LabelText = "view" + i;
171 _view.MinimumSize = new Size2D(100, 50);
172 _view.ParentOrigin = ParentOrigin.TopLeft;
173 _view.PivotPoint = PivotPoint.TopLeft;
174 _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
180 _view.SiblingOrder = i;
184 _view.SiblingOrder = 10-i;
189 static void _Main(string[] args)
191 Example example = new Example();