{
private EventHandler offWindowEventHandler;
private OffWindowEventCallbackType offWindowEventCallback;
+ private EventHandlerWithReturnType<object, WheelEventArgs, bool> interceptWheelHandler;
+ private WheelEventCallbackType interceptWheelCallback;
private EventHandlerWithReturnType<object, WheelEventArgs, bool> wheelEventHandler;
private WheelEventCallbackType wheelEventCallback;
private EventHandlerWithReturnType<object, KeyEventArgs, bool> keyEventHandler;
private EventHandler<VisibilityChangedEventArgs> visibilityChangedEventHandler;
private VisibilityChangedEventCallbackType visibilityChangedEventCallback;
private EventHandler keyInputFocusGainedEventHandler;
+
private KeyInputFocusGainedCallbackType keyInputFocusGainedCallback;
private EventHandler keyInputFocusLostEventHandler;
+
private KeyInputFocusLostCallbackType keyInputFocusLostCallback;
private EventHandler onRelayoutEventHandler;
private OnRelayoutEventCallbackType onRelayoutEventCallback;
private LayoutDirectionChangedEventCallbackType layoutDirectionChangedEventCallback;
// Resource Ready Signal
private EventHandler resourcesLoadedEventHandler;
- private ResourcesLoadedCallbackType ResourcesLoadedCallback;
+ private ResourcesLoadedCallbackType resourcesLoadedCallback;
private EventHandler<BackgroundResourceLoadedEventArgs> backgroundResourceLoadedEventHandler;
private _backgroundResourceLoadedCallbackType backgroundResourceLoadedCallback;
- private OnWindowEventCallbackType onWindowSendEventCallback;
- private void SendViewAddedEventToWindow(IntPtr data)
- {
- // Unused parameter
- _ = data;
- NUIApplication.GetDefaultWindow()?.SendViewAdded(this);
- }
+ private TouchDataCallbackType hitTestResultDataCallback;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void OffWindowEventCallbackType(IntPtr control);
private delegate void ResourcesLoadedCallbackType(IntPtr control);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void _backgroundResourceLoadedCallbackType(IntPtr view);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void KeyInputFocusGainedCallbackType(IntPtr control);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void KeyInputFocusLostCallbackType(IntPtr control);
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void OnRelayoutEventCallbackType(IntPtr control);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
if (keyInputFocusGainedEventHandler == null)
{
keyInputFocusGainedCallback = OnKeyInputFocusGained;
- using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
- signal?.Connect(keyInputFocusGainedCallback);
+ Interop.ViewSignal.KeyInputFocusGainedConnect(SwigCPtr, keyInputFocusGainedCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
keyInputFocusGainedEventHandler += value;
}
remove
{
keyInputFocusGainedEventHandler -= value;
- if (keyInputFocusGainedEventHandler == null)
+ if (keyInputFocusGainedEventHandler == null && keyInputFocusGainedCallback != null)
{
- using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(keyInputFocusGainedCallback);
- keyInputFocusGainedCallback = null;
- }
+ Interop.ViewSignal.KeyInputFocusGainedDisconnect(SwigCPtr, keyInputFocusGainedCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ keyInputFocusGainedCallback = null;
}
}
}
if (keyInputFocusLostEventHandler == null)
{
keyInputFocusLostCallback = OnKeyInputFocusLost;
- using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
- signal?.Connect(keyInputFocusLostCallback);
+ Interop.ViewSignal.KeyInputFocusLostConnect(SwigCPtr, keyInputFocusLostCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
keyInputFocusLostEventHandler += value;
}
remove
{
keyInputFocusLostEventHandler -= value;
- if (keyInputFocusLostEventHandler == null)
+ if (keyInputFocusLostEventHandler == null && keyInputFocusLostCallback != null)
{
- using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(keyInputFocusLostCallback);
- keyInputFocusLostCallback = null;
- }
+ Interop.ViewSignal.KeyInputFocusLostDisconnect(SwigCPtr, keyInputFocusLostCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ keyInputFocusLostCallback = null;
}
}
}
if (keyEventHandler == null)
{
keyCallback = OnKeyEvent;
- using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
- signal?.Connect(keyCallback);
+ Interop.ViewSignal.KeyEventConnect(SwigCPtr, keyCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
keyEventHandler += value;
}
remove
{
keyEventHandler -= value;
- if (keyEventHandler == null)
+ if (keyEventHandler == null && keyCallback != null)
{
- using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(keyCallback);
- keyCallback = null;
- }
+ Interop.ViewSignal.KeyEventDisconnect(SwigCPtr, keyCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ keyCallback = null;
}
}
}
if (onRelayoutEventHandler == null)
{
onRelayoutEventCallback = OnRelayout;
- using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
- signal?.Connect(onRelayoutEventCallback);
+ Interop.ActorSignal.OnRelayoutConnect(SwigCPtr, onRelayoutEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
onRelayoutEventHandler += value;
}
remove
{
onRelayoutEventHandler -= value;
- if (onRelayoutEventHandler == null)
+ if (onRelayoutEventHandler == null && onRelayoutEventCallback != null)
{
- using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(onRelayoutEventCallback);
- onRelayoutEventCallback = null;
- }
+ Interop.ActorSignal.OnRelayoutDisconnect(SwigCPtr, onRelayoutEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ onRelayoutEventCallback = null;
}
}
}
if (interceptTouchDataEventHandler == null)
{
interceptTouchDataCallback = OnInterceptTouch;
- using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
- signal?.Connect(interceptTouchDataCallback);
+ Interop.ActorSignal.InterceptTouchConnect(SwigCPtr, interceptTouchDataCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
interceptTouchDataEventHandler += value;
}
remove
{
interceptTouchDataEventHandler -= value;
- if (interceptTouchDataEventHandler == null)
+ if (interceptTouchDataEventHandler == null && interceptTouchDataCallback != null)
{
- using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(interceptTouchDataCallback);
- interceptTouchDataCallback = null;
- }
+ Interop.ActorSignal.InterceptTouchDisconnect(SwigCPtr, interceptTouchDataCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ interceptTouchDataCallback = null;
}
}
}
if (touchDataEventHandler == null)
{
touchDataCallback = OnTouch;
- using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
- signal.Connect(touchDataCallback);
+ Interop.ActorSignal.TouchConnect(SwigCPtr, touchDataCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
touchDataEventHandler += value;
}
remove
{
touchDataEventHandler -= value;
- if (touchDataEventHandler == null)
+ if (touchDataEventHandler == null && touchDataCallback != null)
{
- using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
- if (signal.Empty() == false)
- {
- signal.Disconnect(touchDataCallback);
- touchDataCallback = null;
- }
+ Interop.ActorSignal.TouchDisconnect(SwigCPtr, touchDataCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ touchDataCallback = null;
}
}
}
if (hoverEventHandler == null)
{
hoverEventCallback = OnHoverEvent;
- using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
- signal?.Connect(hoverEventCallback);
+ Interop.ActorSignal.HoveredConnect(SwigCPtr, hoverEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
hoverEventHandler += value;
}
remove
{
hoverEventHandler -= value;
- if (hoverEventHandler == null)
+ if (hoverEventHandler == null && hoverEventCallback != null)
{
- using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(hoverEventCallback);
- hoverEventCallback = null;
- }
+ Interop.ActorSignal.HoveredDisconnect(SwigCPtr, hoverEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ hoverEventCallback = null;
}
}
}
/// <summary>
+ /// An event for the wheel which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The wheel event is emitted when the wheel input is received.<br />
+ /// This can receive wheel events before child. <br />
+ /// If it returns false, the child can receive the wheel event. If it returns true, the wheel event is intercepted. So child cannot receive wheel event.<br />
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, WheelEventArgs, bool> InterceptWheelEvent
+ {
+ add
+ {
+ if (interceptWheelHandler == null)
+ {
+ interceptWheelCallback = OnInterceptWheel;
+ Interop.ActorSignal.InterceptWheelConnect(SwigCPtr, interceptWheelCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ }
+ interceptWheelHandler += value;
+ }
+
+ remove
+ {
+ interceptWheelHandler -= value;
+ if (interceptWheelHandler == null && interceptWheelCallback != null)
+ {
+ Interop.ActorSignal.InterceptWheelDisconnect(SwigCPtr, interceptWheelCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ interceptWheelCallback = null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// If child view doesn't want the parent's view to intercept the wheel event, you can set it to true.
+ /// for example :
+ /// parent.Add(child);
+ /// parent.InterceptWheelEvent += OnInterceptWheelEvent;
+ /// View view = child.GetParent() as View;
+ /// view.DisallowInterceptWheelEvent = true;
+ /// This prevents the parent from intercepting wheel event.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool DisallowInterceptWheelEvent { get; set; }
+
+ /// <summary>
/// An event for the WheelMoved signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
/// The WheelMoved signal is emitted when the wheel event is received.<br />
/// </summary>
if (wheelEventHandler == null)
{
wheelEventCallback = OnWheelEvent;
- using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
- signal?.Connect(wheelEventCallback);
+ Interop.ActorSignal.WheelEventConnect(SwigCPtr, wheelEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
wheelEventHandler += value;
-
- if (WindowWheelEventHandler == null)
- {
- NUIApplication.GetDefaultWindow().WheelEvent += OnWindowWheelEvent;
- }
- WindowWheelEventHandler += value;
}
remove
{
wheelEventHandler -= value;
- if (wheelEventHandler == null)
- {
- using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(wheelEventCallback);
- wheelEventCallback = null;
- }
- }
-
- WindowWheelEventHandler -= value;
- if (WindowWheelEventHandler == null)
+ if (wheelEventHandler == null && wheelEventCallback != null)
{
- NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent;
+ Interop.ActorSignal.WheelEventDisconnect(SwigCPtr, wheelEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ wheelEventCallback = null;
}
}
}
if (onWindowEventHandler == null)
{
onWindowEventCallback = OnWindow;
- using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
- signal?.Connect(onWindowEventCallback);
+ Interop.ActorSignal.OnSceneConnect(SwigCPtr, onWindowEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
onWindowEventHandler += value;
}
remove
{
onWindowEventHandler -= value;
- if (onWindowEventHandler == null)
+ if (onWindowEventHandler == null && onWindowEventCallback != null)
{
- using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(onWindowEventCallback);
- onWindowEventCallback = null;
- }
+ Interop.ActorSignal.OnSceneDisconnect(SwigCPtr, onWindowEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ onWindowEventCallback = null;
}
}
}
if (offWindowEventHandler == null)
{
offWindowEventCallback = OffWindow;
- using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
- signal?.Connect(offWindowEventCallback);
+ Interop.ActorSignal.OffSceneConnect(SwigCPtr, offWindowEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
offWindowEventHandler += value;
}
remove
{
offWindowEventHandler -= value;
- if (offWindowEventHandler == null)
+ if (offWindowEventHandler == null && offWindowEventCallback != null)
{
- using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(offWindowEventCallback);
- offWindowEventCallback = null;
- }
+ Interop.ActorSignal.OffSceneDisconnect(SwigCPtr, offWindowEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ offWindowEventCallback = null;
}
}
}
-
/// <summary>
/// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
- /// This signal is emitted when the visible property of this or a parent view is changed.<br />
+ /// This event is sent when the visibility of this or a parent view is changed.<br />
/// </summary>
+ /// <remarks>
+ /// <para>
+ /// When VisibilityChangedEventArgs.Type is SELF, VisibilityChangedEventArgs.Visibility is true means this View's Visibility property is true.
+ /// When VisibilityChangedEventArgs.Type is PARENT, VisibilityChangedEventArgs.Visibility is true means a parent's Visibility property has changed to true.
+ /// </para>
+ /// <para>
+ /// This event is NOT sent if the view becomes transparent (or the reverse), it's ONLY linked with View.Show() and View.Hide().
+ /// For reference, a view is only shown if the view and its parents (up to the root view) are also visible, they are not transparent, and the view has a non-zero size.
+ /// So if its parent is not visible, the view is not shown even though VisibilityChangedEventArgs.Type is SELF and VisibilityChangedEventArgs.Visibility is true.
+ /// </para>
+ /// </remarks>
/// <since_tizen> 3 </since_tizen>
public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
{
if (visibilityChangedEventHandler == null)
{
visibilityChangedEventCallback = OnVisibilityChanged;
- VisibilityChangedSignal(this).Connect(visibilityChangedEventCallback);
+ Interop.ActorSignal.VisibilityChangedConnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
-
visibilityChangedEventHandler += value;
}
remove
{
visibilityChangedEventHandler -= value;
-
- if (visibilityChangedEventHandler == null && VisibilityChangedSignal(this).Empty() == false)
+ if (visibilityChangedEventHandler == null && visibilityChangedEventCallback != null)
{
- VisibilityChangedSignal(this).Disconnect(visibilityChangedEventCallback);
+ Interop.ActorSignal.VisibilityChangedDisconnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ visibilityChangedEventCallback = null;
}
}
}
if (layoutDirectionChangedEventHandler == null)
{
layoutDirectionChangedEventCallback = OnLayoutDirectionChanged;
- LayoutDirectionChangedSignal(this).Connect(layoutDirectionChangedEventCallback);
+ Interop.ActorSignal.LayoutDirectionChangedConnect(SwigCPtr, layoutDirectionChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
layoutDirectionChangedEventHandler += value;
{
layoutDirectionChangedEventHandler -= value;
- if (layoutDirectionChangedEventHandler == null && LayoutDirectionChangedSignal(this).Empty() == false)
+ if (layoutDirectionChangedEventHandler == null && layoutDirectionChangedEventCallback != null)
{
- LayoutDirectionChangedSignal(this).Disconnect(layoutDirectionChangedEventCallback);
+ Interop.ActorSignal.LayoutDirectionChangedDisconnect(SwigCPtr, layoutDirectionChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ layoutDirectionChangedEventCallback = null;
}
}
}
{
if (resourcesLoadedEventHandler == null)
{
- ResourcesLoadedCallback = OnResourcesLoaded;
- using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
- signal?.Connect(ResourcesLoadedCallback);
+ resourcesLoadedCallback = OnResourcesLoaded;
+ Interop.ViewSignal.ResourceReadyConnect(SwigCPtr, resourcesLoadedCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
resourcesLoadedEventHandler += value;
}
remove
{
resourcesLoadedEventHandler -= value;
- if (resourcesLoadedEventHandler == null)
+ if (resourcesLoadedEventHandler == null && resourcesLoadedCallback != null)
{
- using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(ResourcesLoadedCallback);
- ResourcesLoadedCallback = null;
- }
+ Interop.ViewSignal.ResourceReadyDisconnect(SwigCPtr, resourcesLoadedCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ resourcesLoadedCallback = null;
}
}
}
if (backgroundResourceLoadedEventHandler == null)
{
backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
- using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
- signal?.Connect(backgroundResourceLoadedCallback);
+ Interop.ViewSignal.ResourceReadyConnect(SwigCPtr, backgroundResourceLoadedCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
backgroundResourceLoadedEventHandler += value;
}
-
+
remove
{
backgroundResourceLoadedEventHandler -= value;
- if (backgroundResourceLoadedEventHandler == null)
+ if (backgroundResourceLoadedEventHandler == null && backgroundResourceLoadedCallback != null)
{
- using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(backgroundResourceLoadedCallback);
- backgroundResourceLoadedCallback = null;
- }
+ Interop.ViewSignal.ResourceReadyDisconnect(SwigCPtr, backgroundResourceLoadedCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ backgroundResourceLoadedCallback = null;
}
}
}
- internal TouchDataSignal InterceptTouchSignal()
- {
- TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal TouchDataSignal TouchSignal()
- {
- TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal HoverSignal HoveredSignal()
- {
- HoverSignal ret = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal WheelSignal WheelEventSignal()
- {
- WheelSignal ret = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ViewSignal OnWindowSignal()
- {
- ViewSignal ret = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ViewSignal OffWindowSignal()
- {
- ViewSignal ret = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ViewSignal OnRelayoutSignal()
- {
- ViewSignal ret = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ViewVisibilityChangedSignal VisibilityChangedSignal(View view)
- {
- ViewVisibilityChangedSignal ret = new ViewVisibilityChangedSignal(Interop.NDalic.VisibilityChangedSignal(View.getCPtr(view)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ViewLayoutDirectionChangedSignal LayoutDirectionChangedSignal(View view)
- {
- ViewLayoutDirectionChangedSignal ret = new ViewLayoutDirectionChangedSignal(Interop.Layout.LayoutDirectionChangedSignal(View.getCPtr(view)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ViewSignal ResourcesLoadedSignal()
- {
- ViewSignal ret = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ControlKeySignal KeyEventSignal()
- {
- ControlKeySignal ret = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal KeyInputFocusSignal KeyInputFocusGainedSignal()
- {
- KeyInputFocusSignal ret = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal KeyInputFocusSignal KeyInputFocusLostSignal()
+ private void OnColorChanged(float r, float g, float b, float a)
{
- KeyInputFocusSignal ret = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ Color = new Color(r, g, b, a);
}
- private void OnSize2DChanged(int? width, int? height)
+ private void OnMinimumSizeChanged(int width, int height)
{
- PropertyValue temp;
- if (width != null)
- {
- temp = new Tizen.NUI.PropertyValue((float)width);
- Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeWidth, temp);
- temp.Dispose();
- }
- if (height != null)
- {
- temp = new Tizen.NUI.PropertyValue((float)height);
- Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeHeight, temp);
- temp.Dispose();
- }
+ MinimumSize = new Size2D(width, height);
}
- private void OnMinimumSizeChanged(int? width, int? height)
+ private void OnMaximumSizeChanged(int width, int height)
{
- if (width != null && height != null)
- {
- MinimumSize = new Size2D((int)width, (int)height);
- }
- else if (width != null && height == null)
- {
- MinimumSize = new Size2D((int)width, (int)this.GetMinimumSize().Height);
- }
- else if (width == null && height != null)
- {
- MinimumSize = new Size2D((int)this.GetMinimumSize().Width, (int)height);
- }
- else
- {
- //both are null, do nothing.
- }
+ MaximumSize = new Size2D(width, height);
}
- private void OnMaximumSizeChanged(int? width, int? height)
+ private void OnPosition2DChanged(int x, int y)
{
- if (width != null && height != null)
- {
- MaximumSize = new Size2D((int)width, (int)height);
- }
- else if (width != null && height == null)
- {
- MaximumSize = new Size2D((int)width, (int)this.GetMaximumSize().Height);
- }
- else if (width == null && height != null)
- {
- MaximumSize = new Size2D((int)this.GetMaximumSize().Width, (int)height);
- }
- else
- {
- //both are null, do nothing.
- }
+ SetPosition((float)x, (float)y, 0);
}
- private void OnPosition2DChanged(int x, int y)
+ private void OnPositionChanged(float x, float y, float z)
{
- Position2D = new Position2D(x, y);
+ SetPosition(x, y, z);
}
- private void OnSizeChanged(float? width, float? height, float? depth)
+ private void OnSize2DChanged(int width, int height)
{
- PropertyValue temp;
- if (width != null)
- {
- temp = new Tizen.NUI.PropertyValue((float)width);
- Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeWidth, temp);
- temp.Dispose();
- }
- if (height != null)
- {
- temp = new Tizen.NUI.PropertyValue((float)height);
- Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeHeight, temp);
- temp.Dispose();
- }
- if (depth != null)
- {
- temp = new Tizen.NUI.PropertyValue((float)depth);
- Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeDepth, temp);
- temp.Dispose();
- }
+ SetSize((float)width, (float)height, 0);
}
- private void OnPositionChanged(float x, float y, float z)
+ private void OnSizeChanged(float width, float height, float depth)
{
- Position = new Position(x, y, z);
+ SetSize(width, height, depth);
}
private void OnParentOriginChanged(float x, float y, float z)
private void OnKeyInputFocusGained(IntPtr view)
{
- if (keyInputFocusGainedEventHandler != null)
+ if (IsNativeHandleInvalid())
{
- keyInputFocusGainedEventHandler(this, null);
+ if (this.Disposed)
+ {
+ if (keyInputFocusGainedEventHandler != null)
+ {
+ var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+ var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
+ var me = this.GetType().FullName;
+
+ throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
+ $"OR the native dali object handle of NUI becomes null! \n" +
+ $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+ }
+ }
+ else
+ {
+ if (this.IsDisposeQueued)
+ {
+ var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+ var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
+ var me = this.GetType().FullName;
+
+ //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
+ Tizen.Log.Error("NUI", "in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! just return here! \n" +
+ $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+ return;
+ }
+ }
}
+
+ keyInputFocusGainedEventHandler?.Invoke(this, null);
}
private void OnKeyInputFocusLost(IntPtr view)
{
- if (keyInputFocusLostEventHandler != null)
+ if (IsNativeHandleInvalid())
{
- keyInputFocusLostEventHandler(this, null);
+ if (this.Disposed)
+ {
+ if (keyInputFocusLostEventHandler != null)
+ {
+ var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+ var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
+ var me = this.GetType().FullName;
+
+ throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
+ $"OR the native dali object handle of NUI becomes null! \n" +
+ $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+ }
+ }
+ else
+ {
+ if (this.IsDisposeQueued)
+ {
+ var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
+ var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
+ var me = this.GetType().FullName;
+
+ //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
+ Tizen.Log.Error("NUI", "in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! just return here! \n" +
+ $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
+ return;
+ }
+ }
}
+
+ keyInputFocusLostEventHandler?.Invoke(this, null);
}
private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
}
}
+ // Callback for View HitTestResultSignal
+ private bool OnHitTestResult(IntPtr view, IntPtr touchData)
+ {
+ if (touchData == global::System.IntPtr.Zero)
+ {
+ NUILog.Error("touchData should not be null!");
+ return true;
+ }
+
+ TouchEventArgs e = new TouchEventArgs();
+ e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
+ return HitTest(e.Touch);
+ }
+
// Callback for View TouchSignal
private bool OnInterceptTouch(IntPtr view, IntPtr touchData)
{
return true;
}
+ if (DispatchTouchEvents == false)
+ {
+ NUILog.Debug("If DispatchTouchEvents is false, it can not dispatch.");
+ return true;
+ }
+
TouchEventArgs e = new TouchEventArgs();
e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
consumed = HandleControlStateOnTouch(e.Touch);
}
+ if (DispatchParentTouchEvents == false)
+ {
+ NUILog.Debug("If DispatchParentTouchEvents is false, it can not dispatch to parent.");
+ return true;
+ }
+
return consumed;
}
return true;
}
+ if (DispatchHoverEvents == false)
+ {
+ NUILog.Debug("If DispatchHoverEvents is false, it can not dispatch.");
+ return true;
+ }
+
HoverEventArgs e = new HoverEventArgs();
e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);
+ bool consumed = false;
+
if (hoverEventHandler != null)
{
- return hoverEventHandler(this, e);
+ consumed = hoverEventHandler(this, e);
}
- return false;
+
+ if (DispatchParentHoverEvents == false && consumed == false)
+ {
+ NUILog.Debug("If DispatchParentHoverEvents is false, it can not dispatch to parent.");
+ return true;
+ }
+
+ return consumed;
+ }
+
+ // Callback for View InterceptWheel signal
+ private bool OnInterceptWheel(IntPtr view, IntPtr wheelEvent)
+ {
+ if (wheelEvent == global::System.IntPtr.Zero)
+ {
+ NUILog.Error("wheelEvent should not be null!");
+ return true;
+ }
+
+ // DisallowInterceptWheelEvent prevents the parent from intercepting wheel.
+ if (DisallowInterceptWheelEvent)
+ {
+ return false;
+ }
+
+ WheelEventArgs e = new WheelEventArgs();
+
+ e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
+
+ bool consumed = false;
+
+ if (interceptWheelHandler != null)
+ {
+ consumed = interceptWheelHandler(this, e);
+ }
+
+ return consumed;
}
// Callback for View Wheel signal
private void OnResourcesLoaded(IntPtr view)
{
+ if(!CheckResourceReady())
+ {
+ return;
+ }
+
if (resourcesLoadedEventHandler != null)
{
resourcesLoadedEventHandler(this, null);
public ControlState CurrentState { get; }
}
- private EventHandlerWithReturnType<object, WheelEventArgs, bool> WindowWheelEventHandler;
- private void OnWindowWheelEvent(object sender, Window.WheelEventArgs e)
- {
- if (e != null)
- {
- if (e.Wheel.Type == Wheel.WheelType.CustomWheel)
- {
- var arg = new WheelEventArgs()
- {
- Wheel = e.Wheel,
- };
- WindowWheelEventHandler?.Invoke(this, arg);
- }
- }
- }
-
/// <summary>
/// The expanded touch area.
/// TouchArea can expand the view's touchable area.<br/>