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.
17 using System.Runtime.InteropServices;
19 using System.Collections.Generic;
22 // 1) sibling order test
25 class Example : NUIApplication
27 public Example() : base()
31 public Example(string stylesheet) : base(stylesheet)
35 public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
39 protected override void OnCreate()
46 public void Initialize()
48 _stage = Stage.Instance;
49 _stage.BackgroundColor = Color.White;
51 // 1) sibling order test
57 public void SiblingTest()
60 Position2D _myPos = new Position2D(100, 100);
61 List<View> list_view = new List<View>();
62 TextLabel _txt = new TextLabel();
64 for (int i = 0; i < 10; i++)
66 View _view0 = new PushButton();
67 PushButton _view = _view0 as PushButton;
69 _view.Name = "sibling" + i;
70 _view.MinimumSize = new Size2D(100, 50);
71 _view.LabelText = "sibling" + i;
72 _view.ParentOrigin = ParentOrigin.TopLeft;
73 _view.AnchorPoint = AnchorPoint.TopLeft;
74 _view.Position2D = _myPos + new Position2D(20 * i, 10 * i);
75 _view.Clicked += (sender, ee) =>
77 View curr = sender as View;
78 Tizen.Log.Debug("NUI", "clicked curr view name=" + curr.Name + " sibling=" + curr.SiblingOrder);
82 _prev.LowerToBottom();
83 Tizen.Log.Debug("NUI", "raise on top is called!curr sibling=" + curr.SiblingOrder + " prev name=" + _prev.Name + " sibling=" + _prev.SiblingOrder);
86 _txt.Text = "on top: " + curr.Name + ", sibling order=" + curr.SiblingOrder;
92 for (int i = 0; i < 10; i++)
94 _stage.GetDefaultLayer().Add(list_view[i]);
95 Tizen.Log.Debug("NUI", list_view[i].Name + "'s sibling order=" + list_view[i].SiblingOrder);
98 _txt.ParentOrigin = ParentOrigin.TopLeft;
99 _txt.AnchorPoint = AnchorPoint.TopLeft;
100 _txt.Text = "on top: sibling#, sibling order=?";
101 _txt.Position2D = _myPos + new Position2D(-50, 200);
102 _txt.TextColor = Color.Blue;
103 _stage.GetDefaultLayer().Add(_txt);
107 static void _Main(string[] args)
109 Example example = new Example();