Previous native window data type can not support negative window coordinates.
New native window position data type support that.
--- /dev/null
+/*
+ * Copyright(c) 2021 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.
+ *
+ */
+namespace Tizen.NUI
+{
+ internal static partial class Interop
+ {
+ internal static partial class IntPair
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_IntPair__SWIG_0")]
+ public static extern global::System.IntPtr NewIntPair();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_IntPair__SWIG_1")]
+ public static extern global::System.IntPtr NewIntPair(int x, int y);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_IntPair_SetX")]
+ public static extern void SetX(global::System.Runtime.InteropServices.HandleRef handle, int x);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_IntPair_GetX")]
+ public static extern int GetX(global::System.Runtime.InteropServices.HandleRef handle);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_IntPair_SetY")]
+ public static extern void SetY(global::System.Runtime.InteropServices.HandleRef handle, int y);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_IntPair_GetY")]
+ public static extern int GetY(global::System.Runtime.InteropServices.HandleRef handle);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_IntPair")]
+ public static extern void DeleteIntPair(global::System.Runtime.InteropServices.HandleRef handle);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2021 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.ComponentModel;
+
+namespace Tizen.NUI
+{
+ /// <summary>
+ /// Simple class for window position pairs of integers.
+ /// Use this for integer position with window coordinates.
+ /// </summary>
+ internal class IntPair : Disposable
+ {
+ internal IntPair(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.IntPair.DeleteIntPair(swigCPtr);
+ }
+
+ /// <summary>
+ /// Default constructor for the(0, 0) tuple.
+ /// </summary>
+ public IntPair() : this(Interop.IntPair.NewIntPair(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Default constructor for the(0, 0) tuple.
+ /// </summary>
+ /// <param name="x">The X dimension of the tuple.</param>
+ /// <param name="y">The Y dimension of the tuple.</param>
+ public IntPair(int x, int y) : this(Interop.IntPair.NewIntPair(x, y), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Sets the x dimension.
+ /// </summary>
+ /// <param name="x">The x dimension to be stored in this 2-tuple.</param>
+ public void SetX(int x)
+ {
+ Interop.IntPair.SetX(SwigCPtr, x);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Get the x dimension.
+ /// </summary>
+ /// <return>
+ /// The x dimension stored in this 2-tuple.
+ /// </return>
+ public int GetX()
+ {
+ int ret = Interop.IntPair.GetX(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Sets the y dimension.
+ /// </summary>
+ /// <param name="y">The y dimension to be stored in this 2-tuple.</param>
+ public void SetY(int y)
+ {
+ Interop.IntPair.SetY(SwigCPtr, y);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Get the y dimension.
+ /// </summary>
+ /// <return>
+ /// The y dimension stored in this 2-tuple.
+ /// </return>
+ public int GetY()
+ {
+ int ret = Interop.IntPair.GetY(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+ }
+}
}
}
- public bool Emit(Window window, Rectangle positionSize)
+ public bool Emit(Window window, Position2D position)
{
- bool ret = Interop.WindowMovedSignal.Emit(SwigCPtr, Window.getCPtr(window), Rectangle.getCPtr(positionSize));
+ bool ret = Interop.WindowMovedSignal.Emit(SwigCPtr, Window.getCPtr(window), Position2D.getCPtr(position));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
{
throw new ArgumentNullException(nameof(position));
}
- var val = new Uint16Pair((uint)position.X, (uint)position.Y);
- Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
+ var val = new IntPair(position.X, position.Y);
+ Interop.Window.SetPosition(SwigCPtr, IntPair.getCPtr(val));
val.Dispose();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
// Setting Position of the window should request a relayout of the tree.
internal Position2D GetPosition()
{
- var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
- Position2D ret = new Position2D(val.GetX(), val.GetY());
+ var val = new IntPair(Interop.Window.GetPosition(SwigCPtr), true);
+ Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
val.Dispose();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
public class BorderWindowTest : IExample
{
string tag = "NUITEST";
+ private const string KEY_BACK = "XF86Back";
+ private const string KEY_ESCAPE = "Escape";
+ private const string KEY_NUM_1 = "1";
+ private const string KEY_NUM_2 = "2";
+ private const string KEY_NUM_3 = "3";
+ private const string KEY_NUM_4 = "4";
+ private const string KEY_NUM_5 = "5";
+ private const string KEY_PARENT_ABOVE = "6";
+ private const string KEY_PARENT_BELOW = "7";
+
private Window win;
private Window subWindowOne = null;
private Window subWindowTwo = null;
}
+ private void OnKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down)
+ {
+ log.Debug(tag, $"key down! key={e.Key.KeyPressedName}");
+
+ switch (e.Key.KeyPressedName)
+ {
+ case KEY_BACK:
+ case KEY_ESCAPE:
+ break;
+
+ case KEY_NUM_1:
+ subWindowOne.WindowPosition = new Position2D(10, 20);
+ break;
+
+ case KEY_NUM_2:
+ subWindowOne.WindowPosition = new Position2D(-10, 20);
+ break;
+
+ case KEY_NUM_3:
+
+ break;
+
+ case KEY_NUM_4:
+ break;
+
+ case KEY_NUM_5:
+ break;
+
+ case KEY_PARENT_ABOVE:
+ break;
+
+ case KEY_PARENT_BELOW:
+ break;
+
+ default:
+ log.Debug(tag, $"no test!");
+ break;
+ }
+ }
+ }
+
private void OnWindowMoved(object sender, WindowMovedEventArgs e)
{
Position2D position = e.WindowPosition;
animation.Looping = true;
animation.Play();
+ subWindowOne.KeyEvent += OnKeyEvent;
subWindowOne.Moved += OnWindowMoved;
}
else