d06d61b49cb680af47f4286cf73d305dbcb9df25
[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             if (touchData == global::System.IntPtr.Zero)
923             {
924                 NUILog.Error("touchData should not be null!");
925                 return true;
926             }
927             
928             TouchEventArgs e = new TouchEventArgs();
929             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
930             return HitTest(e.Touch);
931         }
932
933         // Callback for View TouchSignal
934         private bool OnInterceptTouch(IntPtr view, IntPtr touchData)
935         {
936             if (touchData == global::System.IntPtr.Zero)
937             {
938                 NUILog.Error("touchData should not be null!");
939                 return true;
940             }
941
942             // DisallowInterceptTouchEvent prevents the parent from intercepting touch.
943             if (DisallowInterceptTouchEvent)
944             {
945                 return false;
946             }
947
948             TouchEventArgs e = new TouchEventArgs();
949
950             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
951
952             bool consumed = false;
953
954             if (interceptTouchDataEventHandler != null)
955             {
956                 consumed = interceptTouchDataEventHandler(this, e);
957             }
958
959             return consumed;
960         }
961
962         // Callback for View TouchSignal
963         private bool OnTouch(IntPtr view, IntPtr touchData)
964         {
965             if (touchData == global::System.IntPtr.Zero)
966             {
967                 NUILog.Error("touchData should not be null!");
968                 return true;
969             }
970
971             if (DispatchTouchEvents == false)
972             {
973                 NUILog.Debug("If DispatchTouchEvents is false, it can not dispatch.");
974                 return true;
975             }
976
977             TouchEventArgs e = new TouchEventArgs();
978
979             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
980
981             bool consumed = false;
982
983             if (touchDataEventHandler != null)
984             {
985                 consumed = touchDataEventHandler(this, e);
986             }
987
988             if (enableControlState && !consumed)
989             {
990                 consumed = HandleControlStateOnTouch(e.Touch);
991             }
992
993             return consumed;
994         }
995
996         // Callback for View Hover signal
997         private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
998         {
999             if (hoverEvent == global::System.IntPtr.Zero)
1000             {
1001                 NUILog.Error("hoverEvent should not be null!");
1002                 return true;
1003             }
1004
1005             HoverEventArgs e = new HoverEventArgs();
1006
1007             e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);
1008
1009             if (hoverEventHandler != null)
1010             {
1011                 return hoverEventHandler(this, e);
1012             }
1013             return false;
1014         }
1015
1016         // Callback for View Wheel signal
1017         private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
1018         {
1019             if (wheelEvent == global::System.IntPtr.Zero)
1020             {
1021                 NUILog.Error("wheelEvent should not be null!");
1022                 return true;
1023             }
1024
1025             WheelEventArgs e = new WheelEventArgs();
1026
1027             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1028
1029             if (wheelEventHandler != null)
1030             {
1031                 return wheelEventHandler(this, e);
1032             }
1033             return false;
1034         }
1035
1036         // Callback for View OnWindow signal
1037         private void OnWindow(IntPtr data)
1038         {
1039             if (onWindowEventHandler != null)
1040             {
1041                 onWindowEventHandler(this, null);
1042             }
1043         }
1044
1045         // Callback for View OffWindow signal
1046         private void OffWindow(IntPtr data)
1047         {
1048             if (offWindowEventHandler != null)
1049             {
1050                 offWindowEventHandler(this, null);
1051             }
1052         }
1053
1054         // Callback for View visibility change signal
1055         private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type)
1056         {
1057             VisibilityChangedEventArgs e = new VisibilityChangedEventArgs();
1058             if (data != null)
1059             {
1060                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1061             }
1062             e.Visibility = visibility;
1063             e.Type = type;
1064
1065             if (visibilityChangedEventHandler != null)
1066             {
1067                 visibilityChangedEventHandler(this, e);
1068             }
1069         }
1070
1071         // Callback for View layout direction change signal
1072         private void OnLayoutDirectionChanged(IntPtr data, ViewLayoutDirectionType type)
1073         {
1074             LayoutDirectionChangedEventArgs e = new LayoutDirectionChangedEventArgs();
1075             if (data != null)
1076             {
1077                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
1078             }
1079             e.Type = type;
1080
1081             if (layoutDirectionChangedEventHandler != null)
1082             {
1083                 layoutDirectionChangedEventHandler(this, e);
1084             }
1085         }
1086
1087         private void OnResourcesLoaded(IntPtr view)
1088         {
1089             if(!CheckResourceReady())
1090             {
1091                 return;
1092             }
1093
1094             if (resourcesLoadedEventHandler != null)
1095             {
1096                 resourcesLoadedEventHandler(this, null);
1097             }
1098         }
1099
1100         private void OnBackgroundResourceLoaded(IntPtr view)
1101         {
1102             BackgroundResourceLoadedEventArgs e = new BackgroundResourceLoadedEventArgs();
1103             e.Status = (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1104
1105             if (backgroundResourceLoadedEventHandler != null)
1106             {
1107                 backgroundResourceLoadedEventHandler(this, e);
1108             }
1109         }
1110
1111         /// <summary>
1112         /// Event argument passed through the ChildAdded event.
1113         /// </summary>
1114         /// <since_tizen> 5 </since_tizen>
1115         public class ChildAddedEventArgs : EventArgs
1116         {
1117             /// <summary>
1118             /// Added child view at moment.
1119             /// </summary>
1120             /// <since_tizen> 5 </since_tizen>
1121             public View Added { get; set; }
1122         }
1123
1124         /// <summary>
1125         /// Event argument passed through the ChildRemoved event.
1126         /// </summary>
1127         /// <since_tizen> 5 </since_tizen>
1128         public class ChildRemovedEventArgs : EventArgs
1129         {
1130             /// <summary>
1131             /// Removed child view at moment.
1132             /// </summary>
1133             /// <since_tizen> 5 </since_tizen>
1134             public View Removed { get; set; }
1135         }
1136
1137         /// <summary>
1138         /// Event arguments that passed via the KeyEvent signal.
1139         /// </summary>
1140         /// <since_tizen> 3 </since_tizen>
1141         public class KeyEventArgs : EventArgs
1142         {
1143             private Key _key;
1144
1145             /// <summary>
1146             /// Key - is the key sent to the view.
1147             /// </summary>
1148             /// <since_tizen> 3 </since_tizen>
1149             public Key Key
1150             {
1151                 get
1152                 {
1153                     return _key;
1154                 }
1155                 set
1156                 {
1157                     _key = value;
1158                 }
1159             }
1160         }
1161
1162         /// <summary>
1163         /// Event arguments that passed via the touch signal.
1164         /// </summary>
1165         /// <since_tizen> 3 </since_tizen>
1166         public class TouchEventArgs : EventArgs
1167         {
1168             private Touch _touch;
1169
1170             /// <summary>
1171             /// Touch - contains the information of touch points.
1172             /// </summary>
1173             /// <since_tizen> 3 </since_tizen>
1174             public Touch Touch
1175             {
1176                 get
1177                 {
1178                     return _touch;
1179                 }
1180                 set
1181                 {
1182                     _touch = value;
1183                 }
1184             }
1185         }
1186
1187         /// <summary>
1188         /// Event arguments that passed via the hover signal.
1189         /// </summary>
1190         /// <since_tizen> 3 </since_tizen>
1191         public class HoverEventArgs : EventArgs
1192         {
1193             private Hover _hover;
1194
1195             /// <summary>
1196             /// Hover - contains touch points that represent the points that are currently being hovered or the points where a hover has stopped.
1197             /// </summary>
1198             /// <since_tizen> 3 </since_tizen>
1199             public Hover Hover
1200             {
1201                 get
1202                 {
1203                     return _hover;
1204                 }
1205                 set
1206                 {
1207                     _hover = value;
1208                 }
1209             }
1210         }
1211
1212         /// <summary>
1213         /// Event arguments that passed via the wheel signal.
1214         /// </summary>
1215         /// <since_tizen> 3 </since_tizen>
1216         public class WheelEventArgs : EventArgs
1217         {
1218             private Wheel _wheel;
1219
1220             /// <summary>
1221             /// WheelEvent - store a wheel rolling type: MOUSE_WHEEL or CUSTOM_WHEEL.
1222             /// </summary>
1223             /// <since_tizen> 3 </since_tizen>
1224             public Wheel Wheel
1225             {
1226                 get
1227                 {
1228                     return _wheel;
1229                 }
1230                 set
1231                 {
1232                     _wheel = value;
1233                 }
1234             }
1235         }
1236
1237         /// <summary>
1238         /// Event arguments of visibility changed.
1239         /// </summary>
1240         /// <since_tizen> 3 </since_tizen>
1241         public class VisibilityChangedEventArgs : EventArgs
1242         {
1243             private View _view;
1244             private bool _visibility;
1245             private VisibilityChangeType _type;
1246
1247             /// <summary>
1248             /// The view, or child of view, whose visibility has changed.
1249             /// </summary>
1250             /// <since_tizen> 3 </since_tizen>
1251             public View View
1252             {
1253                 get
1254                 {
1255                     return _view;
1256                 }
1257                 set
1258                 {
1259                     _view = value;
1260                 }
1261             }
1262
1263             /// <summary>
1264             /// Whether the view is now visible or not.
1265             /// </summary>
1266             /// <since_tizen> 3 </since_tizen>
1267             public bool Visibility
1268             {
1269                 get
1270                 {
1271                     return _visibility;
1272                 }
1273                 set
1274                 {
1275                     _visibility = value;
1276                 }
1277             }
1278
1279             /// <summary>
1280             /// Whether the view's visible property has changed or a parent's.
1281             /// </summary>
1282             /// <since_tizen> 3 </since_tizen>
1283             public VisibilityChangeType Type
1284             {
1285                 get
1286                 {
1287                     return _type;
1288                 }
1289                 set
1290                 {
1291                     _type = value;
1292                 }
1293             }
1294         }
1295
1296         /// <summary>
1297         /// Event arguments of layout direction changed.
1298         /// </summary>
1299         /// <since_tizen> 4 </since_tizen>
1300         public class LayoutDirectionChangedEventArgs : EventArgs
1301         {
1302             private View _view;
1303             private ViewLayoutDirectionType _type;
1304
1305             /// <summary>
1306             /// The view, or child of view, whose layout direction has changed.
1307             /// </summary>
1308             /// <since_tizen> 4 </since_tizen>
1309             public View View
1310             {
1311                 get
1312                 {
1313                     return _view;
1314                 }
1315                 set
1316                 {
1317                     _view = value;
1318                 }
1319             }
1320
1321             /// <summary>
1322             /// Whether the view's layout direction property has changed or a parent's.
1323             /// </summary>
1324             /// <since_tizen> 4 </since_tizen>
1325             public ViewLayoutDirectionType Type
1326             {
1327                 get
1328                 {
1329                     return _type;
1330                 }
1331                 set
1332                 {
1333                     _type = value;
1334                 }
1335             }
1336         }
1337
1338         internal class BackgroundResourceLoadedEventArgs : EventArgs
1339         {
1340             private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
1341             public ResourceLoadingStatusType Status
1342             {
1343                 get
1344                 {
1345                     return status;
1346                 }
1347                 set
1348                 {
1349                     status = value;
1350                 }
1351             }
1352         }
1353
1354         /// <summary>
1355         /// The class represents the information of the situation where the View's control state changes.
1356         /// </summary>
1357         [EditorBrowsable(EditorBrowsableState.Never)]
1358         public class ControlStateChangedEventArgs : EventArgs
1359         {
1360             /// <summary>
1361             /// Create an instance with mandatory fields.
1362             /// </summary>
1363             /// <param name="previousState">The previous control state.</param>
1364             /// <param name="currentState">The current control state.</param>
1365             [EditorBrowsable(EditorBrowsableState.Never)]
1366             public ControlStateChangedEventArgs(ControlState previousState, ControlState currentState)
1367             {
1368                 PreviousState = previousState;
1369                 CurrentState = currentState;
1370             }
1371
1372             /// <summary>
1373             /// The previous control state.
1374             /// </summary>
1375             [EditorBrowsable(EditorBrowsableState.Never)]
1376             public ControlState PreviousState { get; }
1377
1378             /// <summary>
1379             /// The current control state.
1380             /// </summary>
1381             [EditorBrowsable(EditorBrowsableState.Never)]
1382             public ControlState CurrentState { get; }
1383         }
1384
1385         /// <summary>
1386         /// The expanded touch area.
1387         /// TouchArea can expand the view's touchable area.<br/>
1388         /// 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/>
1389         /// </summary>
1390         /// <remarks>
1391         /// This is based on the top left x, y coordinates.<br/>
1392         /// For example) <br/>
1393         /// <code>
1394         ///  view.Size = new Size(100, 100);
1395         ///  view.TouchAreaOffset = new Offset(-10, 20, 30, -40); // left, right, bottom, top
1396         /// </code>
1397         /// Then, touch area is 130x170.<br/>
1398         /// This is view.width + TouchAreaOffset.right - TouchAreaOffset.left and view.height + TouchAreaOffset.bottom - TouchAreaOffset.top <br/>
1399         /// +---------------------+ <br/>
1400         /// |         ^           | <br/>
1401         /// |         |           | <br/>
1402         /// |         | -40       | <br/>
1403         /// |         |           | <br/>
1404         /// |         |           | <br/>
1405         /// |    +----+----+      | <br/>
1406         /// |    |         |      | <br/>
1407         /// | -10|         | 20   | <br/>
1408         /// |&lt;---+         +-----&gt;| <br/>
1409         /// |    |         |      | <br/>
1410         /// |    |         |      | <br/>
1411         /// |    +----+----+      | <br/>
1412         /// |         |           | <br/>
1413         /// |         | 30        | <br/>
1414         /// |         |           | <br/>
1415         /// |         v           | <br/>
1416         /// +---------------------+ <br/>
1417         /// </remarks>
1418         [EditorBrowsable(EditorBrowsableState.Never)]
1419         public Offset TouchAreaOffset
1420         {
1421             get
1422             {
1423                 return (Offset)GetValue(TouchAreaOffsetProperty);
1424             }
1425             set
1426             {
1427                 SetValue(TouchAreaOffsetProperty, value);
1428                 NotifyPropertyChanged();
1429             }
1430         }
1431
1432         private Offset InternalTouchAreaOffset
1433         {
1434             get
1435             {
1436                 Interop.ActorInternal.GetTouchAreaOffset(SwigCPtr, out int left, out int right, out int bottom, out int top);
1437                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1438                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1439                 return new Offset(left, right, bottom, top);
1440             }
1441             set
1442             {
1443                 Interop.ActorInternal.SetTouchAreaOffset(SwigCPtr, value.Left, value.Right, value.Bottom, value.Top);
1444                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1445                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1446             }
1447         }
1448
1449     }
1450 }