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