4 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Samples
10 public class SubWindowTest : IExample
12 string tag = "NUITEST";
21 mainWin = NUIApplication.GetDefaultWindow();
22 mainWin.KeyEvent += OnKeyEvent;
23 mainWin.BackgroundColor = Color.Cyan;
24 mainWin.WindowSize = new Size2D(500, 500);
25 mainWin.TouchEvent += WinTouchEvent;
28 TextLabel text = new TextLabel("Hello Tizen NUI World");
29 text.HorizontalAlignment = HorizontalAlignment.Center;
30 text.VerticalAlignment = VerticalAlignment.Center;
31 text.TextColor = Color.Blue;
32 text.PointSize = 12.0f;
33 text.HeightResizePolicy = ResizePolicyType.FillToParent;
34 text.WidthResizePolicy = ResizePolicyType.FillToParent;
37 Animation animation = new Animation(2000);
38 animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
39 animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
40 animation.Looping = true;
43 log.Fatal(tag, "animation play!");
50 log.Fatal(tag, $"Sub Window3 is already created");
53 subWin3 = new Window("subWin3", new Rectangle(0, 0, 300, 300), false);
54 subWin3.BackgroundColor = Color.Blue;
55 View dummy = new View()
57 Size = new Size(100, 100),
58 Position = new Position(50, 50),
59 BackgroundColor = Color.Yellow,
62 subWin3.KeyEvent += subWin3_KeyEvent;
68 subWin3.SetParent(mainWin, false);
74 subWin3.SetParent(mainWin, true);
77 public void subWin3_KeyEvent(object sender, Window.KeyEventArgs e)
79 if (e.Key.State == Key.StateType.Down)
81 log.Fatal(tag, $"key down! key={e.Key.KeyPressedName}");
83 switch (e.Key.KeyPressedName)
95 public void WinTouchEvent(object sender, Window.TouchEventArgs e)
97 if (e.Touch.GetState(0) == PointStateType.Up)
99 if(belowParent == false)
112 public void OnKeyEvent(object sender, Window.KeyEventArgs e)
114 if (e.Key.State == Key.StateType.Down)
116 log.Fatal(tag, $"key down! key={e.Key.KeyPressedName}");
118 switch (e.Key.KeyPressedName)
154 log.Fatal(tag, $"no test!");
163 log.Fatal(tag, "test 1 : 1) make sub window-1 2) add some dummy object");
165 subWin1 = new Window("subwin1", new Rectangle(500, 500, 300, 300), false);
166 subWin1.BackgroundColor = Color.Blue;
167 View dummy = new View()
169 Size = new Size(100, 100),
170 Position = new Position(50, 50),
171 BackgroundColor = Color.Yellow,
174 subWin1.KeyEvent += SubWin1_KeyEvent;
178 log.Fatal(tag, "test 2 : 1) do dispose of sub window-1 created in #1");
183 log.Fatal(tag, $"test 3 : 1) create sub window2 which doesn't have any setting 2) dispose it after 3 second delay");
185 subWin2 = new Window();
186 tm = new Timer(3000);
192 log.Fatal(tag, $"test 4 : 1) create sub window2 which has some setting 2) dispose it after 3 second delay");
194 subWin2 = new Window("subWin2", new Rectangle(100, 100, 100, 100), false);
195 subWin2.BackgroundColor = Color.Red;
196 tm = new Timer(3000);
202 log.Fatal(tag, $"test 5 : 1) create sub window2 which has some setting 2) add some dummy object 3) dispose it after 3 second delay");
204 subWin2 = new Window("subWin2", new Rectangle(500, 500, 300, 300), false);
205 subWin2.BackgroundColor = Color.Red;
208 Size = new Size(50, 50),
209 Position = new Position(50, 50),
210 BackgroundColor = Color.Yellow,
214 tm = new Timer(3000);
219 private bool Tm_Tick(object source, Timer.TickEventArgs e)
221 log.Fatal(tag, $"after 3000ms, subwin2 dispose!");
226 private void SubWin1_KeyEvent(object sender, Window.KeyEventArgs e)
228 if (e.Key.State == Key.StateType.Down)
230 log.Fatal(tag, $"subWin1 key down! key={e.Key.KeyPressedName}");
232 switch (e.Key.KeyPressedName)
242 log.Fatal(tag, $"default!");
249 public void Activate() { Initialize(); }
250 public void Deactivate() { }