}
/// <summary>
+ /// Sets parent window of the window.
+ /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
+ /// This function has the additional flag whether the child is located above or below of the parent.
+ /// </summary>
+ /// <param name="parent">The parent window.</param>
+ /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
+ /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetParent(Window parent, bool belowParent)
+ {
+ if (IsSupportedMultiWindow() == false)
+ {
+ NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
+ }
+ Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
/// Unsets parent window of the window.
/// After unsetting, the window is disconnected his parent window.
/// </summary>
Window mainWin;
Window subWin1;
Window subWin2;
+ Window subWin3;
Timer tm;
+ bool belowParent;
void Initialize()
{
mainWin = NUIApplication.GetDefaultWindow();
mainWin.KeyEvent += OnKeyEvent;
mainWin.BackgroundColor = Color.Cyan;
mainWin.WindowSize = new Size2D(500, 500);
+ mainWin.TouchEvent += WinTouchEvent;
+ belowParent = false;
TextLabel text = new TextLabel("Hello Tizen NUI World");
text.HorizontalAlignment = HorizontalAlignment.Center;
log.Fatal(tag, "animation play!");
}
+ void CreateSubWin3()
+ {
+ if(subWin3)
+ {
+ log.Fatal(tag, $"Sub Window3 is already created");
+ return;
+ }
+ subWin3 = new Window("subWin3", new Rectangle(0, 0, 300, 300), false);
+ subWin3.BackgroundColor = Color.Blue;
+ View dummy = new View()
+ {
+ Size = new Size(100, 100),
+ Position = new Position(50, 50),
+ BackgroundColor = Color.Yellow,
+ };
+ subWin3.Add(dummy);
+ subWin3.KeyEvent += subWin3_KeyEvent;
+ }
+
+ void SetParentAbove()
+ {
+ CreateSubWin3();
+ subWin3.SetParent(mainWin, false);
+ }
+
+ void SetParentBelow()
+ {
+ CreateSubWin3();
+ subWin3.SetParent(mainWin, true);
+ }
+
+ public void subWin3_KeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ log.Fatal(tag, $"key down! key={e.Key.KeyPressedName}");
+
+ switch (e.Key.KeyPressedName)
+ {
+ case "6":
+ SetParentAbove();
+ break;
+ case "7":
+ SetParentBelow();
+ break;
+ }
+ }
+ }
+
+ public void WinTouchEvent(object sender, Window.TouchEventArgs e)
+ {
+ if (e.Touch.GetState(0) == PointStateType.Up)
+ {
+ if(belowParent == false)
+ {
+ SetParentBelow();
+ belowParent = true;
+ }
+ else
+ {
+ SetParentAbove();
+ belowParent = false;
+ }
+ }
+ }
+
public void OnKeyEvent(object sender, Window.KeyEventArgs e)
{
if (e.Key.State == Key.StateType.Down)
TestCase5();
break;
+ case "6":
+ SetParentAbove();
+ break;
+
+ case "7":
+ SetParentBelow();
+ break;
+
default:
log.Fatal(tag, $"no test!");
break;
tlog.Debug(tag, $"WindowAddFramePresentedCallback END (OK)");
Assert.Pass("WindowAddFramePresentedCallback");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Window SetParent Test")]
+ [Property("SPEC", "Tizen.NUI.Window.SetParent M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowSetParentTest()
+ {
+ tlog.Debug(tag, $"WindowSetParentTest START");
+ try
+ {
+ Window subWin = new Window("subWin", new Rectangle(0, 0, 300, 300), false);
+ subWin.BackgroundColor = Color.Blue;
+ View dummy = new View()
+ {
+ Size = new Size(100, 100),
+ Position = new Position(50, 50),
+ BackgroundColor = Color.Yellow,
+ };
+ subWin.Add(dummy);
+
+ SetParent(myWin);
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
+
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"WindowSetParentTest END (OK)");
+ Assert.Pass("WindowSetParentTest");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window SetParent Below Test")]
+ [Property("SPEC", "Tizen.NUI.Window.SetParent M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowSetParentBelowTest()
+ {
+ tlog.Debug(tag, $"WindowSetParentBelowTest START");
+ try
+ {
+ Window subWin = new Window("subWin", new Rectangle(0, 0, 300, 300), false);
+ subWin.BackgroundColor = Color.Blue;
+ View dummy = new View()
+ {
+ Size = new Size(100, 100),
+ Position = new Position(50, 50),
+ BackgroundColor = Color.Yellow,
+ };
+ subWin.Add(dummy);
+
+ SetParent(myWin, true);
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
+
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"WindowSetParentBelowTest END (OK)");
+ Assert.Pass("WindowSetParentBelowTest");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Window SetParent Above Test")]
+ [Property("SPEC", "Tizen.NUI.Window.SetParent M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void WindowSetParentAboveTest()
+ {
+ tlog.Debug(tag, $"WindowSetParentAboveTest START");
+ try
+ {
+ Window subWin = new Window("subWin", new Rectangle(0, 0, 300, 300), false);
+ subWin.BackgroundColor = Color.Blue;
+ View dummy = new View()
+ {
+ Size = new Size(100, 100),
+ Position = new Position(50, 50),
+ BackgroundColor = Color.Yellow,
+ };
+ subWin.Add(dummy);
+
+ SetParent(myWin, false);
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
+
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"WindowSetParentAboveTest END (OK)");
+
}
}
\ No newline at end of file