Append window move event.
This event occurs when window's position is changed.
--- /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 WindowMovedSignal
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_Moved_Signal")]
+ public static extern global::System.IntPtr GetSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Moved_Signal_Empty")]
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+ public static extern bool Empty(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Moved_Signal_GetConnectionCount")]
+ public static extern uint GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Moved_Signal_Connect")]
+ public static extern void Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Moved_Signal_Disconnect")]
+ public static extern void Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Moved_Signal_Emit")]
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+ public static extern bool Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Moved_Signal")]
+ public static extern global::System.IntPtr NewSignal();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_Moved_Signal")]
+ public static extern void DeleteSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+ }
+ }
+}
--- /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 class WindowMovedSignal : Disposable
+ {
+ internal WindowMovedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.WindowMovedSignal.DeleteSignal(swigCPtr);
+ }
+
+ public bool Empty()
+ {
+ bool ret = Interop.WindowMovedSignal.Empty(SwigCPtr);
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public uint GetConnectionCount()
+ {
+ uint ret = Interop.WindowMovedSignal.GetConnectionCount(SwigCPtr);
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public void Connect(System.Delegate func)
+ {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
+ {
+ Interop.WindowMovedSignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ public void Disconnect(System.Delegate func)
+ {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
+ {
+ Interop.WindowMovedSignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ public bool Emit(Window window, Rectangle positionSize)
+ {
+ bool ret = Interop.WindowMovedSignal.Emit(SwigCPtr, Window.getCPtr(window), Rectangle.getCPtr(positionSize));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public WindowMovedSignal(Window window) : this(Interop.WindowMovedSignal.GetSignal(Window.getCPtr(window)), false)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+}
private WindowFocusChangedEventCallbackType windowFocusChangedEventCallback2;
private TransitionEffectEventCallbackType transitionEffectEventCallback;
private WindowTransitionEffectSignal transitionEffectSignal;
+ private MovedEventCallbackType movedEventCallback;
+ private WindowMovedSignal movedSignal;
private KeyboardRepeatSettingsChangedEventCallbackType keyboardRepeatSettingsChangedEventCallback;
private KeyboardRepeatSettingsChangedSignal keyboardRepeatSettingsChangedSignal;
private WindowFocusSignalType windowFocusChangedSignal;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void TransitionEffectEventCallbackType(IntPtr window, int state, int type);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void MovedEventCallbackType(IntPtr window, IntPtr position);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void KeyboardRepeatSettingsChangedEventCallbackType();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void AuxiliaryMessageEventCallbackType(IntPtr kData, IntPtr vData, IntPtr optionsArray);
}
/// <summary>
+ /// MovedEvent
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<WindowMovedEventArgs> Moved
+ {
+ add
+ {
+ if (movedHandler == null)
+ {
+ movedEventCallback = OnMoved;
+ MovedEventSignal().Connect(movedEventCallback);
+ }
+ movedHandler += value;
+ }
+ remove
+ {
+ movedHandler -= value;
+ if (movedHandler == null && MovedEventSignal().Empty() == false)
+ {
+ MovedEventSignal().Disconnect(movedEventCallback);
+ if (MovedEventSignal().Empty() == true)
+ {
+ movedEventCallback = null;
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// Keyboard Repeat Settings Changed
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private event EventHandler<ResizedEventArgs> windowResizeEventHandler;
private event EventHandler<FocusChangedEventArgs> windowFocusChangedEventHandler2;
private event EventHandler<TransitionEffectEventArgs> transitionEffectHandler;
+ private event EventHandler<WindowMovedEventArgs> movedHandler;
private event EventHandler keyboardRepeatSettingsChangedHandler;
private event EventHandler<AuxiliaryMessageEventArgs> auxiliaryMessageEventHandler;
transitionEffectEventCallback = null;
}
+ if (movedSignal != null)
+ {
+ MovedEventSignal().Disconnect(movedEventCallback);
+ movedEventCallback = null;
+ }
+
if (keyboardRepeatSettingsChangedSignal != null)
{
KeyboardRepeatSettingsChangedEventSignal().Disconnect(keyboardRepeatSettingsChangedEventCallback);
return transitionEffectSignal;
}
+ private WindowMovedSignal MovedEventSignal()
+ {
+ if (movedSignal == null)
+ {
+ movedSignal = new WindowMovedSignal(this);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ return movedSignal;
+ }
+
private KeyboardRepeatSettingsChangedSignal KeyboardRepeatSettingsChangedEventSignal()
{
if (keyboardRepeatSettingsChangedSignal == null)
return;
}
+ private void OnMoved(IntPtr window, IntPtr position)
+ {
+ if (window == global::System.IntPtr.Zero)
+ {
+ return;
+ }
+
+ if (movedHandler != null)
+ {
+ WindowMovedEventArgs e = new WindowMovedEventArgs();
+ e.WindowPosition = this.WindowPosition;
+ movedHandler(this, e);
+ }
+ return;
+ }
+
private void OnKeyboardRepeatSettingsChanged()
{
keyboardRepeatSettingsChangedHandler?.Invoke(this, null);
}
}
}
+
+ /// <summary>
+ /// MovedArgs
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WindowMovedEventArgs : EventArgs
+ {
+ private Position2D position;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position2D WindowPosition
+ {
+ get
+ {
+ return position;
+ }
+ set
+ {
+ position = value;
+ }
+ }
+ }
}
namespace Tizen.NUI.Samples
{
+ using log = Tizen.Log;
public class BorderWindowTest : IExample
{
+ string tag = "NUITEST";
private Window win;
private Window subWindowOne = null;
private Window subWindowTwo = null;
}
+
+ private void OnWindowMoved(object sender, WindowMovedEventArgs e)
+ {
+ Position2D position = e.WindowPosition;
+ log.Fatal(tag, $"OnWindowMoved() called!, x:{position.X}, y:{position.Y}");
+ }
+
void CreateSubWindowOne()
{
if (subWindowOne == null)
animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
animation.Looping = true;
animation.Play();
+
+ subWindowOne.Moved += OnWindowMoved;
}
else
{
}
}
+ private void OnWindowMoved2(object sender, WindowMovedEventArgs e)
+ {
+ Position2D position = e.WindowPosition;
+ log.Fatal(tag, $"OnWindowMoved2() called!, x:{position.X}, y:{position.Y}");
+ }
+
void CreateSubWindowTwo()
{
if (subWindowTwo == null)
};
root.Add(image);
subWindowTwo.Add(root);
+
+ subWindowTwo.Moved += OnWindowMoved2;
}
else
{