a9814e2194c5e80fa2382bee808241c831d0bb36
[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> interceptWheelHandler;
33         private WheelEventCallbackType interceptWheelCallback;
34         private EventHandlerWithReturnType<object, WheelEventArgs, bool> wheelEventHandler;
35         private WheelEventCallbackType wheelEventCallback;
36         private EventHandlerWithReturnType<object, KeyEventArgs, bool> keyEventHandler;
37         private KeyCallbackType keyCallback;
38         private EventHandlerWithReturnType<object, TouchEventArgs, bool> interceptTouchDataEventHandler;
39         private TouchDataCallbackType interceptTouchDataCallback;
40         private EventHandlerWithReturnType<object, TouchEventArgs, bool> touchDataEventHandler;
41         private TouchDataCallbackType touchDataCallback;
42         private EventHandlerWithReturnType<object, HoverEventArgs, bool> hoverEventHandler;
43         private HoverEventCallbackType hoverEventCallback;
44         private EventHandler<VisibilityChangedEventArgs> visibilityChangedEventHandler;
45         private VisibilityChangedEventCallbackType visibilityChangedEventCallback;
46         private EventHandler keyInputFocusGainedEventHandler;
47
48         private KeyInputFocusGainedCallbackType keyInputFocusGainedCallback;
49         private EventHandler keyInputFocusLostEventHandler;
50
51         private KeyInputFocusLostCallbackType keyInputFocusLostCallback;
52         private EventHandler onRelayoutEventHandler;
53         private OnRelayoutEventCallbackType onRelayoutEventCallback;
54         private EventHandler onWindowEventHandler;
55         private OnWindowEventCallbackType onWindowEventCallback;
56         private EventHandler<LayoutDirectionChangedEventArgs> layoutDirectionChangedEventHandler;
57         private LayoutDirectionChangedEventCallbackType layoutDirectionChangedEventCallback;
58         // Resource Ready Signal
59         private EventHandler resourcesLoadedEventHandler;
60         private ResourcesLoadedCallbackType resourcesLoadedCallback;
61         private EventHandler<BackgroundResourceLoadedEventArgs> backgroundResourceLoadedEventHandler;
62         private _backgroundResourceLoadedCallbackType backgroundResourceLoadedCallback;
63         private TouchDataCallbackType hitTestResultDataCallback;
64
65         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
66         private delegate void OffWindowEventCallbackType(IntPtr control);
67         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
68         private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
69         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
70         private delegate bool KeyCallbackType(IntPtr control, IntPtr keyEvent);
71         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
72         private delegate bool TouchDataCallbackType(IntPtr view, IntPtr touchData);
73         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
74         private delegate bool HoverEventCallbackType(IntPtr view, IntPtr hoverEvent);
75         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
76         private delegate void VisibilityChangedEventCallbackType(IntPtr data, bool visibility, VisibilityChangeType type);
77         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
78         private delegate void ResourcesLoadedCallbackType(IntPtr control);
79         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
80         private delegate void _backgroundResourceLoadedCallbackType(IntPtr view);
81
82         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
83         private delegate void KeyInputFocusGainedCallbackType(IntPtr control);
84         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
85         private delegate void KeyInputFocusLostCallbackType(IntPtr control);
86
87         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
88         private delegate void OnRelayoutEventCallbackType(IntPtr control);
89         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
90         private delegate void OnWindowEventCallbackType(IntPtr control);
91         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
92         private delegate void LayoutDirectionChangedEventCallbackType(IntPtr data, ViewLayoutDirectionType type);
93
94         // List of dispatch Event
95         private PanGestureDetector panGestureDetector = null;
96         private LongPressGestureDetector longGestureDetector = null;
97         private PinchGestureDetector pinchGestureDetector = null;
98         private TapGestureDetector tapGestureDetector = null;
99         private RotationGestureDetector rotationGestureDetector = null;
100         private int configGestureCount = 0;
101         private bool dispatchTouchEvents = true;
102         private bool dispatchParentTouchEvents = true;
103         private bool dispatchHoverEvents = true;
104         private bool dispatchParentHoverEvents = true;
105         private bool dispatchWheelEvents = true;
106         private bool dispatchParentWheelEvents = true;
107         private bool dispatchGestureEvents = true;
108         private bool dispatchParentGestureEvents = true;
109
110
111         /// <summary>
112         /// Event when a child is removed.
113         /// </summary>
114         /// <since_tizen> 5 </since_tizen>
115         public event EventHandler<ChildRemovedEventArgs> ChildRemoved;
116         /// <summary>
117         /// Event when a child is added.
118         /// </summary>
119         /// <since_tizen> 5 </since_tizen>
120         public event EventHandler<ChildAddedEventArgs> ChildAdded;
121
122         /// <summary>
123         /// An event for the KeyInputFocusGained signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
124         /// The KeyInputFocusGained signal is emitted when the control gets the key input focus.<br />
125         /// </summary>
126         /// <since_tizen> 3 </since_tizen>
127         public event EventHandler FocusGained
128         {
129             add
130             {
131                 if (keyInputFocusGainedEventHandler == null)
132                 {
133                     keyInputFocusGainedCallback = OnKeyInputFocusGained;
134                     Interop.ViewSignal.KeyInputFocusGainedConnect(SwigCPtr, keyInputFocusGainedCallback.ToHandleRef(this));
135                     NDalicPINVOKE.ThrowExceptionIfExists();
136                 }
137                 keyInputFocusGainedEventHandler += value;
138             }
139
140             remove
141             {
142                 keyInputFocusGainedEventHandler -= value;
143                 if (keyInputFocusGainedEventHandler == null && keyInputFocusGainedCallback != null)
144                 {
145                     Interop.ViewSignal.KeyInputFocusGainedDisconnect(SwigCPtr, keyInputFocusGainedCallback.ToHandleRef(this));
146                     NDalicPINVOKE.ThrowExceptionIfExists();
147                     keyInputFocusGainedCallback = null;
148                 }
149             }
150         }
151
152         /// <summary>
153         /// An event for the KeyInputFocusLost signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
154         /// The KeyInputFocusLost signal is emitted when the control loses the key input focus.<br />
155         /// </summary>
156         /// <since_tizen> 3 </since_tizen>
157         public event EventHandler FocusLost
158         {
159             add
160             {
161                 if (keyInputFocusLostEventHandler == null)
162                 {
163                     keyInputFocusLostCallback = OnKeyInputFocusLost;
164                     Interop.ViewSignal.KeyInputFocusLostConnect(SwigCPtr, keyInputFocusLostCallback.ToHandleRef(this));
165                     NDalicPINVOKE.ThrowExceptionIfExists();
166                 }
167                 keyInputFocusLostEventHandler += value;
168             }
169
170             remove
171             {
172                 keyInputFocusLostEventHandler -= value;
173                 if (keyInputFocusLostEventHandler == null && keyInputFocusLostCallback != null)
174                 {
175                     Interop.ViewSignal.KeyInputFocusLostDisconnect(SwigCPtr, keyInputFocusLostCallback.ToHandleRef(this));
176                     NDalicPINVOKE.ThrowExceptionIfExists();
177                     keyInputFocusLostCallback = null;
178                 }
179             }
180         }
181
182         /// <summary>
183         /// An event for the KeyPressed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
184         /// The KeyPressed signal is emitted when the key event is received.<br />
185         /// </summary>
186         /// <since_tizen> 3 </since_tizen>
187         public event EventHandlerWithReturnType<object, KeyEventArgs, bool> KeyEvent
188         {
189             add
190             {
191                 if (keyEventHandler == null)
192                 {
193                     keyCallback = OnKeyEvent;
194                     Interop.ViewSignal.KeyEventConnect(SwigCPtr, keyCallback.ToHandleRef(this));
195                     NDalicPINVOKE.ThrowExceptionIfExists();
196                 }
197                 keyEventHandler += value;
198             }
199
200             remove
201             {
202                 keyEventHandler -= value;
203                 if (keyEventHandler == null && keyCallback != null)
204                 {
205                     Interop.ViewSignal.KeyEventDisconnect(SwigCPtr, keyCallback.ToHandleRef(this));
206                     NDalicPINVOKE.ThrowExceptionIfExists();
207                     keyCallback = null;
208                 }
209             }
210         }
211
212         /// <summary>
213         /// An event for the OnRelayout signal which can be used to subscribe or unsubscribe the event handler.<br />
214         /// The OnRelayout signal is emitted after the size has been set on the view during relayout.<br />
215         /// </summary>
216         /// <since_tizen> 3 </since_tizen>
217         public event EventHandler Relayout
218         {
219             add
220             {
221                 if (onRelayoutEventHandler == null)
222                 {
223                     onRelayoutEventCallback = OnRelayout;
224                     Interop.ActorSignal.OnRelayoutConnect(SwigCPtr, onRelayoutEventCallback.ToHandleRef(this));
225                     NDalicPINVOKE.ThrowExceptionIfExists();
226                 }
227                 onRelayoutEventHandler += value;
228             }
229
230             remove
231             {
232                 onRelayoutEventHandler -= value;
233                 if (onRelayoutEventHandler == null && onRelayoutEventCallback != null)
234                 {
235                     Interop.ActorSignal.OnRelayoutDisconnect(SwigCPtr, onRelayoutEventCallback.ToHandleRef(this));
236                     NDalicPINVOKE.ThrowExceptionIfExists();
237                     onRelayoutEventCallback = null;
238                 }
239             }
240         }
241
242         /// <summary>
243         /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
244         /// The touched signal is emitted when the touch input is received.<br />
245         /// This can receive touch events before child. <br />
246         /// 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 />
247         /// </summary>
248         [EditorBrowsable(EditorBrowsableState.Never)]
249         public event EventHandlerWithReturnType<object, TouchEventArgs, bool> InterceptTouchEvent
250         {
251             add
252             {
253                 if (interceptTouchDataEventHandler == null)
254                 {
255                     interceptTouchDataCallback = OnInterceptTouch;
256                     Interop.ActorSignal.InterceptTouchConnect(SwigCPtr, interceptTouchDataCallback.ToHandleRef(this));
257                     NDalicPINVOKE.ThrowExceptionIfExists();
258                 }
259                 interceptTouchDataEventHandler += value;
260             }
261
262             remove
263             {
264                 interceptTouchDataEventHandler -= value;
265                 if (interceptTouchDataEventHandler == null && interceptTouchDataCallback != null)
266                 {
267                     Interop.ActorSignal.InterceptTouchDisconnect(SwigCPtr, interceptTouchDataCallback.ToHandleRef(this));
268                     NDalicPINVOKE.ThrowExceptionIfExists();
269                     interceptTouchDataCallback = null;
270                 }
271             }
272         }
273
274         /// <summary>
275         /// If child view doesn't want the parent's view to intercept the touch, you can set it to true.
276         /// for example :
277         ///    parent.Add(child);
278         ///    parent.InterceptTouchEvent += OnInterceptTouchEvent;
279         ///    View view = child.GetParent() as View;
280         ///    view.DisallowInterceptTouchEvent = true;
281         ///  This prevents the parent from intercepting touch.
282         /// </summary>
283         [EditorBrowsable(EditorBrowsableState.Never)]
284         public bool DisallowInterceptTouchEvent { get; set; }
285
286
287         /// <summary>
288         /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
289         /// The touched signal is emitted when the touch input is received.<br />
290         /// </summary>
291         /// <since_tizen> 3 </since_tizen>
292         public event EventHandlerWithReturnType<object, TouchEventArgs, bool> TouchEvent
293         {
294             add
295             {
296                 if (touchDataEventHandler == null)
297                 {
298                     touchDataCallback = OnTouch;
299                     Interop.ActorSignal.TouchConnect(SwigCPtr, touchDataCallback.ToHandleRef(this));
300                     NDalicPINVOKE.ThrowExceptionIfExists();
301                 }
302                 touchDataEventHandler += value;
303             }
304
305             remove
306             {
307                 touchDataEventHandler -= value;
308                 if (touchDataEventHandler == null && touchDataCallback != null)
309                 {
310                     Interop.ActorSignal.TouchDisconnect(SwigCPtr, touchDataCallback.ToHandleRef(this));
311                     NDalicPINVOKE.ThrowExceptionIfExists();
312                     touchDataCallback = null;
313                 }
314             }
315         }
316
317         /// <summary>
318         /// An event for the hovered signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
319         /// The hovered signal is emitted when the hover input is received.<br />
320         /// </summary>
321         /// <since_tizen> 3 </since_tizen>
322         public event EventHandlerWithReturnType<object, HoverEventArgs, bool> HoverEvent
323         {
324             add
325             {
326                 if (hoverEventHandler == null)
327                 {
328                     hoverEventCallback = OnHoverEvent;
329                     Interop.ActorSignal.HoveredConnect(SwigCPtr, hoverEventCallback.ToHandleRef(this));
330                     NDalicPINVOKE.ThrowExceptionIfExists();
331                 }
332                 hoverEventHandler += value;
333             }
334
335             remove
336             {
337                 hoverEventHandler -= value;
338                 if (hoverEventHandler == null && hoverEventCallback != null)
339                 {
340                     Interop.ActorSignal.HoveredDisconnect(SwigCPtr, hoverEventCallback.ToHandleRef(this));
341                     NDalicPINVOKE.ThrowExceptionIfExists();
342                     hoverEventCallback = null;
343                 }
344             }
345         }
346
347         /// <summary>
348         /// An event for the wheel which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
349         /// The wheel event is emitted when the wheel input is received.<br />
350         /// This can receive wheel events before child. <br />
351         /// 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 />
352         /// </summary>
353         [EditorBrowsable(EditorBrowsableState.Never)]
354         public event EventHandlerWithReturnType<object, WheelEventArgs, bool> InterceptWheelEvent
355         {
356             add
357             {
358                 if (interceptWheelHandler == null)
359                 {
360                     interceptWheelCallback = OnInterceptWheel;
361                     Interop.ActorSignal.InterceptWheelConnect(SwigCPtr, interceptWheelCallback.ToHandleRef(this));
362                     NDalicPINVOKE.ThrowExceptionIfExists();
363                 }
364                 interceptWheelHandler += value;
365             }
366
367             remove
368             {
369                 interceptWheelHandler -= value;
370                 if (interceptWheelHandler == null && interceptWheelCallback != null)
371                 {
372                     Interop.ActorSignal.InterceptWheelDisconnect(SwigCPtr, interceptWheelCallback.ToHandleRef(this));
373                     NDalicPINVOKE.ThrowExceptionIfExists();
374                     interceptWheelCallback = null;
375                 }
376             }
377         }
378
379         /// <summary>
380         /// If child view doesn't want the parent's view to intercept the wheel event, you can set it to true.
381         /// for example :
382         ///    parent.Add(child);
383         ///    parent.InterceptWheelEvent += OnInterceptWheelEvent;
384         ///    View view = child.GetParent() as View;
385         ///    view.DisallowInterceptWheelEvent = true;
386         ///  This prevents the parent from intercepting wheel event.
387         /// </summary>
388         [EditorBrowsable(EditorBrowsableState.Never)]
389         public bool DisallowInterceptWheelEvent { get; set; }
390
391         /// <summary>
392         /// An event for the WheelMoved signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
393         /// The WheelMoved signal is emitted when the wheel event is received.<br />
394         /// </summary>
395         /// <since_tizen> 3 </since_tizen>
396         public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelEvent
397         {
398             add
399             {
400                 if (wheelEventHandler == null)
401                 {
402                     wheelEventCallback = OnWheelEvent;
403                     Interop.ActorSignal.WheelEventConnect(SwigCPtr, wheelEventCallback.ToHandleRef(this));
404                     NDalicPINVOKE.ThrowExceptionIfExists();
405                 }
406                 wheelEventHandler += value;
407             }
408
409             remove
410             {
411                 wheelEventHandler -= value;
412                 if (wheelEventHandler == null && wheelEventCallback != null)
413                 {
414                     Interop.ActorSignal.WheelEventDisconnect(SwigCPtr, wheelEventCallback.ToHandleRef(this));
415                     NDalicPINVOKE.ThrowExceptionIfExists();
416                     wheelEventCallback = null;
417                 }
418             }
419         }
420
421         /// <summary>
422         /// An event for the OnWindow signal which can be used to subscribe or unsubscribe the event handler.<br />
423         /// The OnWindow signal is emitted after the view has been connected to the window.<br />
424         /// </summary>
425         /// <since_tizen> 3 </since_tizen>
426         public event EventHandler AddedToWindow
427         {
428             add
429             {
430                 if (onWindowEventHandler == null)
431                 {
432                     onWindowEventCallback = OnWindow;
433                     Interop.ActorSignal.OnSceneConnect(SwigCPtr, onWindowEventCallback.ToHandleRef(this));
434                     NDalicPINVOKE.ThrowExceptionIfExists();
435                 }
436                 onWindowEventHandler += value;
437             }
438
439             remove
440             {
441                 onWindowEventHandler -= value;
442                 if (onWindowEventHandler == null && onWindowEventCallback != null)
443                 {
444                     Interop.ActorSignal.OnSceneDisconnect(SwigCPtr, onWindowEventCallback.ToHandleRef(this));
445                     NDalicPINVOKE.ThrowExceptionIfExists();
446                     onWindowEventCallback = null;
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                     Interop.ActorSignal.OffSceneConnect(SwigCPtr, offWindowEventCallback.ToHandleRef(this));
464                     NDalicPINVOKE.ThrowExceptionIfExists();
465                 }
466                 offWindowEventHandler += value;
467             }
468
469             remove
470             {
471                 offWindowEventHandler -= value;
472                 if (offWindowEventHandler == null && offWindowEventCallback != null)
473                 {
474                     Interop.ActorSignal.OffSceneDisconnect(SwigCPtr, offWindowEventCallback.ToHandleRef(this));
475                     NDalicPINVOKE.ThrowExceptionIfExists();
476                     offWindowEventCallback = null;
477                 }
478             }
479         }
480         /// <summary>
481         /// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
482         /// This event is sent when the visibility of this or a parent view is changed.<br />
483         /// </summary>
484         /// <remarks>
485         /// <para>
486         /// When VisibilityChangedEventArgs.Type is SELF, VisibilityChangedEventArgs.Visibility is true means this View's Visibility property is true.
487         /// When VisibilityChangedEventArgs.Type is PARENT, VisibilityChangedEventArgs.Visibility is true means a parent's Visibility property has changed to true.
488         /// </para>
489         /// <para>
490         /// This event is NOT sent if the view becomes transparent (or the reverse), it's ONLY linked with View.Show() and View.Hide().
491         /// 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.
492         /// So if its parent is not visible, the view is not shown even though VisibilityChangedEventArgs.Type is SELF and VisibilityChangedEventArgs.Visibility is true.
493         /// </para>
494         /// </remarks>
495         /// <since_tizen> 3 </since_tizen>
496         public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
497         {
498             add
499             {
500                 if (visibilityChangedEventHandler == null)
501                 {
502                     visibilityChangedEventCallback = OnVisibilityChanged;
503                     Interop.ActorSignal.VisibilityChangedConnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
504                     NDalicPINVOKE.ThrowExceptionIfExists();
505                 }
506                 visibilityChangedEventHandler += value;
507             }
508
509             remove
510             {
511                 visibilityChangedEventHandler -= value;
512                 if (visibilityChangedEventHandler == null && visibilityChangedEventCallback != null)
513                 {
514                     Interop.ActorSignal.VisibilityChangedDisconnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
515                     NDalicPINVOKE.ThrowExceptionIfExists();
516                     visibilityChangedEventCallback = null;
517                 }
518             }
519         }
520
521         /// <summary>
522         /// Event for layout direction change which can be used to subscribe/unsubscribe the event handler.<br />
523         /// This signal is emitted when the layout direction property of this or a parent view is changed.<br />
524         /// </summary>
525         /// <since_tizen> 4 </since_tizen>
526         public event EventHandler<LayoutDirectionChangedEventArgs> LayoutDirectionChanged
527         {
528             add
529             {
530                 if (layoutDirectionChangedEventHandler == null)
531                 {
532                     layoutDirectionChangedEventCallback = OnLayoutDirectionChanged;
533                     Interop.ActorSignal.LayoutDirectionChangedConnect(SwigCPtr, layoutDirectionChangedEventCallback.ToHandleRef(this));
534                     NDalicPINVOKE.ThrowExceptionIfExists();
535                 }
536
537                 layoutDirectionChangedEventHandler += value;
538             }
539
540             remove
541             {
542                 layoutDirectionChangedEventHandler -= value;
543
544                 if (layoutDirectionChangedEventHandler == null && layoutDirectionChangedEventCallback != null)
545                 {
546                     Interop.ActorSignal.LayoutDirectionChangedDisconnect(SwigCPtr, layoutDirectionChangedEventCallback.ToHandleRef(this));
547                     NDalicPINVOKE.ThrowExceptionIfExists();
548                     layoutDirectionChangedEventCallback = null;
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                     Interop.ViewSignal.ResourceReadyConnect(SwigCPtr, resourcesLoadedCallback.ToHandleRef(this));
566                     NDalicPINVOKE.ThrowExceptionIfExists();
567                 }
568                 resourcesLoadedEventHandler += value;
569             }
570
571             remove
572             {
573                 resourcesLoadedEventHandler -= value;
574                 if (resourcesLoadedEventHandler == null && resourcesLoadedCallback != null)
575                 {
576                     Interop.ViewSignal.ResourceReadyDisconnect(SwigCPtr, resourcesLoadedCallback.ToHandleRef(this));
577                     NDalicPINVOKE.ThrowExceptionIfExists();
578                     resourcesLoadedCallback = null;
579                 }
580             }
581         }
582
583         private EventHandler _backKeyPressed;
584
585         /// <summary>
586         /// An event for getting notice when physical back key is pressed.<br />
587         /// This event is emitted BackKey is up.<br />
588         /// </summary>
589         [EditorBrowsable(EditorBrowsableState.Never)]
590         public event EventHandler BackKeyPressed
591         {
592             add
593             {
594                 _backKeyPressed += value;
595                 BackKeyManager.Instance.Subscriber.Add(this);
596             }
597
598             remove
599             {
600                 BackKeyManager.Instance.Subscriber.Remove(this);
601                 _backKeyPressed -= value;
602             }
603         }
604
605         /// <summary>
606         /// Function for emitting BackKeyPressed event outside of View instance
607         /// </summary>
608         [EditorBrowsable(EditorBrowsableState.Never)]
609         internal void EmitBackKeyPressed()
610         {
611             _backKeyPressed.Invoke(this, null);
612         }
613
614
615         internal event EventHandler<BackgroundResourceLoadedEventArgs> BackgroundResourceLoaded
616         {
617             add
618             {
619                 if (backgroundResourceLoadedEventHandler == null)
620                 {
621                     backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
622                     Interop.ViewSignal.ResourceReadyConnect(SwigCPtr, backgroundResourceLoadedCallback.ToHandleRef(this));
623                     NDalicPINVOKE.ThrowExceptionIfExists();
624                 }
625                 backgroundResourceLoadedEventHandler += value;
626             }
627
628             remove
629             {
630                 backgroundResourceLoadedEventHandler -= value;
631                 if (backgroundResourceLoadedEventHandler == null && backgroundResourceLoadedCallback != null)
632                 {
633                     Interop.ViewSignal.ResourceReadyDisconnect(SwigCPtr, backgroundResourceLoadedCallback.ToHandleRef(this));
634                     NDalicPINVOKE.ThrowExceptionIfExists();
635                     backgroundResourceLoadedCallback = null;
636                 }
637             }
638         }
639
640         private void OnColorChanged(float r, float g, float b, float a)
641         {
642             Color = new Color(r, g, b, a);
643         }
644
645         private void OnMinimumSizeChanged(int width, int height)
646         {
647             MinimumSize = new Size2D(width, height);
648         }
649
650         private void OnMaximumSizeChanged(int width, int height)
651         {
652             MaximumSize = new Size2D(width, height);
653         }
654
655         private void OnPosition2DChanged(int x, int y)
656         {
657             SetPosition((float)x, (float)y, 0);
658         }
659
660         private void OnPositionChanged(float x, float y, float z)
661         {
662             SetPosition(x, y, z);
663         }
664
665         private void OnSize2DChanged(int width, int height)
666         {
667             SetSize((float)width, (float)height, 0);
668         }
669
670         private void OnSizeChanged(float width, float height, float depth)
671         {
672             SetSize(width, height, depth);
673         }
674
675         private void OnParentOriginChanged(float x, float y, float z)
676         {
677             ParentOrigin = new Position(x, y, z);
678         }
679
680         private void OnPivotPointChanged(float x, float y, float z)
681         {
682             PivotPoint = new Position(x, y, z);
683         }
684
685         private void OnImageShadowChanged(ShadowBase instance)
686         {
687             ImageShadow = (ImageShadow)instance;
688         }
689
690         private void OnBoxShadowChanged(ShadowBase instance)
691         {
692             BoxShadow = (Shadow)instance;
693         }
694
695         private void OnBackgroundImageBorderChanged(int left, int right, int bottom, int top)
696         {
697             BackgroundImageBorder = new Rectangle(left, right, bottom, top);
698         }
699
700         private void OnKeyInputFocusGained(IntPtr view)
701         {
702             if (IsNativeHandleInvalid())
703             {
704                 if (this.Disposed)
705                 {
706                     if (keyInputFocusGainedEventHandler != null)
707                     {
708                         using var process = global::System.Diagnostics.Process.GetCurrentProcess();
709                         var processId = process.Id;
710                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
711                         var me = this.GetType().FullName;
712
713                         throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
714                             $"OR the native dali object handle of NUI becomes null! \n" +
715                             $" process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
716                     }
717                 }
718                 else
719                 {
720                     if (this.IsDisposeQueued)
721                     {
722                         using var process = global::System.Diagnostics.Process.GetCurrentProcess();
723                         var processId = process.Id;
724                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
725                         var me = this.GetType().FullName;
726
727                         //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
728                         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" +
729                             $"process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
730                         return;
731                     }
732                 }
733             }
734
735             keyInputFocusGainedEventHandler?.Invoke(this, null);
736         }
737
738         private void OnKeyInputFocusLost(IntPtr view)
739         {
740             if (IsNativeHandleInvalid())
741             {
742                 if (this.Disposed)
743                 {
744                     if (keyInputFocusLostEventHandler != null)
745                     {
746                         using var process = global::System.Diagnostics.Process.GetCurrentProcess();
747                         var processId = process.Id;
748                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
749                         var me = this.GetType().FullName;
750
751                         throw new ObjectDisposedException(nameof(SwigCPtr), $"Error! NUI's native dali object is already disposed. " +
752                             $"OR the native dali object handle of NUI becomes null! \n" +
753                             $" process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
754                     }
755                 }
756                 else
757                 {
758                     if (this.IsDisposeQueued)
759                     {
760                         using var process = global::System.Diagnostics.Process.GetCurrentProcess();
761                         var processId = process.Id;
762                         var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
763                         var me = this.GetType().FullName;
764
765                         //in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked!
766                         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" +
767                             $"process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n");
768                         return;
769                     }
770                 }
771             }
772
773             keyInputFocusLostEventHandler?.Invoke(this, null);
774         }
775
776         private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
777         {
778             if (keyEvent == global::System.IntPtr.Zero)
779             {
780                 NUILog.Error("keyEvent should not be null!");
781                 return true;
782             }
783
784             KeyEventArgs e = new KeyEventArgs();
785
786             bool result = false;
787
788             e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent);
789
790             if (keyEventHandler != null)
791             {
792                 Delegate[] delegateList = keyEventHandler.GetInvocationList();
793
794                 // Oring the result of each callback.
795                 foreach (EventHandlerWithReturnType<object, KeyEventArgs, bool> del in delegateList)
796                 {
797                     result |= del(this, e);
798                 }
799             }
800
801             return result;
802         }
803
804         // Callback for View OnRelayout signal
805         private void OnRelayout(IntPtr data)
806         {
807             if (onRelayoutEventHandler != null)
808             {
809                 onRelayoutEventHandler(this, null);
810             }
811         }
812
813         // Callback for View HitTestResultSignal
814         private bool OnHitTestResult(IntPtr view, IntPtr touchData)
815         {
816             if (touchData == global::System.IntPtr.Zero)
817             {
818                 NUILog.Error("touchData should not be null!");
819                 return true;
820             }
821
822             TouchEventArgs e = new TouchEventArgs();
823             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
824             return HitTest(e.Touch);
825         }
826
827         // Callback for View TouchSignal
828         private bool OnInterceptTouch(IntPtr view, IntPtr touchData)
829         {
830             if (touchData == global::System.IntPtr.Zero)
831             {
832                 NUILog.Error("touchData should not be null!");
833                 return true;
834             }
835
836             // DisallowInterceptTouchEvent prevents the parent from intercepting touch.
837             if (DisallowInterceptTouchEvent)
838             {
839                 return false;
840             }
841
842             TouchEventArgs e = new TouchEventArgs();
843             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
844
845             bool consumed = false;
846
847             if (interceptTouchDataEventHandler != null)
848             {
849                 consumed = interceptTouchDataEventHandler(this, e);
850             }
851
852             return consumed;
853         }
854
855         // Callback for View TouchSignal
856         private bool OnTouch(IntPtr view, IntPtr touchData)
857         {
858             if (touchData == global::System.IntPtr.Zero)
859             {
860                 NUILog.Error("touchData should not be null!");
861                 return true;
862             }
863
864             if (DispatchTouchEvents == false)
865             {
866                 NUILog.Debug("If DispatchTouchEvents is false, it can not dispatch.");
867                 return true;
868             }
869
870             TouchEventArgs e = new TouchEventArgs();
871             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
872
873             bool consumed = false;
874
875             if (touchDataEventHandler != null)
876             {
877                 consumed = touchDataEventHandler(this, e);
878             }
879
880             if (enableControlState && !consumed)
881             {
882                 consumed = HandleControlStateOnTouch(e.Touch);
883             }
884
885             if (DispatchParentTouchEvents == false)
886             {
887                 NUILog.Debug("If DispatchParentTouchEvents is false, it can not dispatch to parent.");
888                 return true;
889             }
890
891             return consumed;
892         }
893
894         // Callback for View Hover signal
895         private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
896         {
897             if (hoverEvent == global::System.IntPtr.Zero)
898             {
899                 NUILog.Error("hoverEvent should not be null!");
900                 return true;
901             }
902
903             if (DispatchHoverEvents == false)
904             {
905                 NUILog.Debug("If DispatchHoverEvents is false, it can not dispatch.");
906                 return true;
907             }
908
909             HoverEventArgs e = new HoverEventArgs();
910             e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);
911
912             bool consumed = false;
913
914             if (hoverEventHandler != null)
915             {
916                 consumed = hoverEventHandler(this, e);
917             }
918
919             if (DispatchParentHoverEvents == false && consumed == false)
920             {
921                 NUILog.Debug("If DispatchParentHoverEvents is false, it can not dispatch to parent.");
922                 return true;
923             }
924
925             return consumed;
926         }
927
928         // Callback for View InterceptWheel signal
929         private bool OnInterceptWheel(IntPtr view, IntPtr wheelEvent)
930         {
931             if (wheelEvent == global::System.IntPtr.Zero)
932             {
933                 NUILog.Error("wheelEvent should not be null!");
934                 return true;
935             }
936
937             // DisallowInterceptWheelEvent prevents the parent from intercepting wheel.
938             if (DisallowInterceptWheelEvent)
939             {
940                 return false;
941             }
942
943             WheelEventArgs e = new WheelEventArgs();
944
945             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
946
947             bool consumed = false;
948
949             if (interceptWheelHandler != null)
950             {
951                 consumed = interceptWheelHandler(this, e);
952             }
953
954             return consumed;
955         }
956
957         // Callback for View Wheel signal
958         private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
959         {
960             if (wheelEvent == global::System.IntPtr.Zero)
961             {
962                 NUILog.Error("wheelEvent should not be null!");
963                 return true;
964             }
965
966             if (DispatchWheelEvents == false)
967             {
968                 NUILog.Debug("If DispatchWheelEvents is false, it can not dispatch.");
969                 return true;
970             }
971
972             WheelEventArgs e = new WheelEventArgs();
973
974             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
975
976             bool consumed = false;
977
978             if (wheelEventHandler != null)
979             {
980                 consumed = wheelEventHandler(this, e);
981             }
982
983             if (DispatchParentWheelEvents == false && consumed == false)
984             {
985                 NUILog.Debug("If DispatchParentWheelEvents is false, it can not dispatch to parent.");
986                 return true;
987             }
988
989             return consumed;
990         }
991
992         // Callback for View OnWindow signal
993         private void OnWindow(IntPtr data)
994         {
995             if (onWindowEventHandler != null)
996             {
997                 onWindowEventHandler(this, null);
998             }
999         }
1000
1001         // Callback for View OffWindow signal
1002         private void OffWindow(IntPtr data)
1003         {
1004             if (offWindowEventHandler != null)
1005             {
1006                 offWindowEventHandler(this, null);
1007             }
1008         }
1009
1010         // Callback for View visibility change signal
1011         private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type)
1012         {
1013             VisibilityChangedEventArgs e = new VisibilityChangedEventArgs();
1014             if (data != IntPtr.Zero)
1015             {
1016                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1017             }
1018             e.Visibility = visibility;
1019             e.Type = type;
1020
1021             if (visibilityChangedEventHandler != null)
1022             {
1023                 visibilityChangedEventHandler(this, e);
1024             }
1025         }
1026
1027         // Callback for View layout direction change signal
1028         private void OnLayoutDirectionChanged(IntPtr data, ViewLayoutDirectionType type)
1029         {
1030             LayoutDirectionChangedEventArgs e = new LayoutDirectionChangedEventArgs();
1031             if (data != IntPtr.Zero)
1032             {
1033                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1034             }
1035             e.Type = type;
1036
1037             if (layoutDirectionChangedEventHandler != null)
1038             {
1039                 layoutDirectionChangedEventHandler(this, e);
1040             }
1041         }
1042
1043         private void OnResourcesLoaded(IntPtr view)
1044         {
1045             if(!CheckResourceReady())
1046             {
1047                 return;
1048             }
1049
1050             if (resourcesLoadedEventHandler != null)
1051             {
1052                 resourcesLoadedEventHandler(this, null);
1053             }
1054         }
1055
1056         private void OnBackgroundResourceLoaded(IntPtr view)
1057         {
1058             BackgroundResourceLoadedEventArgs e = new BackgroundResourceLoadedEventArgs();
1059             e.Status = (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1060
1061             if (backgroundResourceLoadedEventHandler != null)
1062             {
1063                 backgroundResourceLoadedEventHandler(this, e);
1064             }
1065         }
1066
1067         /// <summary>
1068         /// Event argument passed through the ChildAdded event.
1069         /// </summary>
1070         /// <since_tizen> 5 </since_tizen>
1071         public class ChildAddedEventArgs : EventArgs
1072         {
1073             /// <summary>
1074             /// Added child view at moment.
1075             /// </summary>
1076             /// <since_tizen> 5 </since_tizen>
1077             public View Added { get; set; }
1078         }
1079
1080         /// <summary>
1081         /// Event argument passed through the ChildRemoved event.
1082         /// </summary>
1083         /// <since_tizen> 5 </since_tizen>
1084         public class ChildRemovedEventArgs : EventArgs
1085         {
1086             /// <summary>
1087             /// Removed child view at moment.
1088             /// </summary>
1089             /// <since_tizen> 5 </since_tizen>
1090             public View Removed { get; set; }
1091         }
1092
1093         /// <summary>
1094         /// Event arguments that passed via the KeyEvent signal.
1095         /// </summary>
1096         /// <since_tizen> 3 </since_tizen>
1097         public class KeyEventArgs : EventArgs
1098         {
1099             private Key _key;
1100
1101             /// <summary>
1102             /// Key - is the key sent to the view.
1103             /// </summary>
1104             /// <since_tizen> 3 </since_tizen>
1105             public Key Key
1106             {
1107                 get
1108                 {
1109                     return _key;
1110                 }
1111                 set
1112                 {
1113                     _key = value;
1114                 }
1115             }
1116         }
1117
1118         /// <summary>
1119         /// Event arguments that passed via the touch signal.
1120         /// </summary>
1121         /// <since_tizen> 3 </since_tizen>
1122         public class TouchEventArgs : EventArgs
1123         {
1124             private Touch _touch;
1125
1126             /// <summary>
1127             /// Touch - contains the information of touch points.
1128             /// </summary>
1129             /// <since_tizen> 3 </since_tizen>
1130             public Touch Touch
1131             {
1132                 get
1133                 {
1134                     return _touch;
1135                 }
1136                 set
1137                 {
1138                     _touch = value;
1139                 }
1140             }
1141         }
1142
1143         /// <summary>
1144         /// Event arguments that passed via the hover signal.
1145         /// </summary>
1146         /// <since_tizen> 3 </since_tizen>
1147         public class HoverEventArgs : EventArgs
1148         {
1149             private Hover _hover;
1150
1151             /// <summary>
1152             /// Hover - contains touch points that represent the points that are currently being hovered or the points where a hover has stopped.
1153             /// </summary>
1154             /// <since_tizen> 3 </since_tizen>
1155             public Hover Hover
1156             {
1157                 get
1158                 {
1159                     return _hover;
1160                 }
1161                 set
1162                 {
1163                     _hover = value;
1164                 }
1165             }
1166         }
1167
1168         /// <summary>
1169         /// Event arguments that passed via the wheel signal.
1170         /// </summary>
1171         /// <since_tizen> 3 </since_tizen>
1172         public class WheelEventArgs : EventArgs
1173         {
1174             private Wheel _wheel;
1175
1176             /// <summary>
1177             /// WheelEvent - store a wheel rolling type: MOUSE_WHEEL or CUSTOM_WHEEL.
1178             /// </summary>
1179             /// <since_tizen> 3 </since_tizen>
1180             public Wheel Wheel
1181             {
1182                 get
1183                 {
1184                     return _wheel;
1185                 }
1186                 set
1187                 {
1188                     _wheel = value;
1189                 }
1190             }
1191         }
1192
1193         /// <summary>
1194         /// Event arguments of visibility changed.
1195         /// </summary>
1196         /// <since_tizen> 3 </since_tizen>
1197         public class VisibilityChangedEventArgs : EventArgs
1198         {
1199             private View _view;
1200             private bool _visibility;
1201             private VisibilityChangeType _type;
1202
1203             /// <summary>
1204             /// The view, or child of view, whose visibility has changed.
1205             /// </summary>
1206             /// <since_tizen> 3 </since_tizen>
1207             public View View
1208             {
1209                 get
1210                 {
1211                     return _view;
1212                 }
1213                 set
1214                 {
1215                     _view = value;
1216                 }
1217             }
1218
1219             /// <summary>
1220             /// Whether the view is now visible or not.
1221             /// </summary>
1222             /// <since_tizen> 3 </since_tizen>
1223             public bool Visibility
1224             {
1225                 get
1226                 {
1227                     return _visibility;
1228                 }
1229                 set
1230                 {
1231                     _visibility = value;
1232                 }
1233             }
1234
1235             /// <summary>
1236             /// Whether the view's visible property has changed or a parent's.
1237             /// </summary>
1238             /// <since_tizen> 3 </since_tizen>
1239             public VisibilityChangeType Type
1240             {
1241                 get
1242                 {
1243                     return _type;
1244                 }
1245                 set
1246                 {
1247                     _type = value;
1248                 }
1249             }
1250         }
1251
1252         /// <summary>
1253         /// Event arguments of layout direction changed.
1254         /// </summary>
1255         /// <since_tizen> 4 </since_tizen>
1256         public class LayoutDirectionChangedEventArgs : EventArgs
1257         {
1258             private View _view;
1259             private ViewLayoutDirectionType _type;
1260
1261             /// <summary>
1262             /// The view, or child of view, whose layout direction has changed.
1263             /// </summary>
1264             /// <since_tizen> 4 </since_tizen>
1265             public View View
1266             {
1267                 get
1268                 {
1269                     return _view;
1270                 }
1271                 set
1272                 {
1273                     _view = value;
1274                 }
1275             }
1276
1277             /// <summary>
1278             /// Whether the view's layout direction property has changed or a parent's.
1279             /// </summary>
1280             /// <since_tizen> 4 </since_tizen>
1281             public ViewLayoutDirectionType Type
1282             {
1283                 get
1284                 {
1285                     return _type;
1286                 }
1287                 set
1288                 {
1289                     _type = value;
1290                 }
1291             }
1292         }
1293
1294         internal class BackgroundResourceLoadedEventArgs : EventArgs
1295         {
1296             private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
1297             public ResourceLoadingStatusType Status
1298             {
1299                 get
1300                 {
1301                     return status;
1302                 }
1303                 set
1304                 {
1305                     status = value;
1306                 }
1307             }
1308         }
1309
1310         /// <summary>
1311         /// The class represents the information of the situation where the View's control state changes.
1312         /// </summary>
1313         [EditorBrowsable(EditorBrowsableState.Never)]
1314         public class ControlStateChangedEventArgs : EventArgs
1315         {
1316             /// <summary>
1317             /// Create an instance with mandatory fields.
1318             /// </summary>
1319             /// <param name="previousState">The previous control state.</param>
1320             /// <param name="currentState">The current control state.</param>
1321             [EditorBrowsable(EditorBrowsableState.Never)]
1322             public ControlStateChangedEventArgs(ControlState previousState, ControlState currentState)
1323             {
1324                 PreviousState = previousState;
1325                 CurrentState = currentState;
1326             }
1327
1328             /// <summary>
1329             /// The previous control state.
1330             /// </summary>
1331             [EditorBrowsable(EditorBrowsableState.Never)]
1332             public ControlState PreviousState { get; }
1333
1334             /// <summary>
1335             /// The current control state.
1336             /// </summary>
1337             [EditorBrowsable(EditorBrowsableState.Never)]
1338             public ControlState CurrentState { get; }
1339         }
1340
1341         /// <summary>
1342         /// The expanded touch area.
1343         /// TouchArea can expand the view's touchable area.<br/>
1344         /// 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/>
1345         /// </summary>
1346         /// <remarks>
1347         /// This is based on the top left x, y coordinates.<br/>
1348         /// For example) <br/>
1349         /// <code>
1350         ///  view.Size = new Size(100, 100);
1351         ///  view.TouchAreaOffset = new Offset(-10, 20, 30, -40); // left, right, bottom, top
1352         /// </code>
1353         /// Then, touch area is 130x170.<br/>
1354         /// This is view.width + TouchAreaOffset.right - TouchAreaOffset.left and view.height + TouchAreaOffset.bottom - TouchAreaOffset.top <br/>
1355         /// +---------------------+ <br/>
1356         /// |         ^           | <br/>
1357         /// |         |           | <br/>
1358         /// |         | -40       | <br/>
1359         /// |         |           | <br/>
1360         /// |         |           | <br/>
1361         /// |    +----+----+      | <br/>
1362         /// |    |         |      | <br/>
1363         /// | -10|         | 20   | <br/>
1364         /// |&lt;---+         +-----&gt;| <br/>
1365         /// |    |         |      | <br/>
1366         /// |    |         |      | <br/>
1367         /// |    +----+----+      | <br/>
1368         /// |         |           | <br/>
1369         /// |         | 30        | <br/>
1370         /// |         |           | <br/>
1371         /// |         v           | <br/>
1372         /// +---------------------+ <br/>
1373         /// </remarks>
1374         [EditorBrowsable(EditorBrowsableState.Never)]
1375         public Offset TouchAreaOffset
1376         {
1377             get
1378             {
1379                 return (Offset)GetValue(TouchAreaOffsetProperty);
1380             }
1381             set
1382             {
1383                 SetValue(TouchAreaOffsetProperty, value);
1384                 NotifyPropertyChanged();
1385             }
1386         }
1387
1388         private Offset InternalTouchAreaOffset
1389         {
1390             get
1391             {
1392                 Interop.ActorInternal.GetTouchAreaOffset(SwigCPtr, out int left, out int right, out int bottom, out int top);
1393                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1394                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1395                 return new Offset(left, right, bottom, top);
1396             }
1397             set
1398             {
1399                 Interop.ActorInternal.SetTouchAreaOffset(SwigCPtr, value.Left, value.Right, value.Bottom, value.Top);
1400                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1401                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1402             }
1403         }
1404
1405
1406         /// <summary>
1407         /// Gets or sets the status of whether the view should emit key event signals.
1408         /// If a View's DispatchKeyEvents is set to false, then itself and parents will not receive key event signals.
1409         /// </summary>
1410         [EditorBrowsable(EditorBrowsableState.Never)]
1411         public bool DispatchKeyEvents
1412         {
1413             get
1414             {
1415                 return (bool)GetValue(DispatchKeyEventsProperty);
1416             }
1417             set
1418             {
1419                 SetValue(DispatchKeyEventsProperty, value);
1420                 NotifyPropertyChanged();
1421             }
1422         }
1423
1424         /// <summary>
1425         /// Gets or sets the status of whether touch events can be dispatched.
1426         /// If a View's DispatchTouchEvents is set to false, then it's can not will receive touch and parents will not receive a touch event signal either.
1427         /// This works without adding a TouchEvent callback in the View.
1428         /// <note>
1429         /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit touch event.
1430         /// </note>
1431         /// </summary>
1432         [EditorBrowsable(EditorBrowsableState.Never)]
1433         public bool DispatchTouchEvents
1434         {
1435             get
1436             {
1437                 return dispatchTouchEvents;
1438             }
1439             set
1440             {
1441                 if (dispatchTouchEvents != value)
1442                 {
1443                     dispatchTouchEvents = value;
1444                     if (dispatchTouchEvents == false)
1445                     {
1446                         TouchEvent += OnDispatchTouchEvent;
1447                     }
1448                     else
1449                     {
1450                         TouchEvent -= OnDispatchTouchEvent;
1451                     }
1452                 }
1453             }
1454         }
1455
1456         private bool OnDispatchTouchEvent(object source, View.TouchEventArgs e)
1457         {
1458             return true;
1459         }
1460
1461         /// <summary>
1462         /// Gets or sets the status of whether touch events can be dispatched to the parent.
1463         /// If a View's DispatchParentTouchEvents is set to false, then parents will not receive a touch event signal either.
1464         /// This works without adding a TouchEvent callback in the View.
1465         /// <note>
1466         /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit touch event.
1467         /// </note>
1468         /// </summary>
1469         [EditorBrowsable(EditorBrowsableState.Never)]
1470         public bool DispatchParentTouchEvents
1471         {
1472             get
1473             {
1474                 return dispatchParentTouchEvents;
1475             }
1476             set
1477             {
1478                 if (dispatchParentTouchEvents != value)
1479                 {
1480                     dispatchParentTouchEvents = value;
1481                     if (dispatchParentTouchEvents == false)
1482                     {
1483                         TouchEvent += OnDispatchParentTouchEvent;
1484                     }
1485                     else
1486                     {
1487                         TouchEvent -= OnDispatchParentTouchEvent;
1488                     }
1489                 }
1490             }
1491         }
1492
1493         private bool OnDispatchParentTouchEvent(object source, View.TouchEventArgs e)
1494         {
1495             return true;
1496         }
1497
1498         /// <summary>
1499         /// Gets or sets the status of whether hover events can be dispatched.
1500         /// If a View's DispatchHoverEvents is set to false, then it's can not will receive hover event and parents will not receive a hover event signal either.
1501         /// This works without adding a HoverEvent callback in the View.
1502         /// <note>
1503         /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit hover event.
1504         /// </note>
1505         /// </summary>
1506         [EditorBrowsable(EditorBrowsableState.Never)]
1507         public bool DispatchHoverEvents
1508         {
1509             get
1510             {
1511                 return dispatchHoverEvents;
1512             }
1513             set
1514             {
1515                 if (dispatchHoverEvents != value)
1516                 {
1517                     dispatchHoverEvents = value;
1518                     if (dispatchHoverEvents == false)
1519                     {
1520                         HoverEvent += OnDispatchHoverEvent;
1521                     }
1522                     else
1523                     {
1524                         HoverEvent -= OnDispatchHoverEvent;
1525                     }
1526                 }
1527             }
1528         }
1529
1530         private bool OnDispatchHoverEvent(object source, View.HoverEventArgs e)
1531         {
1532             return true;
1533         }
1534
1535         /// <summary>
1536         /// Gets or sets the status of whether hover events can be dispatched to the parent.
1537         /// If a View's DispatchParentHoverEvents is set to false, then parents will not receive a hover event signal either.
1538         /// This works without adding a HoverEvent callback in the View.
1539         /// <note>
1540         /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit hover event.
1541         /// </note>
1542         /// </summary>
1543         [EditorBrowsable(EditorBrowsableState.Never)]
1544         public bool DispatchParentHoverEvents
1545         {
1546             get
1547             {
1548                 return dispatchParentHoverEvents;
1549             }
1550             set
1551             {
1552                 if (dispatchParentHoverEvents != value)
1553                 {
1554                     dispatchParentHoverEvents = value;
1555                     if (dispatchParentHoverEvents == false)
1556                     {
1557                         HoverEvent += OnDispatchParentHoverEvent;
1558                     }
1559                     else
1560                     {
1561                         HoverEvent -= OnDispatchParentHoverEvent;
1562                     }
1563                 }
1564             }
1565         }
1566
1567         private bool OnDispatchParentHoverEvent(object source, View.HoverEventArgs e)
1568         {
1569             return true;
1570         }
1571
1572         /// <summary>
1573         /// Gets or sets the status of whether wheel events can be dispatched.
1574         /// If a View's DispatchWheelEvents is set to false, then it's can not will receive wheel event and parents will not receive a wheel event signal either.
1575         /// This works without adding a WheelEvent callback in the View.
1576         /// <note>
1577         /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit hover event.
1578         /// </note>
1579         /// </summary>
1580         [EditorBrowsable(EditorBrowsableState.Never)]
1581         public bool DispatchWheelEvents
1582         {
1583             get
1584             {
1585                 return dispatchWheelEvents;
1586             }
1587             set
1588             {
1589                 if (dispatchWheelEvents != value)
1590                 {
1591                     dispatchWheelEvents = value;
1592                     if (dispatchWheelEvents == false)
1593                     {
1594                         WheelEvent += OnDispatchWheelEvent;
1595                     }
1596                     else
1597                     {
1598                         WheelEvent -= OnDispatchWheelEvent;
1599                     }
1600                 }
1601             }
1602         }
1603
1604         private bool OnDispatchWheelEvent(object source, View.WheelEventArgs e)
1605         {
1606             return true;
1607         }
1608
1609         /// <summary>
1610         /// Gets or sets the status of whether wheel events can be dispatched to the parent.
1611         /// If a View's DispatchParentWheelEvents is set to false, then parents will not receive a wheel event signal either.
1612         /// This works without adding a WheelEvent callback in the View.
1613         /// <note>
1614         /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit hover event.
1615         /// </note>
1616         /// </summary>
1617         [EditorBrowsable(EditorBrowsableState.Never)]
1618         public bool DispatchParentWheelEvents
1619         {
1620             get
1621             {
1622                 return dispatchParentWheelEvents;
1623             }
1624             set
1625             {
1626                 if (dispatchParentWheelEvents != value)
1627                 {
1628                     dispatchParentWheelEvents = value;
1629                     if (dispatchParentWheelEvents == false)
1630                     {
1631                         WheelEvent += OnDispatchParentWheelEvent;
1632                     }
1633                     else
1634                     {
1635                         WheelEvent -= OnDispatchParentWheelEvent;
1636                     }
1637                 }
1638             }
1639         }
1640
1641         private bool OnDispatchParentWheelEvent(object source, View.WheelEventArgs e)
1642         {
1643             return true;
1644         }
1645
1646         /// <summary>
1647         /// Gets or sets the status of whether the view should emit Gesture event signals.
1648         /// If a View's DispatchGestureEvents is set to false, then itself and parents will not receive all gesture event signals.
1649         /// The itself and parents does not receive tap, pinch, pan, rotation, or longpress gestures.
1650         /// </summary>
1651         [EditorBrowsable(EditorBrowsableState.Never)]
1652         public bool DispatchGestureEvents
1653         {
1654             get
1655             {
1656                 return dispatchGestureEvents;
1657             }
1658             set
1659             {
1660                 if (dispatchGestureEvents != value)
1661                 {
1662                     dispatchGestureEvents = value;
1663                     ConfigGestureDetector(dispatchGestureEvents);
1664                 }
1665             }
1666         }
1667
1668         /// <summary>
1669         /// Gets or sets the status of whether the view should emit Gesture event signals.
1670         /// If a View's DispatchParentGestureEvents is set to false, then parents will not receive all gesture event signals.
1671         /// The parents does not receive tap, pinch, pan, rotation, or longpress gestures.
1672         /// </summary>
1673         [EditorBrowsable(EditorBrowsableState.Never)]
1674         public bool DispatchParentGestureEvents
1675         {
1676             get
1677             {
1678                 return dispatchParentGestureEvents;
1679             }
1680             set
1681             {
1682                 if (dispatchParentGestureEvents != value)
1683                 {
1684                     dispatchParentGestureEvents = value;
1685                     ConfigGestureDetector(dispatchParentGestureEvents);
1686                 }
1687             }
1688         }
1689
1690         private void ConfigGestureDetector(bool dispatch)
1691         {
1692             if (panGestureDetector == null) panGestureDetector = new PanGestureDetector();
1693             if (longGestureDetector == null) longGestureDetector = new LongPressGestureDetector();
1694             if (pinchGestureDetector == null) pinchGestureDetector = new PinchGestureDetector();
1695             if (tapGestureDetector == null) tapGestureDetector = new TapGestureDetector();
1696             if (rotationGestureDetector == null) rotationGestureDetector = new RotationGestureDetector();
1697
1698             if (dispatch == true)
1699             {
1700                 configGestureCount = configGestureCount > 0 ? configGestureCount - 1 : 0;
1701                 if (configGestureCount == 0)
1702                 {
1703                     panGestureDetector.Detach(this);
1704                     longGestureDetector.Detach(this);
1705                     pinchGestureDetector.Detach(this);
1706                     tapGestureDetector.Detach(this);
1707                     rotationGestureDetector.Detach(this);
1708
1709                     panGestureDetector.Detected -= OnGestureDetected;
1710                     longGestureDetector.Detected -= OnGestureDetected;
1711                     pinchGestureDetector.Detected -= OnGestureDetected;
1712                     tapGestureDetector.Detected -= OnGestureDetected;
1713                     rotationGestureDetector.Detected -= OnGestureDetected;
1714                 }
1715             }
1716             else
1717             {
1718                 if (configGestureCount == 0)
1719                 {
1720                     panGestureDetector.Attach(this);
1721                     longGestureDetector.Attach(this);
1722                     pinchGestureDetector.Attach(this);
1723                     tapGestureDetector.Attach(this);
1724                     rotationGestureDetector.Attach(this);
1725
1726                     panGestureDetector.Detected += OnGestureDetected;
1727                     longGestureDetector.Detected += OnGestureDetected;
1728                     pinchGestureDetector.Detected += OnGestureDetected;
1729                     tapGestureDetector.Detected += OnGestureDetected;
1730                     rotationGestureDetector.Detected += OnGestureDetected;
1731                 }
1732                 configGestureCount++;
1733             }
1734         }
1735
1736         private void OnGestureDetected(object source, EventArgs e)
1737         {
1738             // Does notting. This is to consume the gesture.
1739         }
1740
1741         /// <summary>
1742         /// Gets or sets the status of whether motion event of Touch can be dispatched.
1743         /// If a View's DispatchTouchMotion is set to false, then it's can not will receive motion event of TouchEvent.
1744         /// </summary>
1745         [EditorBrowsable(EditorBrowsableState.Never)]
1746         public bool DispatchTouchMotion
1747         {
1748             get
1749             {
1750                 return (bool)GetValue(DispatchTouchMotionProperty);
1751             }
1752             set
1753             {
1754                 SetValue(DispatchTouchMotionProperty, value);
1755             }
1756         }
1757
1758         private bool InternalDispatchTouchMotion
1759         {
1760             get
1761             {
1762                 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.DispatchTouchMotion);
1763             }
1764             set
1765             {
1766                 Object.InternalSetPropertyBool(SwigCPtr, View.Property.DispatchTouchMotion, value);
1767                 NotifyPropertyChanged();
1768             }
1769         }
1770
1771         /// <summary>
1772         /// Gets or sets the status of whether motion event of Hover can be dispatched.
1773         /// If a View's DispatchHoverMotion is set to false, then it's can not will receive motion event of HoverEvent.
1774         /// </summary>
1775         [EditorBrowsable(EditorBrowsableState.Never)]
1776         public bool DispatchHoverMotion
1777         {
1778             get
1779             {
1780                 return (bool)GetValue(DispatchHoverMotionProperty);
1781             }
1782             set
1783             {
1784                 SetValue(DispatchHoverMotionProperty, value);
1785             }
1786         }
1787
1788         private bool InternalDispatchHoverMotion
1789         {
1790             get
1791             {
1792                 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.DispatchHoverMotion);
1793             }
1794             set
1795             {
1796                 Object.InternalSetPropertyBool(SwigCPtr, View.Property.DispatchHoverMotion, value);
1797                 NotifyPropertyChanged();
1798             }
1799         }
1800     }
1801 }