X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FWindow%2FWindowEvent.cs;h=4fe11003e2f0746e764643693e6f3114bd8c0e5f;hb=c6837f8be8bdad8992b991eac276dd897a9ef404;hp=6bb01cc8a51d37e332ab8555db185e4fd906297f;hpb=a5611da5a0fcafd18ab6ae7bfcfe9465f0489f9f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.NUI/src/public/Window/WindowEvent.cs b/src/Tizen.NUI/src/public/Window/WindowEvent.cs
index 6bb01cc..4fe1100 100755
--- a/src/Tizen.NUI/src/public/Window/WindowEvent.cs
+++ b/src/Tizen.NUI/src/public/Window/WindowEvent.cs
@@ -1,5 +1,5 @@
/*
- * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2023 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.
@@ -32,8 +32,11 @@ namespace Tizen.NUI
{
private WindowFocusChangedEventCallbackType windowFocusChangedEventCallback;
private RootLayerTouchDataCallbackType rootLayerTouchDataCallback;
+ private RootLayerTouchDataCallbackType rootLayerInterceptTouchDataCallback;
private WheelEventCallbackType wheelEventCallback;
+ private WheelEventCallbackType interceptWheelCallback;
private EventCallbackDelegateType1 stageKeyCallbackDelegate;
+ private InterceptKeyEventDelegateType stageInterceptKeyCallbackDelegate;
private EventCallbackDelegateType0 stageEventProcessingFinishedEventCallbackDelegate;
private EventHandler stageContextLostEventHandler;
private EventCallbackDelegateType0 stageContextLostEventCallbackDelegate;
@@ -44,24 +47,14 @@ namespace Tizen.NUI
private WindowResizeEventCallbackType windowResizeEventCallback;
private WindowFocusChangedEventCallbackType windowFocusChangedEventCallback2;
private TransitionEffectEventCallbackType transitionEffectEventCallback;
- private WindowTransitionEffectSignal transitionEffectSignal;
+ private MovedEventCallbackType movedEventCallback;
+ private OrientationChangedEventCallbackType orientationChangedEventCallback;
private KeyboardRepeatSettingsChangedEventCallbackType keyboardRepeatSettingsChangedEventCallback;
- private KeyboardRepeatSettingsChangedSignal keyboardRepeatSettingsChangedSignal;
- private WindowFocusSignalType windowFocusChangedSignal;
- private WindowFocusSignalType windowFocusChangedSignal2;
- private TouchDataSignal touchDataSignal;
- private TouchSignal touchSignal;
- private WheelSignal wheelSignal;
- private StageWheelSignal stageWheelSignal;
- private KeyEventSignal keyEventSignal;
- private VoidSignal sceneCreatedSignal;
- private ResizeSignal resizeSignal;
- private VoidSignal eventProcessingFinishedSignal;
- private VoidSignal contextLostSignal;
- private VoidSignal contextRegainedSignal;
private AuxiliaryMessageEventCallbackType auxiliaryMessageEventCallback;
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private WindowMouseInOutEventCallbackType windowMouseInOutEventCallback;
+ private MoveCompletedEventCallbackType moveCompletedEventCallback;
+ private ResizeCompletedEventCallbackType resizeCompletedEventCallback;
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void WindowFocusChangedEventCallbackType(IntPtr window, bool focusGained);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
@@ -74,9 +67,22 @@ namespace Tizen.NUI
[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 OrientationChangedEventCallbackType(IntPtr window, int orientation);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void KeyboardRepeatSettingsChangedEventCallbackType();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void AuxiliaryMessageEventCallbackType(IntPtr kData, IntPtr vData, IntPtr optionsArray);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool InterceptKeyEventDelegateType(IntPtr arg1);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate void WindowMouseInOutEventCallbackType(IntPtr window, IntPtr mouseEvent);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void MoveCompletedEventCallbackType(IntPtr window, IntPtr position);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ResizeCompletedEventCallbackType(IntPtr window, IntPtr size);
+
///
/// FocusChanged event.
@@ -89,19 +95,19 @@ namespace Tizen.NUI
if (windowFocusChangedEventHandler == null)
{
windowFocusChangedEventCallback = OnWindowFocusedChanged;
- windowFocusChangedSignal = WindowFocusChangedSignal();
- windowFocusChangedSignal?.Connect(windowFocusChangedEventCallback);
+ using WindowFocusSignalType signal = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(SwigCPtr), false);
+ signal.Ensure()?.Connect(windowFocusChangedEventCallback);
}
-
windowFocusChangedEventHandler += value;
}
remove
{
windowFocusChangedEventHandler -= value;
-
- if (windowFocusChangedEventHandler == null && windowFocusChangedSignal?.Empty() == false && windowFocusChangedEventCallback != null)
+ if (windowFocusChangedEventHandler == null && windowFocusChangedEventCallback != null)
{
- windowFocusChangedSignal?.Disconnect(windowFocusChangedEventCallback);
+ using WindowFocusSignalType signal = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(SwigCPtr), false);
+ signal.Ensure()?.Disconnect(windowFocusChangedEventCallback);
+ windowFocusChangedEventCallback = null;
}
}
}
@@ -120,18 +126,50 @@ namespace Tizen.NUI
if (rootLayerTouchDataEventHandler == null)
{
rootLayerTouchDataCallback = OnWindowTouch;
- touchDataSignal = this.TouchDataSignal();
- touchDataSignal?.Connect(rootLayerTouchDataCallback);
+ Interop.ActorSignal.TouchConnect(Layer.getCPtr(GetRootLayer()), rootLayerTouchDataCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
rootLayerTouchDataEventHandler += value;
}
remove
{
rootLayerTouchDataEventHandler -= value;
- touchSignal = TouchSignal();
- if (rootLayerTouchDataEventHandler == null && touchSignal?.Empty() == false && rootLayerTouchDataCallback != null)
+ if (rootLayerTouchDataEventHandler == null && rootLayerTouchDataCallback != null)
{
- touchDataSignal?.Disconnect(rootLayerTouchDataCallback);
+ Interop.ActorSignal.TouchDisconnect(Layer.getCPtr(GetRootLayer()), rootLayerTouchDataCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ rootLayerTouchDataCallback = null;
+ }
+ }
+ }
+
+ ///
+ /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.
+ /// The touched signal is emitted when the touch input is received.
+ /// This can receive touch events before child.
+ /// If it returns false, the child can receive the touch event. If it returns true, the touch event is intercepted. So child cannot receive touch event.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event ReturnTypeEventHandler
/// 4
- [Obsolete("Deprecated in API9, will be removed in API11. Please use Window.NativeHandle instead!")]
+ [Obsolete("This has been deprecated in API9 and will be removed in API11. Use Window.NativeHandle instead.")]
public class SafeNativeWindowHandle : SafeHandle
{
///
@@ -1062,23 +1461,19 @@ namespace Tizen.NUI
if (VisibilityChangedEventHandler == null)
{
VisibilityChangedEventCallback = OnVisibilityChanged;
- VisibilityChangedEventSignal = new WindowVisibilityChangedEvent(this);
- VisibilityChangedEventSignal.Connect(VisibilityChangedEventCallback);
+ using WindowVisibilityChangedEvent signal = new WindowVisibilityChangedEvent(Interop.WindowVisibilityChangedSignal.GetSignal(Window.getCPtr(this)), false);
+ signal.Ensure()?.Connect(VisibilityChangedEventCallback);
}
VisibilityChangedEventHandler += value;
}
remove
{
VisibilityChangedEventHandler -= value;
- if (VisibilityChangedEventHandler == null)
+ if (VisibilityChangedEventHandler == null && VisibilityChangedEventCallback != null)
{
- if (VisibilityChangedEventSignal != null)
- {
- if (VisibilityChangedEventSignal.Empty() == false)
- {
- VisibilityChangedEventSignal.Disconnect(VisibilityChangedEventCallback);
- }
- }
+ using WindowVisibilityChangedEvent signal = new WindowVisibilityChangedEvent(Interop.WindowVisibilityChangedSignal.GetSignal(Window.getCPtr(this)), false);
+ signal.Ensure()?.Disconnect(VisibilityChangedEventCallback);
+ VisibilityChangedEventCallback = null;
}
}
}
@@ -1098,7 +1493,7 @@ namespace Tizen.NUI
private void OnAuxiliaryMessage(IntPtr kData, IntPtr vData, IntPtr optionsArray)
{
- if(kData == IntPtr.Zero || vData == IntPtr.Zero)
+ if (kData == IntPtr.Zero || vData == IntPtr.Zero)
{
return;
}
@@ -1119,7 +1514,7 @@ namespace Tizen.NUI
AuxiliaryMessageEventArgs e = new AuxiliaryMessageEventArgs();
e.Key = StringToVoidSignal.GetResult(kData);
- e.Value = StringToVoidSignal.GetResult(vData);;
+ e.Value = StringToVoidSignal.GetResult(vData); ;
e.Options = tmpList;
auxiliaryMessageEventHandler?.Invoke(this, e);
@@ -1139,30 +1534,174 @@ namespace Tizen.NUI
if (auxiliaryMessageEventHandler == null)
{
auxiliaryMessageEventCallback = OnAuxiliaryMessage;
- using var signal = new WindowAuxiliaryMessageSignal(this);
- signal.Connect(auxiliaryMessageEventCallback);
+ using WindowAuxiliaryMessageSignal signal = new WindowAuxiliaryMessageSignal(Interop.WindowAuxiliaryMessageSignalType.Get(SwigCPtr), false);
+ signal.Ensure()?.Connect(auxiliaryMessageEventCallback);
}
auxiliaryMessageEventHandler += value;
}
remove
{
auxiliaryMessageEventHandler -= value;
- if (auxiliaryMessageEventHandler == null)
+ if (auxiliaryMessageEventHandler == null && auxiliaryMessageEventCallback != null)
+ {
+ using WindowAuxiliaryMessageSignal signal = new WindowAuxiliaryMessageSignal(Interop.WindowAuxiliaryMessageSignalType.Get(SwigCPtr), false);
+ signal.Ensure()?.Disconnect(auxiliaryMessageEventCallback);
+ auxiliaryMessageEventCallback = null;
+ }
+ }
+ }
+
+ ///
+ /// AccessibilityHighlightArgs
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class AccessibilityHighlightEventArgs : EventArgs
+ {
+ private bool accessibilityHighlight;
+ ///
+ /// accessibilityHighlight
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AccessibilityHighlight
+ {
+ get => accessibilityHighlight;
+ set
{
- if (auxiliaryMessageEventCallback != null)
- {
- using var signal = new WindowAuxiliaryMessageSignal(this);
- signal.Disconnect(auxiliaryMessageEventCallback);
+ accessibilityHighlight = value;
+ }
+ }
+ }
+
+ private void OnAccessibilityHighlight(IntPtr window, bool highlight)
+ {
+ if (window == global::System.IntPtr.Zero)
+ {
+ NUILog.Error("[ERR] OnAccessibilityHighlight() window is null");
+ return;
+ }
- if (signal.Empty())
- {
- auxiliaryMessageEventCallback = null;
- }
- }
+ AccessibilityHighlightEventArgs e = new AccessibilityHighlightEventArgs();
+ e.AccessibilityHighlight = highlight;
+ if (AccessibilityHighlightEventHandler != null)
+ {
+ AccessibilityHighlightEventHandler.Invoke(this, e);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AccessibilityHighlightEventCallbackType(IntPtr window, bool highlight);
+ private AccessibilityHighlightEventCallbackType AccessibilityHighlightEventCallback;
+ private event EventHandler AccessibilityHighlightEventHandler;
+
+ ///
+ /// Emits the event when the window needs to grab or clear highlight.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler AccessibilityHighlight
+ {
+ add
+ {
+ if (AccessibilityHighlightEventHandler == null)
+ {
+ AccessibilityHighlightEventCallback = OnAccessibilityHighlight;
+ using WindowAccessibilityHighlightEvent signal = new WindowAccessibilityHighlightEvent(Interop.WindowAccessibilityHighlightSignal.GetSignal(SwigCPtr), false);
+ signal.Ensure()?.Connect(AccessibilityHighlightEventCallback);
+ }
+ AccessibilityHighlightEventHandler += value;
+ }
+ remove
+ {
+ AccessibilityHighlightEventHandler -= value;
+ if (AccessibilityHighlightEventHandler == null && AccessibilityHighlightEventCallback != null)
+ {
+ using WindowAccessibilityHighlightEvent signal = new WindowAccessibilityHighlightEvent(Interop.WindowAccessibilityHighlightSignal.GetSignal(SwigCPtr), false);
+ signal.Ensure()?.Disconnect(AccessibilityHighlightEventCallback);
+ AccessibilityHighlightEventCallback = null;
}
}
}
+ }
+
+ ///
+ /// Move event is sent when window is resized by user or the display server.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WindowMovedEventArgs : EventArgs
+ {
+ private Position2D position;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position2D WindowPosition
+ {
+ get
+ {
+ return position;
+ }
+ set
+ {
+ position = value;
+ }
+ }
+ }
+
+ ///
+ /// OrientationChangedArgs
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WindowOrientationChangedEventArgs : EventArgs
+ {
+ private Window.WindowOrientation orientation;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Window.WindowOrientation WindowOrientation
+ {
+ get
+ {
+ return orientation;
+ }
+ set
+ {
+ orientation = value;
+ }
+ }
+ }
+
+ ///
+ /// Move Completed event is sent when window has been moved the display server.
+ /// It is triggered by calling RequestMoveToServer().
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WindowMoveCompletedEventArgs : EventArgs
+ {
+ public WindowMoveCompletedEventArgs(Position2D completedPosition)
+ {
+ WindowCompletedPosition = completedPosition;
+ }
+ public Position2D WindowCompletedPosition
+ {
+ get;
+ private set;
+ }
+ }
+ ///
+ /// Resize Completed event is sent when window has been resized the display server.
+ /// It is triggered by calling RequestResizeToServer().
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WindowResizeCompletedEventArgs : EventArgs
+ {
+ public WindowResizeCompletedEventArgs(Size2D completedSize)
+ {
+ WindowCompletedSize = completedSize;
+ }
+
+ public Size2D WindowCompletedSize
+ {
+ get;
+ private set;
+ }
}
+
}