{
private WindowFocusChangedEventCallbackType windowFocusChangedEventCallback;
private RootLayerTouchDataCallbackType rootLayerTouchDataCallback;
+ private RootLayerTouchDataCallbackType rootLayerInterceptTouchDataCallback;
private WheelEventCallbackType wheelEventCallback;
private EventCallbackDelegateType1 stageKeyCallbackDelegate;
private InterceptKeyEventDelegateType stageInterceptKeyCallbackDelegate;
}
/// <summary>
+ /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The touched signal is emitted when the touch input is received.<br />
+ /// This can receive touch events before child. <br />
+ /// 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.<br />
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event ReturnTypeEventHandler<object, TouchEventArgs, bool> InterceptTouchEvent
+ {
+ add
+ {
+ if (rootLayerInterceptTouchDataEventHandler == null)
+ {
+ rootLayerInterceptTouchDataCallback = OnWindowInterceptTouch;
+ using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(Layer.getCPtr(GetRootLayer())), false);
+ signal?.Connect(rootLayerInterceptTouchDataCallback);
+ }
+ rootLayerInterceptTouchDataEventHandler += value;
+ }
+ remove
+ {
+ rootLayerInterceptTouchDataEventHandler -= value;
+ if (rootLayerInterceptTouchDataEventHandler == null && rootLayerInterceptTouchDataCallback != null)
+ {
+ using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(Layer.getCPtr(GetRootLayer())), false);
+ signal?.Disconnect(rootLayerInterceptTouchDataCallback);
+ if (signal?.Empty() == true)
+ {
+ rootLayerInterceptTouchDataCallback = null;
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// Emits the event when the wheel event is received.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public event EventHandler ViewAdded;
private event EventHandler<FocusChangedEventArgs> windowFocusChangedEventHandler;
private event EventHandler<TouchEventArgs> rootLayerTouchDataEventHandler;
+ private ReturnTypeEventHandler<object, TouchEventArgs, bool> rootLayerInterceptTouchDataEventHandler;
private event EventHandler<WheelEventArgs> stageWheelHandler;
private event EventHandler<KeyEventArgs> stageKeyHandler;
private ReturnTypeEventHandler<object, KeyEventArgs, bool> stageInterceptKeyHandler;
signal?.Disconnect(rootLayerTouchDataCallback);
rootLayerTouchDataCallback = null;
}
+
+ if (rootLayerInterceptTouchDataCallback != null)
+ {
+ using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(Layer.getCPtr(GetRootLayer())), false);
+ signal?.Disconnect(rootLayerInterceptTouchDataCallback);
+ rootLayerInterceptTouchDataCallback = null;
+ }
+
if (wheelEventCallback != null)
{
using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
return false;
}
+ private bool OnWindowInterceptTouch(IntPtr view, IntPtr touchData)
+ {
+ if (touchData == global::System.IntPtr.Zero)
+ {
+ NUILog.Error("touchData should not be null!");
+ return true;
+ }
+
+ bool consumed = false;
+ if (rootLayerInterceptTouchDataEventHandler != null)
+ {
+ TouchEventArgs e = new TouchEventArgs();
+ e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
+ consumed = rootLayerInterceptTouchDataEventHandler(this, e);
+ }
+ return consumed;
+ }
+
private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
{
if (wheelEvent == global::System.IntPtr.Zero)