[NUI] Fix comments according to document review
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ViewEvent.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21
22 namespace Tizen.NUI.BaseComponents
23 {
24     /// <summary>
25     /// View is the base class for all views.
26     /// </summary>
27     /// <since_tizen> 3 </since_tizen>
28     public partial class View
29     {
30         private EventHandler offWindowEventHandler;
31         private OffWindowEventCallbackType offWindowEventCallback;
32         private EventHandlerWithReturnType<object, WheelEventArgs, bool> wheelEventHandler;
33         private WheelEventCallbackType wheelEventCallback;
34         private EventHandlerWithReturnType<object, KeyEventArgs, bool> keyEventHandler;
35         private KeyCallbackType keyCallback;
36         private EventHandlerWithReturnType<object, TouchEventArgs, bool> interceptTouchDataEventHandler;
37         private TouchDataCallbackType interceptTouchDataCallback;
38         private EventHandlerWithReturnType<object, TouchEventArgs, bool> touchDataEventHandler;
39         private TouchDataCallbackType touchDataCallback;
40         private EventHandlerWithReturnType<object, HoverEventArgs, bool> hoverEventHandler;
41         private HoverEventCallbackType hoverEventCallback;
42         private EventHandler<VisibilityChangedEventArgs> visibilityChangedEventHandler;
43         private VisibilityChangedEventCallbackType visibilityChangedEventCallback;
44         private EventHandler keyInputFocusGainedEventHandler;
45
46         private KeyInputFocusGainedCallbackType keyInputFocusGainedCallback;
47         private EventHandler keyInputFocusLostEventHandler;
48
49         private KeyInputFocusLostCallbackType keyInputFocusLostCallback;
50         private EventHandler onRelayoutEventHandler;
51         private OnRelayoutEventCallbackType onRelayoutEventCallback;
52         private EventHandler onWindowEventHandler;
53         private OnWindowEventCallbackType onWindowEventCallback;
54         private EventHandler<LayoutDirectionChangedEventArgs> layoutDirectionChangedEventHandler;
55         private LayoutDirectionChangedEventCallbackType layoutDirectionChangedEventCallback;
56         // Resource Ready Signal
57         private EventHandler resourcesLoadedEventHandler;
58         private ResourcesLoadedCallbackType ResourcesLoadedCallback;
59         private EventHandler<BackgroundResourceLoadedEventArgs> backgroundResourceLoadedEventHandler;
60         private _backgroundResourceLoadedCallbackType backgroundResourceLoadedCallback;
61         private OnWindowEventCallbackType onWindowSendEventCallback;
62         private void SendViewAddedEventToWindow(IntPtr data)
63         {
64             // Unused parameter
65             _ = data;
66             NUIApplication.GetDefaultWindow()?.SendViewAdded(this);
67         }
68         private TouchDataCallbackType hitTestResultDataCallback;
69
70         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
71         private delegate void OffWindowEventCallbackType(IntPtr control);
72         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
73         private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
74         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
75         private delegate bool KeyCallbackType(IntPtr control, IntPtr keyEvent);
76         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
77         private delegate bool TouchDataCallbackType(IntPtr view, IntPtr touchData);
78         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79         private delegate bool HoverEventCallbackType(IntPtr view, IntPtr hoverEvent);
80         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
81         private delegate void VisibilityChangedEventCallbackType(IntPtr data, bool visibility, VisibilityChangeType type);
82         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83         private delegate void ResourcesLoadedCallbackType(IntPtr control);
84         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
85         private delegate void _backgroundResourceLoadedCallbackType(IntPtr view);
86
87         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
88         private delegate void KeyInputFocusGainedCallbackType(IntPtr control);
89         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
90         private delegate void KeyInputFocusLostCallbackType(IntPtr control);
91
92         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
93         private delegate void OnRelayoutEventCallbackType(IntPtr control);
94         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
95         private delegate void OnWindowEventCallbackType(IntPtr control);
96         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
97         private delegate void LayoutDirectionChangedEventCallbackType(IntPtr data, ViewLayoutDirectionType type);
98
99         /// <summary>
100         /// Event when a child is removed.
101         /// </summary>
102         /// <since_tizen> 5 </since_tizen>
103         public new event EventHandler<ChildRemovedEventArgs> ChildRemoved;
104         /// <summary>
105         /// Event when a child is added.
106         /// </summary>
107         /// <since_tizen> 5 </since_tizen>
108         public new event EventHandler<ChildAddedEventArgs> ChildAdded;
109
110         /// <summary>
111         /// An event for the KeyInputFocusGained signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
112         /// The KeyInputFocusGained signal is emitted when the control gets the key input focus.<br />
113         /// </summary>
114         /// <since_tizen> 3 </since_tizen>
115         public event EventHandler FocusGained
116         {
117             add
118             {
119                 if (keyInputFocusGainedEventHandler == null)
120                 {
121                     keyInputFocusGainedCallback = OnKeyInputFocusGained;
122                     using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
123                     signal?.Connect(keyInputFocusGainedCallback);
124                 }
125                 keyInputFocusGainedEventHandler += value;
126             }
127
128             remove
129             {
130                 keyInputFocusGainedEventHandler -= value;
131                 if (keyInputFocusGainedEventHandler == null)
132                 {
133                     using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
134
135                     if (keyInputFocusGainedCallback != null)
136                     {
137                         signal?.Disconnect(keyInputFocusGainedCallback);
138                         if (signal?.Empty() == true)
139                         {
140                             keyInputFocusGainedCallback = null;
141                         }
142                     }
143                 }
144             }
145         }
146
147         /// <summary>
148         /// An event for the KeyInputFocusLost signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
149         /// The KeyInputFocusLost signal is emitted when the control loses the key input focus.<br />
150         /// </summary>
151         /// <since_tizen> 3 </since_tizen>
152         public event EventHandler FocusLost
153         {
154             add
155             {
156                 if (keyInputFocusLostEventHandler == null)
157                 {
158                     keyInputFocusLostCallback = OnKeyInputFocusLost;
159                     using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
160                     signal?.Connect(keyInputFocusLostCallback);
161                 }
162                 keyInputFocusLostEventHandler += value;
163             }
164
165             remove
166             {
167                 keyInputFocusLostEventHandler -= value;
168                 if (keyInputFocusLostEventHandler == null)
169                 {
170                     using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
171
172                     if (keyInputFocusLostCallback != null)
173                     {
174                         signal?.Disconnect(keyInputFocusLostCallback);
175                         if (signal?.Empty() == true)
176                         {
177                             keyInputFocusLostCallback = null;
178                         }
179                     }
180                 }
181             }
182         }
183
184         /// <summary>
185         /// An event for the KeyPressed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
186         /// The KeyPressed signal is emitted when the key event is received.<br />
187         /// </summary>
188         /// <since_tizen> 3 </since_tizen>
189         public event EventHandlerWithReturnType<object, KeyEventArgs, bool> KeyEvent
190         {
191             add
192             {
193                 if (keyEventHandler == null)
194                 {
195                     keyCallback = OnKeyEvent;
196                     using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
197                     signal?.Connect(keyCallback);
198                 }
199                 keyEventHandler += value;
200             }
201
202             remove
203             {
204                 keyEventHandler -= value;
205                 if (keyEventHandler == null)
206                 {
207                     using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
208                     if (signal?.Empty() == false)
209                     {
210                         signal?.Disconnect(keyCallback);
211                         if (signal?.Empty() == true)
212                         {
213                             keyCallback = null;
214                         }
215                     }
216                 }
217             }
218         }
219
220         /// <summary>
221         /// An event for the OnRelayout signal which can be used to subscribe or unsubscribe the event handler.<br />
222         /// The OnRelayout signal is emitted after the size has been set on the view during relayout.<br />
223         /// </summary>
224         /// <since_tizen> 3 </since_tizen>
225         public event EventHandler Relayout
226         {
227             add
228             {
229                 if (onRelayoutEventHandler == null)
230                 {
231                     onRelayoutEventCallback = OnRelayout;
232                     using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
233                     signal?.Connect(onRelayoutEventCallback);
234                 }
235                 onRelayoutEventHandler += value;
236             }
237
238             remove
239             {
240                 onRelayoutEventHandler -= value;
241                 if (onRelayoutEventHandler == null)
242                 {
243                     using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
244                     if (signal?.Empty() == false)
245                     {
246                         signal?.Disconnect(onRelayoutEventCallback);
247                         if (signal?.Empty() == true)
248                         {
249                             onRelayoutEventCallback = null;
250                         }
251                     }
252                 }
253             }
254         }
255
256         /// <summary>
257         /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
258         /// The touched signal is emitted when the touch input is received.<br />
259         /// This can receive touch events before child. <br />
260         /// 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 />
261         /// </summary>
262         [EditorBrowsable(EditorBrowsableState.Never)]
263         public event EventHandlerWithReturnType<object, TouchEventArgs, bool> InterceptTouchEvent
264         {
265             add
266             {
267                 if (interceptTouchDataEventHandler == null)
268                 {
269                     interceptTouchDataCallback = OnInterceptTouch;
270                     using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
271                     signal?.Connect(interceptTouchDataCallback);
272                 }
273                 interceptTouchDataEventHandler += value;
274             }
275
276             remove
277             {
278                 interceptTouchDataEventHandler -= value;
279                 if (interceptTouchDataEventHandler == null)
280                 {
281                     using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
282                     if (signal?.Empty() == false)
283                     {
284                         signal?.Disconnect(interceptTouchDataCallback);
285                         if (signal?.Empty() == true)
286                         {
287                             interceptTouchDataCallback = null;
288                         }
289                     }
290                 }
291             }
292         }
293
294         /// <summary>
295         /// If child view doesn't want the parent's view to intercept the touch, you can set it to true.
296         /// for example :
297         ///    parent.Add(child);
298         ///    parent.InterceptTouchEvent += OnInterceptTouchEvent;
299         ///    View view = child.GetParent() as View;
300         ///    view.DisallowInterceptTouchEvent = true;
301         ///  This prevents the parent from intercepting touch.
302         /// </summary>
303         [EditorBrowsable(EditorBrowsableState.Never)]
304         public bool DisallowInterceptTouchEvent { get; set; }
305
306
307         /// <summary>
308         /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
309         /// The touched signal is emitted when the touch input is received.<br />
310         /// </summary>
311         /// <since_tizen> 3 </since_tizen>
312         public event EventHandlerWithReturnType<object, TouchEventArgs, bool> TouchEvent
313         {
314             add
315             {
316                 if (touchDataEventHandler == null)
317                 {
318                     touchDataCallback = OnTouch;
319                     using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
320                     signal.Connect(touchDataCallback);
321                 }
322                 touchDataEventHandler += value;
323             }
324
325             remove
326             {
327                 touchDataEventHandler -= value;
328                 if (touchDataEventHandler == null)
329                 {
330                     using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
331                     if (signal.Empty() == false)
332                     {
333                         signal.Disconnect(touchDataCallback);
334                         if (signal?.Empty() == true)
335                         {
336                             touchDataCallback = null;
337                         }
338                     }
339                 }
340             }
341         }
342
343         /// <summary>
344         /// An event for the hovered signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
345         /// The hovered signal is emitted when the hover input is received.<br />
346         /// </summary>
347         /// <since_tizen> 3 </since_tizen>
348         public event EventHandlerWithReturnType<object, HoverEventArgs, bool> HoverEvent
349         {
350             add
351             {
352                 if (hoverEventHandler == null)
353                 {
354                     hoverEventCallback = OnHoverEvent;
355                     using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
356                     signal?.Connect(hoverEventCallback);
357                 }
358                 hoverEventHandler += value;
359             }
360
361             remove
362             {
363                 hoverEventHandler -= value;
364                 if (hoverEventHandler == null)
365                 {
366                     using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
367                     if (signal?.Empty() == false)
368                     {
369                         signal?.Disconnect(hoverEventCallback);
370                         if (signal?.Empty() == true)
371                         {
372                             hoverEventCallback = null;
373                         }
374                     }
375                 }
376             }
377         }
378
379         /// <summary>
380         /// An event for the WheelMoved signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
381         /// The WheelMoved signal is emitted when the wheel event is received.<br />
382         /// </summary>
383         /// <since_tizen> 3 </since_tizen>
384         public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelEvent
385         {
386             add
387             {
388                 if (wheelEventHandler == null)
389                 {
390                     wheelEventCallback = OnWheelEvent;
391                     using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
392                     signal?.Connect(wheelEventCallback);
393                 }
394                 wheelEventHandler += value;
395             }
396
397             remove
398             {
399                 wheelEventHandler -= value;
400                 if (wheelEventHandler == null)
401                 {
402                     using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
403                     if (signal?.Empty() == false)
404                     {
405                         signal?.Disconnect(wheelEventCallback);
406                         if (signal?.Empty() == true)
407                         {
408                             wheelEventCallback = null;
409                         }
410                     }
411                 }
412             }
413         }
414
415         /// <summary>
416         /// An event for the OnWindow signal which can be used to subscribe or unsubscribe the event handler.<br />
417         /// The OnWindow signal is emitted after the view has been connected to the window.<br />
418         /// </summary>
419         /// <since_tizen> 3 </since_tizen>
420         public event EventHandler AddedToWindow
421         {
422             add
423             {
424                 if (onWindowEventHandler == null)
425                 {
426                     onWindowEventCallback = OnWindow;
427                     using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
428                     signal?.Connect(onWindowEventCallback);
429                 }
430                 onWindowEventHandler += value;
431             }
432
433             remove
434             {
435                 onWindowEventHandler -= value;
436                 if (onWindowEventHandler == null)
437                 {
438                     using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
439                     if (signal?.Empty() == false)
440                     {
441                         signal?.Disconnect(onWindowEventCallback);
442                         if (signal?.Empty() == true)
443                         {
444                             onWindowEventCallback = null;
445                         }
446                     }
447                 }
448             }
449         }
450
451         /// <summary>
452         /// An event for the OffWindow signal, which can be used to subscribe or unsubscribe the event handler.<br />
453         /// OffWindow signal is emitted after the view has been disconnected from the window.<br />
454         /// </summary>
455         /// <since_tizen> 3 </since_tizen>
456         public event EventHandler RemovedFromWindow
457         {
458             add
459             {
460                 if (offWindowEventHandler == null)
461                 {
462                     offWindowEventCallback = OffWindow;
463                     using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
464                     signal?.Connect(offWindowEventCallback);
465                 }
466                 offWindowEventHandler += value;
467             }
468
469             remove
470             {
471                 offWindowEventHandler -= value;
472                 if (offWindowEventHandler == null)
473                 {
474                     using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
475                     if (signal?.Empty() == false)
476                     {
477                         signal?.Disconnect(offWindowEventCallback);
478                         if (signal?.Empty() == true)
479                         {
480                             offWindowEventCallback = null;
481                         }
482                     }
483                 }
484             }
485         }
486
487         /// <summary>
488         /// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
489         /// This signal is emitted when the visible property of this or a parent view is changed.<br />
490         /// </summary>
491         /// <since_tizen> 3 </since_tizen>
492         public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
493         {
494             add
495             {
496                 if (visibilityChangedEventHandler == null)
497                 {
498                     visibilityChangedEventCallback = OnVisibilityChanged;
499                     VisibilityChangedSignal(this).Connect(visibilityChangedEventCallback);
500                 }
501
502                 visibilityChangedEventHandler += value;
503             }
504
505             remove
506             {
507                 visibilityChangedEventHandler -= value;
508
509                 if (visibilityChangedEventHandler == null && VisibilityChangedSignal(this).Empty() == false)
510                 {
511                     VisibilityChangedSignal(this).Disconnect(visibilityChangedEventCallback);
512                     if (VisibilityChangedSignal(this).Empty() == true)
513                     {
514                         visibilityChangedEventCallback = null;
515                     }
516                 }
517             }
518         }
519
520         /// <summary>
521         /// Event for layout direction change which can be used to subscribe/unsubscribe the event handler.<br />
522         /// This signal is emitted when the layout direction property of this or a parent view is changed.<br />
523         /// </summary>
524         /// <since_tizen> 4 </since_tizen>
525         public event EventHandler<LayoutDirectionChangedEventArgs> LayoutDirectionChanged
526         {
527             add
528             {
529                 if (layoutDirectionChangedEventHandler == null)
530                 {
531                     layoutDirectionChangedEventCallback = OnLayoutDirectionChanged;
532                     LayoutDirectionChangedSignal(this).Connect(layoutDirectionChangedEventCallback);
533                 }
534
535                 layoutDirectionChangedEventHandler += value;
536             }
537
538             remove
539             {
540                 layoutDirectionChangedEventHandler -= value;
541
542                 if (layoutDirectionChangedEventHandler == null && LayoutDirectionChangedSignal(this).Empty() == false)
543                 {
544                     LayoutDirectionChangedSignal(this).Disconnect(layoutDirectionChangedEventCallback);
545                     if (LayoutDirectionChangedSignal(this).Empty() == true)
546                     {
547                         layoutDirectionChangedEventCallback = null;
548                     }
549                 }
550             }
551         }
552
553         /// <summary>
554         /// An event for the ResourcesLoadedSignal signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
555         /// This signal is emitted after all resources required by a view are loaded and ready.<br />
556         /// </summary>
557         /// <since_tizen> 3 </since_tizen>
558         public event EventHandler ResourcesLoaded
559         {
560             add
561             {
562                 if (resourcesLoadedEventHandler == null)
563                 {
564                     ResourcesLoadedCallback = OnResourcesLoaded;
565                     using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
566                     signal?.Connect(ResourcesLoadedCallback);
567                 }
568                 resourcesLoadedEventHandler += value;
569             }
570
571             remove
572             {
573                 resourcesLoadedEventHandler -= value;
574                 if (resourcesLoadedEventHandler == null)
575                 {
576                     using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
577                     if (signal?.Empty() == false)
578                     {
579                         signal?.Disconnect(ResourcesLoadedCallback);
580                         if (signal?.Empty() == true)
581                         {
582                             ResourcesLoadedCallback = null;
583                         }
584                     }
585                 }
586             }
587         }
588
589         private EventHandler _backKeyPressed;
590
591         /// <summary>
592         /// An event for getting notice when physical back key is pressed.<br />
593         /// This event is emitted BackKey is up.<br />
594         /// </summary>
595         [EditorBrowsable(EditorBrowsableState.Never)]
596         public event EventHandler BackKeyPressed
597         {
598             add
599             {
600                 _backKeyPressed += value;
601                 BackKeyManager.Instance.Subscriber.Add(this);
602             }
603
604             remove
605             {
606                 BackKeyManager.Instance.Subscriber.Remove(this);
607                 _backKeyPressed -= value;
608             }
609         }
610
611         /// <summary>
612         /// Function for emitting BackKeyPressed event outside of View instance
613         /// </summary>
614         [EditorBrowsable(EditorBrowsableState.Never)]
615         internal void EmitBackKeyPressed()
616         {
617             _backKeyPressed.Invoke(this, null);
618         }
619
620
621         internal event EventHandler<BackgroundResourceLoadedEventArgs> BackgroundResourceLoaded
622         {
623             add
624             {
625                 if (backgroundResourceLoadedEventHandler == null)
626                 {
627                     backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
628                     using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
629                     signal?.Connect(backgroundResourceLoadedCallback);
630                 }
631                 backgroundResourceLoadedEventHandler += value;
632             }
633
634             remove
635             {
636                 backgroundResourceLoadedEventHandler -= value;
637                 if (backgroundResourceLoadedEventHandler == null)
638                 {
639                     using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
640                     if (signal?.Empty() == false)
641                     {
642                         signal?.Disconnect(backgroundResourceLoadedCallback);
643                         if (signal?.Empty() == true)
644                         {
645                             backgroundResourceLoadedCallback = null;
646                         }
647                     }
648                 }
649             }
650         }
651
652         internal TouchDataSignal InterceptTouchSignal()
653         {
654             TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(SwigCPtr), false);
655             if (NDalicPINVOKE.SWIGPendingException.Pending)
656                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
657             return ret;
658         }
659
660         internal TouchDataSignal TouchSignal()
661         {
662             TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(SwigCPtr), false);
663             if (NDalicPINVOKE.SWIGPendingException.Pending)
664                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665             return ret;
666         }
667
668         internal HoverSignal HoveredSignal()
669         {
670             HoverSignal ret = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(SwigCPtr), false);
671             if (NDalicPINVOKE.SWIGPendingException.Pending)
672                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673             return ret;
674         }
675
676         internal WheelSignal WheelEventSignal()
677         {
678             WheelSignal ret = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(SwigCPtr), false);
679             if (NDalicPINVOKE.SWIGPendingException.Pending)
680                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681             return ret;
682         }
683
684         internal ViewSignal OnWindowSignal()
685         {
686             ViewSignal ret = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
687             if (NDalicPINVOKE.SWIGPendingException.Pending)
688                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
689             return ret;
690         }
691
692         internal ViewSignal OffWindowSignal()
693         {
694             ViewSignal ret = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(SwigCPtr), false);
695             if (NDalicPINVOKE.SWIGPendingException.Pending)
696                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
697             return ret;
698         }
699
700         internal ViewSignal OnRelayoutSignal()
701         {
702             ViewSignal ret = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(SwigCPtr), false);
703             if (NDalicPINVOKE.SWIGPendingException.Pending)
704                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705             return ret;
706         }
707
708         internal ViewVisibilityChangedSignal VisibilityChangedSignal(View view)
709         {
710             ViewVisibilityChangedSignal ret = new ViewVisibilityChangedSignal(Interop.NDalic.VisibilityChangedSignal(View.getCPtr(view)), false);
711             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712             return ret;
713         }
714
715         internal ViewLayoutDirectionChangedSignal LayoutDirectionChangedSignal(View view)
716         {
717             ViewLayoutDirectionChangedSignal ret = new ViewLayoutDirectionChangedSignal(Interop.Layout.LayoutDirectionChangedSignal(View.getCPtr(view)), false);
718             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719             return ret;
720         }
721
722         internal ViewSignal ResourcesLoadedSignal()
723         {
724             ViewSignal ret = new ViewSignal(Interop.View.ResourceReadySignal(SwigCPtr), false);
725             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
726             return ret;
727         }
728
729         internal ControlKeySignal KeyEventSignal()
730         {
731             ControlKeySignal ret = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(SwigCPtr), false);
732             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733             return ret;
734         }
735
736         internal KeyInputFocusSignal KeyInputFocusGainedSignal()
737         {
738             KeyInputFocusSignal ret = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(SwigCPtr), false);
739             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740             return ret;
741         }
742
743         internal KeyInputFocusSignal KeyInputFocusLostSignal()
744         {
745             KeyInputFocusSignal ret = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(SwigCPtr), false);
746             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747             return ret;
748         }
749
750         private void OnColorChanged(float r, float g, float b, float a)
751         {
752             Color = new Color(r, g, b, a);
753         }
754
755         private void OnMinimumSizeChanged(int width, int height)
756         {
757             MinimumSize = new Size2D(width, height);
758         }
759
760         private void OnMaximumSizeChanged(int width, int height)
761         {
762             MaximumSize = new Size2D(width, height);
763         }
764
765         private void OnPosition2DChanged(int x, int y)
766         {
767             SetPosition((float)x, (float)y, 0);
768         }
769
770         private void OnPositionChanged(float x, float y, float z)
771         {
772             SetPosition(x, y, z);
773         }
774
775         private void OnSize2DChanged(int width, int height)
776         {
777             SetSize((float)width, (float)height, 0);
778         }
779
780         private void OnSizeChanged(float width, float height, float depth)
781         {
782             SetSize(width, height, depth);
783         }
784
785         private void OnParentOriginChanged(float x, float y, float z)
786         {
787             ParentOrigin = new Position(x, y, z);
788         }
789
790         private void OnPivotPointChanged(float x, float y, float z)
791         {
792             PivotPoint = new Position(x, y, z);
793         }
794
795         private void OnImageShadowChanged(ShadowBase instance)
796         {
797             ImageShadow = (ImageShadow)instance;
798         }
799
800         private void OnBoxShadowChanged(ShadowBase instance)
801         {
802             BoxShadow = (Shadow)instance;
803         }
804
805         private void OnBackgroundImageBorderChanged(int left, int right, int bottom, int top)
806         {
807             BackgroundImageBorder = new Rectangle(left, right, bottom, top);
808         }
809
810         private void OnKeyInputFocusGained(IntPtr view)
811         {
812             if (IsNativeHandleInvalid())
813             {
814                 if (this.Disposed)
815                 {
816                     if (keyInputFocusGainedEventHandler != null)
817                     {
818                         var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
819                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
820                         var me = this.GetType().FullName;
821
822                         throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
823                             $"OR the native dali object handle of NUI becomes null! \n" +
824                             $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
825                     }
826                 }
827                 else
828                 {
829                     if (this.IsDisposeQueued)
830                     {
831                         var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
832                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
833                         var me = this.GetType().FullName;
834
835                         //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
836                         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" +
837                             $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
838                         return;
839                     }
840                 }
841             }
842
843             keyInputFocusGainedEventHandler?.Invoke(this, null);
844         }
845
846         private void OnKeyInputFocusLost(IntPtr view)
847         {
848             if (IsNativeHandleInvalid())
849             {
850                 if (this.Disposed)
851                 {
852                     if (keyInputFocusLostEventHandler != null)
853                     {
854                         var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
855                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
856                         var me = this.GetType().FullName;
857
858                         throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
859                             $"OR the native dali object handle of NUI becomes null! \n" +
860                             $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
861                     }
862                 }
863                 else
864                 {
865                     if (this.IsDisposeQueued)
866                     {
867                         var process = global::System.Diagnostics.Process.GetCurrentProcess().Id;
868                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
869                         var me = this.GetType().FullName;
870
871                         //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
872                         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" +
873                             $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
874                         return;
875                     }
876                 }
877             }
878
879             keyInputFocusLostEventHandler?.Invoke(this, null);
880         }
881
882         private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
883         {
884             if (keyEvent == global::System.IntPtr.Zero)
885             {
886                 NUILog.Error("keyEvent should not be null!");
887                 return true;
888             }
889
890             KeyEventArgs e = new KeyEventArgs();
891
892             bool result = false;
893
894             e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent);
895
896             if (keyEventHandler != null)
897             {
898                 Delegate[] delegateList = keyEventHandler.GetInvocationList();
899
900                 // Oring the result of each callback.
901                 foreach (EventHandlerWithReturnType<object, KeyEventArgs, bool> del in delegateList)
902                 {
903                     result |= del(this, e);
904                 }
905             }
906
907             return result;
908         }
909
910         // Callback for View OnRelayout signal
911         private void OnRelayout(IntPtr data)
912         {
913             if (onRelayoutEventHandler != null)
914             {
915                 onRelayoutEventHandler(this, null);
916             }
917         }
918
919         // Callback for View HitTestResultSignal
920         private bool OnHitTestResult(IntPtr view, IntPtr touchData)
921         {
922             TouchEventArgs e = new TouchEventArgs();
923             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
924             return HitTest(e.Touch);
925         }
926
927         // Callback for View TouchSignal
928         private bool OnInterceptTouch(IntPtr view, IntPtr touchData)
929         {
930             if (touchData == global::System.IntPtr.Zero)
931             {
932                 NUILog.Error("touchData should not be null!");
933                 return true;
934             }
935
936             // DisallowInterceptTouchEvent prevents the parent from intercepting touch.
937             if (DisallowInterceptTouchEvent)
938             {
939                 return false;
940             }
941
942             TouchEventArgs e = new TouchEventArgs();
943
944             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
945
946             bool consumed = false;
947
948             if (interceptTouchDataEventHandler != null)
949             {
950                 consumed = interceptTouchDataEventHandler(this, e);
951             }
952
953             return consumed;
954         }
955
956         // Callback for View TouchSignal
957         private bool OnTouch(IntPtr view, IntPtr touchData)
958         {
959             if (touchData == global::System.IntPtr.Zero)
960             {
961                 NUILog.Error("touchData should not be null!");
962                 return true;
963             }
964
965             TouchEventArgs e = new TouchEventArgs();
966
967             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
968
969             bool consumed = false;
970
971             if (touchDataEventHandler != null)
972             {
973                 consumed = touchDataEventHandler(this, e);
974             }
975
976             if (enableControlState && !consumed)
977             {
978                 consumed = HandleControlStateOnTouch(e.Touch);
979             }
980
981             return consumed;
982         }
983
984         // Callback for View Hover signal
985         private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
986         {
987             if (hoverEvent == global::System.IntPtr.Zero)
988             {
989                 NUILog.Error("hoverEvent should not be null!");
990                 return true;
991             }
992
993             HoverEventArgs e = new HoverEventArgs();
994
995             e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);
996
997             if (hoverEventHandler != null)
998             {
999                 return hoverEventHandler(this, e);
1000             }
1001             return false;
1002         }
1003
1004         // Callback for View Wheel signal
1005         private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
1006         {
1007             if (wheelEvent == global::System.IntPtr.Zero)
1008             {
1009                 NUILog.Error("wheelEvent should not be null!");
1010                 return true;
1011             }
1012
1013             WheelEventArgs e = new WheelEventArgs();
1014
1015             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1016
1017             if (wheelEventHandler != null)
1018             {
1019                 return wheelEventHandler(this, e);
1020             }
1021             return false;
1022         }
1023
1024         // Callback for View OnWindow signal
1025         private void OnWindow(IntPtr data)
1026         {
1027             if (onWindowEventHandler != null)
1028             {
1029                 onWindowEventHandler(this, null);
1030             }
1031         }
1032
1033         // Callback for View OffWindow signal
1034         private void OffWindow(IntPtr data)
1035         {
1036             if (offWindowEventHandler != null)
1037             {
1038                 offWindowEventHandler(this, null);
1039             }
1040         }
1041
1042         // Callback for View visibility change signal
1043         private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type)
1044         {
1045             VisibilityChangedEventArgs e = new VisibilityChangedEventArgs();
1046             if (data != null)
1047             {
1048                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1049             }
1050             e.Visibility = visibility;
1051             e.Type = type;
1052
1053             if (visibilityChangedEventHandler != null)
1054             {
1055                 visibilityChangedEventHandler(this, e);
1056             }
1057         }
1058
1059         // Callback for View layout direction change signal
1060         private void OnLayoutDirectionChanged(IntPtr data, ViewLayoutDirectionType type)
1061         {
1062             LayoutDirectionChangedEventArgs e = new LayoutDirectionChangedEventArgs();
1063             if (data != null)
1064             {
1065                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1066             }
1067             e.Type = type;
1068
1069             if (layoutDirectionChangedEventHandler != null)
1070             {
1071                 layoutDirectionChangedEventHandler(this, e);
1072             }
1073         }
1074
1075         private void OnResourcesLoaded(IntPtr view)
1076         {
1077             if (resourcesLoadedEventHandler != null)
1078             {
1079                 resourcesLoadedEventHandler(this, null);
1080             }
1081         }
1082
1083         private void OnBackgroundResourceLoaded(IntPtr view)
1084         {
1085             BackgroundResourceLoadedEventArgs e = new BackgroundResourceLoadedEventArgs();
1086             e.Status = (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1087
1088             if (backgroundResourceLoadedEventHandler != null)
1089             {
1090                 backgroundResourceLoadedEventHandler(this, e);
1091             }
1092         }
1093
1094         /// <summary>
1095         /// Event argument passed through the ChildAdded event.
1096         /// </summary>
1097         /// <since_tizen> 5 </since_tizen>
1098         public class ChildAddedEventArgs : EventArgs
1099         {
1100             /// <summary>
1101             /// Added child view at moment.
1102             /// </summary>
1103             /// <since_tizen> 5 </since_tizen>
1104             public View Added { get; set; }
1105         }
1106
1107         /// <summary>
1108         /// Event argument passed through the ChildRemoved event.
1109         /// </summary>
1110         /// <since_tizen> 5 </since_tizen>
1111         public class ChildRemovedEventArgs : EventArgs
1112         {
1113             /// <summary>
1114             /// Removed child view at moment.
1115             /// </summary>
1116             /// <since_tizen> 5 </since_tizen>
1117             public View Removed { get; set; }
1118         }
1119
1120         /// <summary>
1121         /// Event arguments that passed via the KeyEvent signal.
1122         /// </summary>
1123         /// <since_tizen> 3 </since_tizen>
1124         public class KeyEventArgs : EventArgs
1125         {
1126             private Key _key;
1127
1128             /// <summary>
1129             /// Key - is the key sent to the view.
1130             /// </summary>
1131             /// <since_tizen> 3 </since_tizen>
1132             public Key Key
1133             {
1134                 get
1135                 {
1136                     return _key;
1137                 }
1138                 set
1139                 {
1140                     _key = value;
1141                 }
1142             }
1143         }
1144
1145         /// <summary>
1146         /// Event arguments that passed via the touch signal.
1147         /// </summary>
1148         /// <since_tizen> 3 </since_tizen>
1149         public class TouchEventArgs : EventArgs
1150         {
1151             private Touch _touch;
1152
1153             /// <summary>
1154             /// Touch - contains the information of touch points.
1155             /// </summary>
1156             /// <since_tizen> 3 </since_tizen>
1157             public Touch Touch
1158             {
1159                 get
1160                 {
1161                     return _touch;
1162                 }
1163                 set
1164                 {
1165                     _touch = value;
1166                 }
1167             }
1168         }
1169
1170         /// <summary>
1171         /// Event arguments that passed via the hover signal.
1172         /// </summary>
1173         /// <since_tizen> 3 </since_tizen>
1174         public class HoverEventArgs : EventArgs
1175         {
1176             private Hover _hover;
1177
1178             /// <summary>
1179             /// Hover - contains touch points that represent the points that are currently being hovered or the points where a hover has stopped.
1180             /// </summary>
1181             /// <since_tizen> 3 </since_tizen>
1182             public Hover Hover
1183             {
1184                 get
1185                 {
1186                     return _hover;
1187                 }
1188                 set
1189                 {
1190                     _hover = value;
1191                 }
1192             }
1193         }
1194
1195         /// <summary>
1196         /// Event arguments that passed via the wheel signal.
1197         /// </summary>
1198         /// <since_tizen> 3 </since_tizen>
1199         public class WheelEventArgs : EventArgs
1200         {
1201             private Wheel _wheel;
1202
1203             /// <summary>
1204             /// WheelEvent - store a wheel rolling type: MOUSE_WHEEL or CUSTOM_WHEEL.
1205             /// </summary>
1206             /// <since_tizen> 3 </since_tizen>
1207             public Wheel Wheel
1208             {
1209                 get
1210                 {
1211                     return _wheel;
1212                 }
1213                 set
1214                 {
1215                     _wheel = value;
1216                 }
1217             }
1218         }
1219
1220         /// <summary>
1221         /// Event arguments of visibility changed.
1222         /// </summary>
1223         /// <since_tizen> 3 </since_tizen>
1224         public class VisibilityChangedEventArgs : EventArgs
1225         {
1226             private View _view;
1227             private bool _visibility;
1228             private VisibilityChangeType _type;
1229
1230             /// <summary>
1231             /// The view, or child of view, whose visibility has changed.
1232             /// </summary>
1233             /// <since_tizen> 3 </since_tizen>
1234             public View View
1235             {
1236                 get
1237                 {
1238                     return _view;
1239                 }
1240                 set
1241                 {
1242                     _view = value;
1243                 }
1244             }
1245
1246             /// <summary>
1247             /// Whether the view is now visible or not.
1248             /// </summary>
1249             /// <since_tizen> 3 </since_tizen>
1250             public bool Visibility
1251             {
1252                 get
1253                 {
1254                     return _visibility;
1255                 }
1256                 set
1257                 {
1258                     _visibility = value;
1259                 }
1260             }
1261
1262             /// <summary>
1263             /// Whether the view's visible property has changed or a parent's.
1264             /// </summary>
1265             /// <since_tizen> 3 </since_tizen>
1266             public VisibilityChangeType Type
1267             {
1268                 get
1269                 {
1270                     return _type;
1271                 }
1272                 set
1273                 {
1274                     _type = value;
1275                 }
1276             }
1277         }
1278
1279         /// <summary>
1280         /// Event arguments of layout direction changed.
1281         /// </summary>
1282         /// <since_tizen> 4 </since_tizen>
1283         public class LayoutDirectionChangedEventArgs : EventArgs
1284         {
1285             private View _view;
1286             private ViewLayoutDirectionType _type;
1287
1288             /// <summary>
1289             /// The view, or child of view, whose layout direction has changed.
1290             /// </summary>
1291             /// <since_tizen> 4 </since_tizen>
1292             public View View
1293             {
1294                 get
1295                 {
1296                     return _view;
1297                 }
1298                 set
1299                 {
1300                     _view = value;
1301                 }
1302             }
1303
1304             /// <summary>
1305             /// Whether the view's layout direction property has changed or a parent's.
1306             /// </summary>
1307             /// <since_tizen> 4 </since_tizen>
1308             public ViewLayoutDirectionType Type
1309             {
1310                 get
1311                 {
1312                     return _type;
1313                 }
1314                 set
1315                 {
1316                     _type = value;
1317                 }
1318             }
1319         }
1320
1321         internal class BackgroundResourceLoadedEventArgs : EventArgs
1322         {
1323             private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
1324             public ResourceLoadingStatusType Status
1325             {
1326                 get
1327                 {
1328                     return status;
1329                 }
1330                 set
1331                 {
1332                     status = value;
1333                 }
1334             }
1335         }
1336
1337         /// <summary>
1338         /// The class represents the information of the situation where the View's control state changes.
1339         /// </summary>
1340         [EditorBrowsable(EditorBrowsableState.Never)]
1341         public class ControlStateChangedEventArgs : EventArgs
1342         {
1343             /// <summary>
1344             /// Create an instance with mandatory fields.
1345             /// </summary>
1346             /// <param name="previousState">The previous control state.</param>
1347             /// <param name="currentState">The current control state.</param>
1348             [EditorBrowsable(EditorBrowsableState.Never)]
1349             public ControlStateChangedEventArgs(ControlState previousState, ControlState currentState)
1350             {
1351                 PreviousState = previousState;
1352                 CurrentState = currentState;
1353             }
1354
1355             /// <summary>
1356             /// The previous control state.
1357             /// </summary>
1358             [EditorBrowsable(EditorBrowsableState.Never)]
1359             public ControlState PreviousState { get; }
1360
1361             /// <summary>
1362             /// The current control state.
1363             /// </summary>
1364             [EditorBrowsable(EditorBrowsableState.Never)]
1365             public ControlState CurrentState { get; }
1366         }
1367
1368         /// <summary>
1369         /// The expanded touch area.
1370         /// TouchArea can expand the view's touchable area.<br/>
1371         /// 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/>
1372         /// </summary>
1373         /// <remarks>
1374         /// This is based on the top left x, y coordinates.<br/>
1375         /// For example) <br/>
1376         /// <code>
1377         ///  view.Size = new Size(100, 100);
1378         ///  view.TouchAreaOffset = new Offset(-10, 20, 30, -40); // left, right, bottom, top
1379         /// </code>
1380         /// Then, touch area is 130x170.<br/>
1381         /// This is view.width + TouchAreaOffset.right - TouchAreaOffset.left and view.height + TouchAreaOffset.bottom - TouchAreaOffset.top <br/>
1382         /// +---------------------+ <br/>
1383         /// |         ^           | <br/>
1384         /// |         |           | <br/>
1385         /// |         | -40       | <br/>
1386         /// |         |           | <br/>
1387         /// |         |           | <br/>
1388         /// |    +----+----+      | <br/>
1389         /// |    |         |      | <br/>
1390         /// | -10|         | 20   | <br/>
1391         /// |&lt;---+         +-----&gt;| <br/>
1392         /// |    |         |      | <br/>
1393         /// |    |         |      | <br/>
1394         /// |    +----+----+      | <br/>
1395         /// |         |           | <br/>
1396         /// |         | 30        | <br/>
1397         /// |         |           | <br/>
1398         /// |         v           | <br/>
1399         /// +---------------------+ <br/>
1400         /// </remarks>
1401         [EditorBrowsable(EditorBrowsableState.Never)]
1402         public Offset TouchAreaOffset
1403         {
1404             get
1405             {
1406                 return (Offset)GetValue(TouchAreaOffsetProperty);
1407             }
1408             set
1409             {
1410                 SetValue(TouchAreaOffsetProperty, value);
1411                 NotifyPropertyChanged();
1412             }
1413         }
1414
1415         private Offset InternalTouchAreaOffset
1416         {
1417             get
1418             {
1419                 Interop.ActorInternal.GetTouchAreaOffset(SwigCPtr, out int left, out int right, out int bottom, out int top);
1420                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1421                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1422                 return new Offset(left, right, bottom, top);
1423             }
1424             set
1425             {
1426                 Interop.ActorInternal.SetTouchAreaOffset(SwigCPtr, value.Left, value.Right, value.Bottom, value.Top);
1427                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1428                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1429             }
1430         }
1431
1432     }
1433 }