[NUI] Check if event handler of the DisposedQueued object is valid
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ViewEvent.cs
index cfdcc47..6645c13 100755 (executable)
@@ -42,8 +42,10 @@ namespace Tizen.NUI.BaseComponents
         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;
@@ -56,7 +58,7 @@ namespace Tizen.NUI.BaseComponents
         private ResourcesLoadedCallbackType ResourcesLoadedCallback;
         private EventHandler<BackgroundResourceLoadedEventArgs> backgroundResourceLoadedEventHandler;
         private _backgroundResourceLoadedCallbackType backgroundResourceLoadedCallback;
-
+        private OnWindowEventCallbackType onWindowSendEventCallback;
         private void SendViewAddedEventToWindow(IntPtr data)
         {
             // Unused parameter
@@ -80,10 +82,12 @@ namespace Tizen.NUI.BaseComponents
         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)]
@@ -114,19 +118,27 @@ namespace Tizen.NUI.BaseComponents
                 if (keyInputFocusGainedEventHandler == null)
                 {
                     keyInputFocusGainedCallback = OnKeyInputFocusGained;
-                    this.KeyInputFocusGainedSignal().Connect(keyInputFocusGainedCallback);
+                    using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
+                    signal?.Connect(keyInputFocusGainedCallback);
                 }
-
                 keyInputFocusGainedEventHandler += value;
             }
 
             remove
             {
                 keyInputFocusGainedEventHandler -= value;
-
-                if (keyInputFocusGainedEventHandler == null && KeyInputFocusGainedSignal().Empty() == false)
+                if (keyInputFocusGainedEventHandler == null)
                 {
-                    this.KeyInputFocusGainedSignal().Disconnect(keyInputFocusGainedCallback);
+                    using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
+
+                    if (keyInputFocusGainedCallback != null)
+                    {
+                        signal?.Disconnect(keyInputFocusGainedCallback);
+                        if (signal?.Empty() == true)
+                        {
+                            keyInputFocusGainedCallback = null;
+                        }
+                    }
                 }
             }
         }
@@ -143,19 +155,27 @@ namespace Tizen.NUI.BaseComponents
                 if (keyInputFocusLostEventHandler == null)
                 {
                     keyInputFocusLostCallback = OnKeyInputFocusLost;
-                    this.KeyInputFocusLostSignal().Connect(keyInputFocusLostCallback);
+                    using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
+                    signal?.Connect(keyInputFocusLostCallback);
                 }
-
                 keyInputFocusLostEventHandler += value;
             }
 
             remove
             {
                 keyInputFocusLostEventHandler -= value;
-
-                if (keyInputFocusLostEventHandler == null && KeyInputFocusLostSignal().Empty() == false)
+                if (keyInputFocusLostEventHandler == null)
                 {
-                    this.KeyInputFocusLostSignal().Disconnect(keyInputFocusLostCallback);
+                    using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
+
+                    if (keyInputFocusLostCallback != null)
+                    {
+                        signal?.Disconnect(keyInputFocusLostCallback);
+                        if (signal?.Empty() == true)
+                        {
+                            keyInputFocusLostCallback = null;
+                        }
+                    }
                 }
             }
         }
@@ -172,19 +192,23 @@ namespace Tizen.NUI.BaseComponents
                 if (keyEventHandler == null)
                 {
                     keyCallback = OnKeyEvent;
-                    this.KeyEventSignal().Connect(keyCallback);
+                    using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
+                    signal?.Connect(keyCallback);
                 }
-
                 keyEventHandler += value;
             }
 
             remove
             {
                 keyEventHandler -= value;
-
-                if (keyEventHandler == null && KeyEventSignal().Empty() == false)
+                if (keyEventHandler == null)
                 {
-                    this.KeyEventSignal().Disconnect(keyCallback);
+                    using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(keyCallback);
+                        keyCallback = null;
+                    }
                 }
             }
         }
@@ -201,22 +225,24 @@ namespace Tizen.NUI.BaseComponents
                 if (onRelayoutEventHandler == null)
                 {
                     onRelayoutEventCallback = OnRelayout;
-                    this.OnRelayoutSignal().Connect(onRelayoutEventCallback);
+                    using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
+                    signal?.Connect(onRelayoutEventCallback);
                 }
-
                 onRelayoutEventHandler += value;
             }
 
             remove
             {
                 onRelayoutEventHandler -= value;
-
-                if (onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false)
+                if (onRelayoutEventHandler == null)
                 {
-                    this.OnRelayoutSignal().Disconnect(onRelayoutEventCallback);
-                    onRelayoutEventCallback = null;
+                    using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(onRelayoutEventCallback);
+                        onRelayoutEventCallback = null;
+                    }
                 }
-
             }
         }
 
@@ -234,19 +260,23 @@ namespace Tizen.NUI.BaseComponents
                 if (interceptTouchDataEventHandler == null)
                 {
                     interceptTouchDataCallback = OnInterceptTouch;
-                    this.InterceptTouchSignal().Connect(interceptTouchDataCallback);
+                    using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
+                    signal?.Connect(interceptTouchDataCallback);
                 }
-
                 interceptTouchDataEventHandler += value;
             }
 
             remove
             {
                 interceptTouchDataEventHandler -= value;
-
-                if (interceptTouchDataEventHandler == null && InterceptTouchSignal().Empty() == false)
+                if (interceptTouchDataEventHandler == null)
                 {
-                    this.InterceptTouchSignal().Disconnect(interceptTouchDataCallback);
+                    using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(interceptTouchDataCallback);
+                        interceptTouchDataCallback = null;
+                    }
                 }
             }
         }
@@ -258,7 +288,7 @@ namespace Tizen.NUI.BaseComponents
         ///    parent.InterceptTouchEvent += OnInterceptTouchEvent;
         ///    View view = child.GetParent() as View;
         ///    view.DisallowInterceptTouchEvent = true;
-        ///  This prevents the parent from interceping touch.
+        ///  This prevents the parent from intercepting touch.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public bool DisallowInterceptTouchEvent { get; set; }
@@ -276,19 +306,23 @@ namespace Tizen.NUI.BaseComponents
                 if (touchDataEventHandler == null)
                 {
                     touchDataCallback = OnTouch;
-                    this.TouchSignal().Connect(touchDataCallback);
+                    using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
+                    signal.Connect(touchDataCallback);
                 }
-
                 touchDataEventHandler += value;
             }
 
             remove
             {
                 touchDataEventHandler -= value;
-
-                if (touchDataEventHandler == null && TouchSignal().Empty() == false)
+                if (touchDataEventHandler == null)
                 {
-                    this.TouchSignal().Disconnect(touchDataCallback);
+                    using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
+                    if (signal.Empty() == false)
+                    {
+                        signal.Disconnect(touchDataCallback);
+                        touchDataCallback = null;
+                    }
                 }
             }
         }
@@ -305,21 +339,24 @@ namespace Tizen.NUI.BaseComponents
                 if (hoverEventHandler == null)
                 {
                     hoverEventCallback = OnHoverEvent;
-                    this.HoveredSignal().Connect(hoverEventCallback);
+                    using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
+                    signal?.Connect(hoverEventCallback);
                 }
-
                 hoverEventHandler += value;
             }
 
             remove
             {
                 hoverEventHandler -= value;
-
-                if (hoverEventHandler == null && HoveredSignal().Empty() == false)
+                if (hoverEventHandler == null)
                 {
-                    this.HoveredSignal().Disconnect(hoverEventCallback);
+                    using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(hoverEventCallback);
+                        hoverEventCallback = null;
+                    }
                 }
-
             }
         }
 
@@ -335,7 +372,8 @@ namespace Tizen.NUI.BaseComponents
                 if (wheelEventHandler == null)
                 {
                     wheelEventCallback = OnWheelEvent;
-                    this.WheelEventSignal().Connect(wheelEventCallback);
+                    using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
+                    signal?.Connect(wheelEventCallback);
                 }
                 wheelEventHandler += value;
 
@@ -349,9 +387,14 @@ namespace Tizen.NUI.BaseComponents
             remove
             {
                 wheelEventHandler -= value;
-                if (wheelEventHandler == null && WheelEventSignal().Empty() == false)
+                if (wheelEventHandler == null)
                 {
-                    this.WheelEventSignal().Disconnect(wheelEventCallback);
+                    using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(wheelEventCallback);
+                        wheelEventCallback = null;
+                    }
                 }
 
                 WindowWheelEventHandler -= value;
@@ -374,20 +417,23 @@ namespace Tizen.NUI.BaseComponents
                 if (onWindowEventHandler == null)
                 {
                     onWindowEventCallback = OnWindow;
-                    this.OnWindowSignal().Connect(onWindowEventCallback);
+                    using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
+                    signal?.Connect(onWindowEventCallback);
                 }
-
                 onWindowEventHandler += value;
             }
 
             remove
             {
                 onWindowEventHandler -= value;
-
-                if (onWindowEventHandler == null && OnWindowSignal().Empty() == false)
+                if (onWindowEventHandler == null)
                 {
-                    this.OnWindowSignal().Disconnect(onWindowEventCallback);
-                    onWindowEventCallback = null;
+                    using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(onWindowEventCallback);
+                        onWindowEventCallback = null;
+                    }
                 }
             }
         }
@@ -404,20 +450,23 @@ namespace Tizen.NUI.BaseComponents
                 if (offWindowEventHandler == null)
                 {
                     offWindowEventCallback = OffWindow;
-                    this.OffWindowSignal().Connect(offWindowEventCallback);
+                    using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
+                    signal?.Connect(offWindowEventCallback);
                 }
-
                 offWindowEventHandler += value;
             }
 
             remove
             {
                 offWindowEventHandler -= value;
-
-                if (offWindowEventHandler == null && OffWindowSignal().Empty() == false)
+                if (offWindowEventHandler == null)
                 {
-                    this.OffWindowSignal().Disconnect(offWindowEventCallback);
-                    offWindowEventCallback = null;
+                    using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(offWindowEventCallback);
+                        offWindowEventCallback = null;
+                    }
                 }
             }
         }
@@ -492,20 +541,23 @@ namespace Tizen.NUI.BaseComponents
                 if (resourcesLoadedEventHandler == null)
                 {
                     ResourcesLoadedCallback = OnResourcesLoaded;
-                    this.ResourcesLoadedSignal().Connect(ResourcesLoadedCallback);
+                    using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
+                    signal?.Connect(ResourcesLoadedCallback);
                 }
-
                 resourcesLoadedEventHandler += value;
             }
 
             remove
             {
                 resourcesLoadedEventHandler -= value;
-
-                if (resourcesLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
+                if (resourcesLoadedEventHandler == null)
                 {
-                    this.ResourcesLoadedSignal().Disconnect(ResourcesLoadedCallback);
-                    ResourcesLoadedCallback = null;
+                    using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(ResourcesLoadedCallback);
+                        ResourcesLoadedCallback = null;
+                    }
                 }
             }
         }
@@ -549,19 +601,23 @@ namespace Tizen.NUI.BaseComponents
                 if (backgroundResourceLoadedEventHandler == null)
                 {
                     backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
-                    this.ResourcesLoadedSignal().Connect(backgroundResourceLoadedCallback);
+                    using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
+                    signal?.Connect(backgroundResourceLoadedCallback);
                 }
-
                 backgroundResourceLoadedEventHandler += value;
             }
+
             remove
             {
                 backgroundResourceLoadedEventHandler -= value;
-
-                if (backgroundResourceLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
+                if (backgroundResourceLoadedEventHandler == null)
                 {
-                    this.ResourcesLoadedSignal().Disconnect(backgroundResourceLoadedCallback);
-                    backgroundResourceLoadedCallback = null;
+                    using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
+                    if (signal?.Empty() == false)
+                    {
+                        signal?.Disconnect(backgroundResourceLoadedCallback);
+                        backgroundResourceLoadedCallback = null;
+                    }
                 }
             }
         }
@@ -664,94 +720,39 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        private void OnSize2DChanged(int? width, int? height)
+        private void OnColorChanged(float r, float g, float b, float a)
         {
-            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();
-            }
+            Color = new Color(r, g, b, a);
         }
 
-        private void OnMinimumSizeChanged(int? width, int? height)
+        private void OnMinimumSizeChanged(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.
-            }
+            MinimumSize = new Size2D(width, height);
         }
 
-        private void OnMaximumSizeChanged(int? width, int? height)
+        private void OnMaximumSizeChanged(int width, int height)
         {
-            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.
-            }
+            MaximumSize = new Size2D(width, height);
         }
 
         private void OnPosition2DChanged(int x, int y)
         {
-            Position2D = new Position2D(x, y);
+            SetPosition((float)x, (float)y, 0);
         }
 
-        private void OnSizeChanged(float? width, float? height, float? depth)
+        private void OnPositionChanged(float x, float y, float z)
         {
-            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();
-            }
+            SetPosition(x, y, z);
         }
 
-        private void OnPositionChanged(float x, float y, float z)
+        private void OnSize2DChanged(int width, int height)
         {
-            Position = new Position(x, y, z);
+            SetSize((float)width, (float)height, 0);
+        }
+
+        private void OnSizeChanged(float width, float height, float depth)
+        {
+            SetSize(width, height, depth);
         }
 
         private void OnParentOriginChanged(float x, float y, float z)
@@ -781,18 +782,74 @@ namespace Tizen.NUI.BaseComponents
 
         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)
@@ -1289,5 +1346,69 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// The expanded touch area.
+        /// TouchArea can expand the view's touchable area.<br/>
+        /// If you set the TouchAreaOffset on an view, when you touch the view, the touch area is used rather than the size of the view.<br/>
+        /// </summary>
+        /// <remarks>
+        /// This is based on the top left x, y coordinates.<br/>
+        /// For example) <br/>
+        /// <code>
+        ///  view.Size = new Size(100, 100);
+        ///  view.TouchAreaOffset = new Offset(-10, 20, 30, -40); // left, right, bottom, top
+        /// </code>
+        /// Then, touch area is 130x170.<br/>
+        /// This is view.width + TouchAreaOffset.right - TouchAreaOffset.left and view.height + TouchAreaOffset.bottom - TouchAreaOffset.top <br/>
+        /// +---------------------+ <br/>
+        /// |         ^           | <br/>
+        /// |         |           | <br/>
+        /// |         | -40       | <br/>
+        /// |         |           | <br/>
+        /// |         |           | <br/>
+        /// |    +----+----+      | <br/>
+        /// |    |         |      | <br/>
+        /// | -10|         | 20   | <br/>
+        /// |&lt;---+         +-----&gt;| <br/>
+        /// |    |         |      | <br/>
+        /// |    |         |      | <br/>
+        /// |    +----+----+      | <br/>
+        /// |         |           | <br/>
+        /// |         | 30        | <br/>
+        /// |         |           | <br/>
+        /// |         v           | <br/>
+        /// +---------------------+ <br/>
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Offset TouchAreaOffset
+        {
+            get
+            {
+                return (Offset)GetValue(TouchAreaOffsetProperty);
+            }
+            set
+            {
+                SetValue(TouchAreaOffsetProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        private Offset InternalTouchAreaOffset
+        {
+            get
+            {
+                Interop.ActorInternal.GetTouchAreaOffset(SwigCPtr, out int left, out int right, out int bottom, out int top);
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return new Offset(left, right, bottom, top);
+            }
+            set
+            {
+                Interop.ActorInternal.SetTouchAreaOffset(SwigCPtr, value.Left, value.Right, value.Bottom, value.Top);
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+        }
+
     }
 }