Merge remote-tracking branch 'origin/API10' into tizen_7.0
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ViewInternal.cs
1 /*
2  * Copyright(c) 2022 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 global::System.Diagnostics;
21 using Tizen.NUI;
22
23 namespace Tizen.NUI.BaseComponents
24 {
25     /// <summary>
26     /// View is the base class for all views.
27     /// </summary>
28     /// <since_tizen> 3 </since_tizen>
29     public partial class View
30     {
31         internal string styleName;
32
33         internal virtual LayoutItem CreateDefaultLayout()
34         {
35             return new AbsoluteLayout();
36         }
37
38         internal class ThemeData
39         {
40             [Flags]
41             private enum States : byte
42             {
43                 None = 0,
44                 ControlStatePropagation = 1 << 0,
45                 ThemeChangeSensitive = 1 << 1,
46                 ThemeApplied = 1 << 2, // It is true when the view has valid style name or the platform theme has a component style for this view type.
47                                        // That indicates the view can have different styles by theme.
48                                        // Hence if the current state has ThemeApplied and ThemeChangeSensitive, the view will change its style by theme changing.
49                 ListeningThemeChangeEvent = 1 << 3,
50             };
51
52             private States states = ThemeManager.ApplicationThemeChangeSensitive ? States.ThemeChangeSensitive : States.None;
53             public ViewStyle viewStyle;
54             public ControlState controlStates = ControlState.Normal;
55             public ViewSelectorData selectorData;
56
57             public bool ControlStatePropagation
58             {
59                 get => ((states & States.ControlStatePropagation) != 0);
60                 set => SetOption(States.ControlStatePropagation, value);
61             }
62
63             public bool ThemeChangeSensitive
64             {
65                 get => ((states & States.ThemeChangeSensitive) != 0);
66                 set => SetOption(States.ThemeChangeSensitive, value);
67             }
68
69             public bool ThemeApplied
70             {
71                 get => ((states & States.ThemeApplied) != 0);
72                 set => SetOption(States.ThemeApplied, value);
73             }
74
75             public bool ListeningThemeChangeEvent
76             {
77                 get => ((states & States.ListeningThemeChangeEvent) != 0);
78                 set => SetOption(States.ListeningThemeChangeEvent, value);
79             }
80
81             private void SetOption(States option, bool value)
82             {
83                 if (value) states |= option;
84                 else states &= ~option;
85             }
86         }
87
88         /// <summary>
89         /// The color mode of View.
90         /// This specifies whether the View uses its own color, or inherits its parent color.
91         /// The default is ColorMode.UseOwnMultiplyParentColor.
92         /// </summary>
93         internal ColorMode ColorMode
94         {
95             set
96             {
97                 SetColorMode(value);
98             }
99             get
100             {
101                 return GetColorMode();
102             }
103         }
104
105         internal LayoutLength SuggestedMinimumWidth
106         {
107             get
108             {
109                 float result = Interop.Actor.GetSuggestedMinimumWidth(SwigCPtr);
110                 if (NDalicPINVOKE.SWIGPendingException.Pending)
111                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112                 return new LayoutLength(result);
113             }
114         }
115
116         internal LayoutLength SuggestedMinimumHeight
117         {
118             get
119             {
120                 float result = Interop.Actor.GetSuggestedMinimumHeight(SwigCPtr);
121                 if (NDalicPINVOKE.SWIGPendingException.Pending)
122                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123                 return new LayoutLength(result);
124             }
125         }
126
127         internal float WorldPositionX
128         {
129             get
130             {
131 #if NUI_PROPERTY_CHANGE_3
132                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionX);
133 #else
134                 float returnValue = 0.0f;
135                 PropertyValue wordPositionX = GetProperty(View.Property.WorldPositionX);
136                 wordPositionX?.Get(out returnValue);
137                 wordPositionX?.Dispose();
138                 return returnValue;
139 #endif                
140             }
141         }
142
143         internal float WorldPositionY
144         {
145             get
146             {
147 #if NUI_PROPERTY_CHANGE_3
148                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionY);
149 #else
150                 float returnValue = 0.0f;
151                 PropertyValue wordPositionY = GetProperty(View.Property.WorldPositionY);
152                 wordPositionY?.Get(out returnValue);
153                 wordPositionY?.Dispose();
154                 return returnValue;
155 #endif
156             }
157         }
158
159         internal float WorldPositionZ
160         {
161             get
162             {
163 #if NUI_PROPERTY_CHANGE_3
164                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionZ);
165 #else
166                 float returnValue = 0.0f;
167                 PropertyValue wordPositionZ = GetProperty(View.Property.WorldPositionZ);
168                 wordPositionZ?.Get(out returnValue);
169                 wordPositionZ?.Dispose();
170                 return returnValue;
171 #endif
172             }
173         }
174
175         internal bool FocusState
176         {
177             get
178             {
179                 return IsKeyboardFocusable();
180             }
181             set
182             {
183                 SetKeyboardFocusable(value);
184             }
185         }
186
187         internal void SetLayout(LayoutItem layout)
188         {
189             LayoutCount++;
190
191             this.layout = layout;
192             this.layout?.AttachToOwner(this);
193             this.layout?.RequestLayout();
194         }
195
196         internal void AttachTransitionsToChildren(LayoutTransition transition)
197         {
198             // Iterate children, adding the transition unless a transition
199             // for the same condition and property has already been
200             // explicitly added.
201             foreach (View view in Children)
202             {
203                 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
204             }
205         }
206
207         internal float ParentOriginX
208         {
209             get
210             {
211 #if NUI_PROPERTY_CHANGE_3
212                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginX);
213 #else
214                 float returnValue = 0.0f;
215                 PropertyValue parentOriginX = GetProperty(View.Property.ParentOriginX);
216                 parentOriginX?.Get(out returnValue);
217                 parentOriginX?.Dispose();
218                 return returnValue;
219 #endif
220             }
221             set
222             {
223 #if NUI_PROPERTY_CHANGE_3
224                 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.WorldPositionX, value);
225 #else
226                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
227                 SetProperty(View.Property.ParentOriginX, setValue);
228                 setValue.Dispose();
229 #endif
230                 NotifyPropertyChanged();
231             }
232         }
233
234         internal float ParentOriginY
235         {
236             get
237             {
238 #if NUI_PROPERTY_CHANGE_3
239                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginY);
240 #else
241                 float returnValue = 0.0f;
242                 PropertyValue parentOriginY = GetProperty(View.Property.ParentOriginY);
243                 parentOriginY?.Get(out returnValue);
244                 parentOriginY?.Dispose();
245                 return returnValue;
246 #endif
247             }
248             set
249             {
250 #if NUI_PROPERTY_CHANGE_3
251                 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginY, value);
252 #else
253
254                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
255                 SetProperty(View.Property.ParentOriginY, setValue);
256                 setValue.Dispose();
257 #endif
258                 NotifyPropertyChanged();
259             }
260         }
261
262         internal float ParentOriginZ
263         {
264             get
265             {
266 #if NUI_PROPERTY_CHANGE_3
267                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ);
268 #else
269                 float returnValue = 0.0f;
270                 PropertyValue parentOriginZ = GetProperty(View.Property.ParentOriginZ);
271                 parentOriginZ?.Get(out returnValue);
272                 parentOriginZ?.Dispose();
273                 return returnValue;
274 #endif            
275             }
276             set
277             {
278 #if NUI_PROPERTY_CHANGE_3
279                 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ, value);
280 #else
281                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
282                 SetProperty(View.Property.ParentOriginZ, setValue);
283                 setValue.Dispose();
284 #endif
285                 NotifyPropertyChanged();
286             }
287         }
288
289         internal float PivotPointX
290         {
291             get
292             {
293 #if NUI_PROPERTY_CHANGE_3
294                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointX);
295 #else
296                 float returnValue = 0.0f;
297                 PropertyValue anchorPointX = GetProperty(View.Property.AnchorPointX);
298                 anchorPointX?.Get(out returnValue);
299                 anchorPointX?.Dispose();
300                 return returnValue;
301 #endif
302             }
303             set
304             {
305 #if NUI_PROPERTY_CHANGE_3
306                 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointX, value);
307 #else
308                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
309                 SetProperty(View.Property.AnchorPointX, setValue);
310                 setValue.Dispose();
311 #endif
312             }
313         }
314
315         internal float PivotPointY
316         {
317             get
318             {
319 #if NUI_PROPERTY_CHANGE_3
320                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointY);
321 #else
322
323                 float returnValue = 0.0f;
324                 PropertyValue anchorPointY = GetProperty(View.Property.AnchorPointY);
325                 anchorPointY?.Get(out returnValue);
326                 anchorPointY?.Dispose();
327                 return returnValue;
328 #endif
329             }
330             set
331             {
332 #if NUI_PROPERTY_CHANGE_3
333                 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointY, value);
334 #else
335                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
336                 SetProperty(View.Property.AnchorPointY, setValue);
337                 setValue.Dispose();
338 #endif
339             }
340         }
341
342         internal float PivotPointZ
343         {
344             get
345             {
346 #if NUI_PROPERTY_CHANGE_3
347                 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ);
348 #else
349                 float returnValue = 0.0f;
350                 PropertyValue anchorPointZ = GetProperty(View.Property.AnchorPointZ);
351                 anchorPointZ?.Get(out returnValue);
352                 anchorPointZ?.Dispose();
353                 return returnValue;
354 #endif            
355             }
356             set
357             {
358 #if NUI_PROPERTY_CHANGE_3
359                 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ, value);
360 #else
361                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
362                 SetProperty(View.Property.AnchorPointZ, setValue);
363                 setValue.Dispose();
364 #endif
365             }
366         }
367
368         internal Matrix WorldMatrix
369         {
370             get
371             {
372                 Matrix returnValue = new Matrix();
373                 PropertyValue wordMatrix = GetProperty(View.Property.WorldMatrix);
374                 wordMatrix?.Get(returnValue);
375                 wordMatrix?.Dispose();
376                 return returnValue;
377             }
378         }
379
380         /// <summary>
381         /// The number of layouts including view's layout and children's layouts.
382         /// This can be used to set/unset Process callback to calculate Layout.
383         /// </summary>
384         internal int LayoutCount
385         {
386             get
387             {
388                 return layoutCount;
389             }
390
391             set
392             {
393                 if (layoutCount == value) return;
394
395                 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
396
397                 int diff = value - layoutCount;
398                 layoutCount = value;
399
400                 if (InternalParent != null)
401                 {
402                     var parentView = InternalParent as View;
403                     if (parentView != null)
404                     {
405                         parentView.LayoutCount += diff;
406                     }
407                     else
408                     {
409                         var parentLayer = InternalParent as Layer;
410                         if (parentLayer != null)
411                         {
412                             parentLayer.LayoutCount += diff;
413                         }
414                     }
415                 }
416             }
417         }
418
419         /// <summary>
420         /// Indicates that this View should listen Touch event to handle its ControlState.
421         /// </summary>
422         private bool enableControlState = false;
423
424         private int LeftFocusableViewId
425         {
426             get
427             {
428 #if NUI_PROPERTY_CHANGE_3
429                 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId);
430 #else
431                 int returnValue = 0;
432                 PropertyValue leftFocusableViewId = GetProperty(View.Property.LeftFocusableViewId);
433                 leftFocusableViewId?.Get(out returnValue);
434                 leftFocusableViewId?.Dispose();
435                 return returnValue;
436 #endif
437             }
438             set
439             {
440 #if NUI_PROPERTY_CHANGE_3
441                 Object.InternalSetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId, value);
442 #else
443                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
444                 SetProperty(View.Property.LeftFocusableViewId, setValue);
445                 setValue.Dispose();
446 #endif
447             }
448         }
449
450         private int RightFocusableViewId
451         {
452             get
453             {
454 #if NUI_PROPERTY_CHANGE_3
455                 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId);
456 #else
457                 int returnValue = 0;
458                 PropertyValue rightFocusableViewId = GetProperty(View.Property.RightFocusableViewId);
459                 rightFocusableViewId?.Get(out returnValue);
460                 rightFocusableViewId?.Dispose();
461                 return returnValue;
462 #endif
463             }
464             set
465             {
466 #if NUI_PROPERTY_CHANGE_3
467                 Object.InternalSetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId, value);
468 #else
469                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
470                 SetProperty(View.Property.RightFocusableViewId, setValue);
471                 setValue.Dispose();
472 #endif
473             }
474         }
475
476         private int UpFocusableViewId
477         {
478             get
479             {
480 #if NUI_PROPERTY_CHANGE_3
481                 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId);
482 #else
483                 int returnValue = 0;
484                 PropertyValue upFocusableViewId = GetProperty(View.Property.UpFocusableViewId);
485                 upFocusableViewId?.Get(out returnValue);
486                 upFocusableViewId?.Dispose();
487                 return returnValue;
488 #endif
489             }
490             set
491             {
492 #if NUI_PROPERTY_CHANGE_3
493                 Object.InternalSetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId, value);
494 #else
495                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
496                 SetProperty(View.Property.UpFocusableViewId, setValue);
497                 setValue.Dispose();
498 #endif
499             }
500         }
501
502         private int DownFocusableViewId
503         {
504             get
505             {
506 #if NUI_PROPERTY_CHANGE_3
507                 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId);
508 #else
509                 int returnValue = 0;
510                 PropertyValue downFocusableViewId = GetProperty(View.Property.DownFocusableViewId);
511                 downFocusableViewId?.Get(out returnValue);
512                 downFocusableViewId?.Dispose();
513                 return returnValue;
514 #endif
515             }
516             set
517             {
518 #if NUI_PROPERTY_CHANGE_3
519                 Object.InternalSetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId, value);
520 #else
521                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
522                 SetProperty(View.Property.DownFocusableViewId, setValue);
523                 setValue.Dispose();
524 #endif
525             }
526         }
527
528         private int ClockwiseFocusableViewId
529         {
530             get
531             {
532 #if NUI_PROPERTY_CHANGE_3
533                 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId);
534 #else
535                 int returnValue = -1;
536                 PropertyValue clockwiseFocusableViewId = GetProperty(View.Property.ClockwiseFocusableViewId);
537                 clockwiseFocusableViewId?.Get(out returnValue);
538                 clockwiseFocusableViewId?.Dispose();
539                 return returnValue;
540 #endif
541             }
542             set
543             {
544 #if NUI_PROPERTY_CHANGE_3
545                 Object.InternalSetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId, value);
546 #else
547                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
548                 SetProperty(View.Property.ClockwiseFocusableViewId, setValue);
549                 setValue.Dispose();
550 #endif
551             }
552         }
553
554         private int CounterClockwiseFocusableViewId
555         {
556             get
557             {
558 #if NUI_PROPERTY_CHANGE_3
559                 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId);
560 #else
561                 int returnValue = -1;
562                 PropertyValue counterClockwiseFocusableViewId = GetProperty(View.Property.CounterClockwiseFocusableViewId);
563                 counterClockwiseFocusableViewId?.Get(out returnValue);
564                 counterClockwiseFocusableViewId?.Dispose();
565                 return returnValue;
566 #endif
567             }
568             set
569             {
570 #if NUI_PROPERTY_CHANGE_3
571                 Object.InternalSetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId, value);
572 #else
573                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
574                 SetProperty(View.Property.CounterClockwiseFocusableViewId, setValue);
575                 setValue.Dispose();
576 #endif
577             }
578         }
579
580         internal string GetName()
581         {
582             string ret = Interop.Actor.GetName(SwigCPtr);
583             if (NDalicPINVOKE.SWIGPendingException.Pending)
584                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585             return ret;
586         }
587
588         internal void SetName(string name)
589         {
590             Interop.Actor.SetName(SwigCPtr, name);
591             if (NDalicPINVOKE.SWIGPendingException.Pending)
592                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
593         }
594
595         internal uint GetId()
596         {
597             uint ret = Interop.Actor.GetId(SwigCPtr);
598             if (NDalicPINVOKE.SWIGPendingException.Pending)
599                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
600             return ret;
601         }
602
603         internal bool IsRoot()
604         {
605             bool ret = Interop.ActorInternal.IsRoot(SwigCPtr);
606             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607             return ret;
608         }
609
610         internal bool OnWindow()
611         {
612             bool ret = Interop.Actor.OnStage(SwigCPtr);
613             if (NDalicPINVOKE.SWIGPendingException.Pending)
614                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615             return ret;
616         }
617
618         internal View FindChildById(uint id)
619         {
620             //to fix memory leak issue, match the handle count with native side.
621             IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
622             View ret = this.GetInstanceSafely<View>(cPtr);
623             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624             return ret;
625         }
626
627         internal override View FindCurrentChildById(uint id)
628         {
629             return FindChildById(id);
630         }
631
632         internal void SetParentOrigin(Position origin)
633         {
634             Interop.ActorInternal.SetParentOrigin(SwigCPtr, Position.getCPtr(origin));
635             if (NDalicPINVOKE.SWIGPendingException.Pending)
636                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637         }
638
639         internal Position GetCurrentParentOrigin()
640         {
641 #if NUI_PROPERTY_CHANGE_3
642             if(internalCurrentParentOrigin == null)
643             {
644                 internalCurrentParentOrigin = new Position(0, 0, 0);
645             }
646
647             Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.ParentOrigin, internalCurrentParentOrigin.SwigCPtr);
648
649             if (NDalicPINVOKE.SWIGPendingException.Pending)
650             {
651                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652             }
653             return internalCurrentParentOrigin;
654 #else
655             Position ret = new Position(Interop.ActorInternal.GetCurrentParentOrigin(SwigCPtr), true);
656
657             if (NDalicPINVOKE.SWIGPendingException.Pending)
658                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659             return ret;
660 #endif            
661         }
662
663         internal void SetAnchorPoint(Position anchorPoint)
664         {
665             Interop.Actor.SetAnchorPoint(SwigCPtr, Position.getCPtr(anchorPoint));
666             if (NDalicPINVOKE.SWIGPendingException.Pending)
667                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
668         }
669
670         internal Position GetCurrentAnchorPoint()
671         {
672 #if NUI_PROPERTY_CHANGE_3
673             if(internalCurrentAnchorPoint == null)
674             {
675                 internalCurrentAnchorPoint = new Position(0, 0, 0);
676             }
677
678             Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.AnchorPoint, internalCurrentAnchorPoint.SwigCPtr);
679
680             if (NDalicPINVOKE.SWIGPendingException.Pending)
681             {
682                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
683             }
684             return internalCurrentAnchorPoint;
685 #else
686             Position ret = new Position(Interop.ActorInternal.GetCurrentAnchorPoint(SwigCPtr), true);
687             if (NDalicPINVOKE.SWIGPendingException.Pending)
688                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
689             return ret;
690 #endif            
691         }
692
693         internal void SetSize(float width, float height)
694         {
695             Interop.ActorInternal.SetSize(SwigCPtr, width, height);
696             if (NDalicPINVOKE.SWIGPendingException.Pending)
697                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698         }
699
700         internal void SetSize(float width, float height, float depth)
701         {
702             Interop.ActorInternal.SetSize(SwigCPtr, width, height, depth);
703             if (NDalicPINVOKE.SWIGPendingException.Pending)
704                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705         }
706
707         internal void SetSize(Vector2 size)
708         {
709             Interop.ActorInternal.SetSizeVector2(SwigCPtr, Vector2.getCPtr(size));
710             if (NDalicPINVOKE.SWIGPendingException.Pending)
711                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712         }
713
714         internal void SetSize(Vector3 size)
715         {
716             Interop.ActorInternal.SetSizeVector3(SwigCPtr, Vector3.getCPtr(size));
717             if (NDalicPINVOKE.SWIGPendingException.Pending)
718                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719         }
720
721         internal Vector3 GetTargetSize()
722         {
723 #if NUI_PROPERTY_CHANGE_3
724             if(internalTargetSize == null)
725             {
726                 internalTargetSize = new Vector3(0, 0, 0);
727             }
728             
729             Interop.ActorInternal.RetrieveTargetSize(SwigCPtr, internalTargetSize.SwigCPtr);
730             
731             if (NDalicPINVOKE.SWIGPendingException.Pending)
732             {
733                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
734             }
735             return internalTargetSize;
736 #else
737             Vector3 ret = new Vector3(Interop.ActorInternal.GetTargetSize(SwigCPtr), true);
738             if (NDalicPINVOKE.SWIGPendingException.Pending)
739                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740             return ret;
741 #endif
742         }
743
744         internal Size2D GetCurrentSize()
745         {
746 #if NUI_PROPERTY_CHANGE_3
747             if(internalCurrentSize == null)
748             {
749                 internalCurrentSize = new Size2D(0, 0);
750             }
751             
752             Interop.ActorInternal.RetrieveCurrentPropertyVector2ActualVector3(SwigCPtr, Property.SIZE, internalCurrentSize.SwigCPtr);
753
754             if (NDalicPINVOKE.SWIGPendingException.Pending)
755             {
756                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
757             }
758             return internalCurrentSize;
759 #else
760             Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
761             if (NDalicPINVOKE.SWIGPendingException.Pending)
762                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763             Size2D size = new Size2D((int)ret.Width, (int)ret.Height);
764             ret.Dispose();
765             return size;
766 #endif
767         }
768
769         internal Size2D GetCurrentSizeFloat()
770         {
771             Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
772             if (NDalicPINVOKE.SWIGPendingException.Pending)
773                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
774             return ret;
775         }
776
777         /// <summary>
778         /// GetNaturalSize() function behaviour can be changed for each subclass of View.
779         /// So we make GetNaturalSize() function virtual, and make subclass can define it's owned logic
780         /// </summary>
781         internal virtual Vector3 GetNaturalSize()
782         {
783             Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
784             if (NDalicPINVOKE.SWIGPendingException.Pending)
785                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786             return ret;
787         }
788
789         internal void SetX(float x)
790         {
791             Interop.ActorInternal.SetX(SwigCPtr, x);
792             if (NDalicPINVOKE.SWIGPendingException.Pending)
793                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
794         }
795
796         internal void SetY(float y)
797         {
798             Interop.ActorInternal.SetY(SwigCPtr, y);
799             if (NDalicPINVOKE.SWIGPendingException.Pending)
800                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801         }
802
803         internal void SetZ(float z)
804         {
805             Interop.ActorInternal.SetZ(SwigCPtr, z);
806             if (NDalicPINVOKE.SWIGPendingException.Pending)
807                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808         }
809
810         internal void TranslateBy(Vector3 distance)
811         {
812             Interop.ActorInternal.TranslateBy(SwigCPtr, Vector3.getCPtr(distance));
813             if (NDalicPINVOKE.SWIGPendingException.Pending)
814                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815         }
816
817         internal Position GetCurrentPosition()
818         {
819 #if NUI_PROPERTY_CHANGE_3
820             if(internalCurrentPosition == null)
821             {
822                 internalCurrentPosition = new Position(0, 0, 0);
823             }
824             
825             Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, Property.POSITION, internalCurrentPosition.SwigCPtr);
826
827             if (NDalicPINVOKE.SWIGPendingException.Pending)
828             {
829                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830             }
831             return internalCurrentPosition;
832 #else
833
834             Position ret = new Position(Interop.Actor.GetCurrentPosition(SwigCPtr), true);
835             if (NDalicPINVOKE.SWIGPendingException.Pending)
836                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837             return ret;
838 #endif
839         }
840         internal Vector3 GetCurrentWorldPosition()
841         {
842 #if NUI_PROPERTY_CHANGE_3
843             if(internalCurrentWorldPosition == null)
844             {
845                 internalCurrentWorldPosition = new Vector3(0, 0, 0);
846             }
847             
848             Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldPosition, internalCurrentWorldPosition.SwigCPtr);
849
850             if (NDalicPINVOKE.SWIGPendingException.Pending)
851             {
852                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
853             }
854             return internalCurrentWorldPosition;
855 #else
856             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldPosition(SwigCPtr), true);
857             if (NDalicPINVOKE.SWIGPendingException.Pending)
858                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
859             return ret;
860 #endif
861         }
862
863         internal Vector2 GetCurrentScreenPosition()
864         {
865 #if NUI_VISUAL_PROPERTY_CHANGE_1
866             if(internalCurrentScreenPosition == null)
867             {
868                 internalCurrentScreenPosition = new Vector2(0, 0);
869             }
870
871             Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.ScreenPosition, internalCurrentScreenPosition.SwigCPtr);
872
873             if (NDalicPINVOKE.SWIGPendingException.Pending)
874             {
875                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
876             }
877             return internalCurrentScreenPosition;
878 #else
879             Vector2 temp = new Vector2(0.0f, 0.0f);
880             var pValue = GetProperty(View.Property.ScreenPosition);
881             pValue.Get(temp);
882             pValue.Dispose();
883             return temp;
884 #endif
885         }
886
887         internal Vector4 GetCurrentScreenPositionSize()
888         {
889             Vector4 ret = new Vector4(Interop.Actor.CalculateScreenExtents(SwigCPtr), true);
890             if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
891             return ret;
892         }
893
894         internal void SetInheritPosition(bool inherit)
895         {
896             Interop.ActorInternal.SetInheritPosition(SwigCPtr, inherit);
897             if (NDalicPINVOKE.SWIGPendingException.Pending)
898                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
899         }
900
901         internal bool IsPositionInherited()
902         {
903             bool ret = Interop.ActorInternal.IsPositionInherited(SwigCPtr);
904             if (NDalicPINVOKE.SWIGPendingException.Pending)
905                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906             return ret;
907         }
908
909         internal void SetOrientation(Degree angle, Vector3 axis)
910         {
911             Interop.ActorInternal.SetOrientationDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
912             if (NDalicPINVOKE.SWIGPendingException.Pending)
913                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
914         }
915
916         internal void SetOrientation(Radian angle, Vector3 axis)
917         {
918             Interop.ActorInternal.SetOrientationRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
919             if (NDalicPINVOKE.SWIGPendingException.Pending)
920                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921         }
922
923         internal void SetOrientation(Rotation orientation)
924         {
925             Interop.ActorInternal.SetOrientationQuaternion(SwigCPtr, Rotation.getCPtr(orientation));
926             if (NDalicPINVOKE.SWIGPendingException.Pending)
927                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
928         }
929
930         internal Rotation GetCurrentOrientation()
931         {
932             Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentOrientation(SwigCPtr), true);
933             if (NDalicPINVOKE.SWIGPendingException.Pending)
934                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935             return ret;
936         }
937
938         internal void SetInheritOrientation(bool inherit)
939         {
940             Interop.ActorInternal.SetInheritOrientation(SwigCPtr, inherit);
941             if (NDalicPINVOKE.SWIGPendingException.Pending)
942                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
943         }
944
945         internal bool IsOrientationInherited()
946         {
947             bool ret = Interop.ActorInternal.IsOrientationInherited(SwigCPtr);
948             if (NDalicPINVOKE.SWIGPendingException.Pending)
949                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
950             return ret;
951         }
952
953         internal Rotation GetCurrentWorldOrientation()
954         {
955             Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentWorldOrientation(SwigCPtr), true);
956             if (NDalicPINVOKE.SWIGPendingException.Pending)
957                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
958             return ret;
959         }
960
961         internal void SetScale(float scale)
962         {
963             Interop.ActorInternal.SetScale(SwigCPtr, scale);
964             if (NDalicPINVOKE.SWIGPendingException.Pending)
965                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
966         }
967
968         internal void SetScale(float scaleX, float scaleY, float scaleZ)
969         {
970             Interop.ActorInternal.SetScale(SwigCPtr, scaleX, scaleY, scaleZ);
971             if (NDalicPINVOKE.SWIGPendingException.Pending)
972                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973         }
974
975         internal void SetScale(Vector3 scale)
976         {
977             Interop.ActorInternal.SetScale(SwigCPtr, Vector3.getCPtr(scale));
978             if (NDalicPINVOKE.SWIGPendingException.Pending)
979                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
980         }
981
982         internal Vector3 GetCurrentScale()
983         {
984 #if NUI_PROPERTY_CHANGE_3
985             if(internalCurrentScale == null)
986             {
987                 internalCurrentScale = new Vector3(0, 0, 0);
988             }
989             
990             Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.SCALE, internalCurrentScale.SwigCPtr);
991
992             if (NDalicPINVOKE.SWIGPendingException.Pending)
993             {
994                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995             }
996             return internalCurrentScale;
997 #else
998
999             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentScale(SwigCPtr), true);
1000             if (NDalicPINVOKE.SWIGPendingException.Pending)
1001                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1002             return ret;
1003 #endif        
1004         }
1005
1006         internal Vector3 GetCurrentWorldScale()
1007         {
1008 #if NUI_PROPERTY_CHANGE_3
1009             if(internalCurrentWorldScale == null)
1010             {
1011                 internalCurrentWorldScale = new Vector3(0, 0, 0);
1012             }
1013             
1014             Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldScale, internalCurrentWorldScale.SwigCPtr);
1015
1016             if (NDalicPINVOKE.SWIGPendingException.Pending)
1017             {
1018                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019             }
1020             return internalCurrentWorldScale;
1021 #else
1022
1023             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldScale(SwigCPtr), true);
1024             if (NDalicPINVOKE.SWIGPendingException.Pending)
1025                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1026             return ret;
1027 #endif
1028         }
1029
1030         internal void SetInheritScale(bool inherit)
1031         {
1032             Interop.ActorInternal.SetInheritScale(SwigCPtr, inherit);
1033             if (NDalicPINVOKE.SWIGPendingException.Pending)
1034                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035         }
1036
1037         internal bool IsScaleInherited()
1038         {
1039             bool ret = Interop.ActorInternal.IsScaleInherited(SwigCPtr);
1040             if (NDalicPINVOKE.SWIGPendingException.Pending)
1041                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042             return ret;
1043         }
1044
1045         internal Matrix GetCurrentWorldMatrix()
1046         {
1047             Matrix ret = new Matrix(Interop.ActorInternal.GetCurrentWorldMatrix(SwigCPtr), true);
1048             if (NDalicPINVOKE.SWIGPendingException.Pending)
1049                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1050             return ret;
1051         }
1052
1053         internal void SetVisible(bool visible)
1054         {
1055             Interop.Actor.SetVisible(SwigCPtr, visible);
1056             if (NDalicPINVOKE.SWIGPendingException.Pending)
1057                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1058         }
1059
1060         /// <summary>
1061         /// Retrieve the View's current Visibility.
1062         /// </summary>
1063         /// <remarks>
1064         /// The <see cref="Visibility"/> property is set in the main thread, so it is not updated in real time when the value is changed in the render thread.
1065         /// However, this method can get the current actual value updated in real time.
1066         /// </remarks>
1067         internal bool IsVisible()
1068         {
1069             bool ret = Interop.ActorInternal.IsVisible(SwigCPtr);
1070             if (NDalicPINVOKE.SWIGPendingException.Pending)
1071                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1072             return ret;
1073         }
1074
1075         internal void SetOpacity(float opacity)
1076         {
1077             Interop.ActorInternal.SetOpacity(SwigCPtr, opacity);
1078             if (NDalicPINVOKE.SWIGPendingException.Pending)
1079                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1080         }
1081
1082         internal float GetCurrentOpacity()
1083         {
1084             float ret = Interop.ActorInternal.GetCurrentOpacity(SwigCPtr);
1085             if (NDalicPINVOKE.SWIGPendingException.Pending)
1086                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1087             return ret;
1088         }
1089
1090         internal Vector4 GetCurrentColor()
1091         {
1092 #if NUI_PROPERTY_CHANGE_3
1093             if(internalCurrentColor == null)
1094             {
1095                 internalCurrentColor = new Vector4(0, 0, 0, 0);
1096             }
1097             
1098             Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Interop.ActorProperty.ColorGet(), internalCurrentColor.SwigCPtr);
1099
1100             if (NDalicPINVOKE.SWIGPendingException.Pending)
1101             {
1102                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1103             }
1104             return internalCurrentColor;
1105 #else
1106
1107             Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentColor(SwigCPtr), true);
1108             if (NDalicPINVOKE.SWIGPendingException.Pending)
1109                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1110             return ret;
1111 #endif
1112         }
1113         internal ColorMode GetColorMode()
1114         {
1115             ColorMode ret = (ColorMode)Interop.ActorInternal.GetColorMode(SwigCPtr);
1116             if (NDalicPINVOKE.SWIGPendingException.Pending)
1117                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118             return ret;
1119         }
1120
1121         internal Vector4 GetCurrentWorldColor()
1122         {
1123 #if NUI_PROPERTY_CHANGE_3
1124             if(internalCurrentWorldColor == null)
1125             {
1126                 internalCurrentWorldColor = new Vector4(0, 0, 0, 0);
1127             }
1128             
1129             Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Property.WorldColor, internalCurrentWorldColor.SwigCPtr);
1130
1131             if (NDalicPINVOKE.SWIGPendingException.Pending)
1132             {
1133                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1134             }
1135             return internalCurrentWorldColor;
1136 #else
1137
1138             Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentWorldColor(SwigCPtr), true);
1139             if (NDalicPINVOKE.SWIGPendingException.Pending)
1140                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1141             return ret;
1142 #endif            
1143         }
1144
1145         internal void SetDrawMode(DrawModeType drawMode)
1146         {
1147             Interop.ActorInternal.SetDrawMode(SwigCPtr, (int)drawMode);
1148             if (NDalicPINVOKE.SWIGPendingException.Pending)
1149                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1150         }
1151
1152         internal DrawModeType GetDrawMode()
1153         {
1154             DrawModeType ret = (DrawModeType)Interop.ActorInternal.GetDrawMode(SwigCPtr);
1155             if (NDalicPINVOKE.SWIGPendingException.Pending)
1156                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1157             return ret;
1158         }
1159
1160         internal void SetKeyboardFocusable(bool focusable)
1161         {
1162             Interop.ActorInternal.SetKeyboardFocusable(SwigCPtr, focusable);
1163             if (NDalicPINVOKE.SWIGPendingException.Pending)
1164                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1165         }
1166
1167         internal bool IsKeyboardFocusable()
1168         {
1169             bool ret = Interop.ActorInternal.IsKeyboardFocusable(SwigCPtr);
1170             if (NDalicPINVOKE.SWIGPendingException.Pending)
1171                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1172             return ret;
1173         }
1174
1175         internal void SetKeyboardFocusableChildren(bool focusable)
1176         {
1177             Interop.ActorInternal.SetKeyboardFocusableChildren(SwigCPtr, focusable);
1178             if (NDalicPINVOKE.SWIGPendingException.Pending)
1179                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1180         }
1181
1182         internal bool AreChildrenKeyBoardFocusable()
1183         {
1184             bool ret = Interop.ActorInternal.AreChildrenKeyBoardFocusable(SwigCPtr);
1185             if (NDalicPINVOKE.SWIGPendingException.Pending)
1186                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1187             return ret;
1188         }
1189
1190         internal void SetFocusableInTouch(bool enabled)
1191         {
1192             Interop.ActorInternal.SetFocusableInTouch(SwigCPtr, enabled);
1193             if (NDalicPINVOKE.SWIGPendingException.Pending)
1194                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1195         }
1196
1197         internal bool IsFocusableInTouch()
1198         {
1199             bool ret = Interop.ActorInternal.IsFocusableInTouch(SwigCPtr);
1200             if (NDalicPINVOKE.SWIGPendingException.Pending)
1201                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1202             return ret;
1203         }
1204
1205         internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
1206         {
1207             Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
1208             if (NDalicPINVOKE.SWIGPendingException.Pending)
1209                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1210         }
1211
1212         internal ResizePolicyType GetResizePolicy(DimensionType dimension)
1213         {
1214             ResizePolicyType ret = (ResizePolicyType)Interop.Actor.GetResizePolicy(SwigCPtr, (int)dimension);
1215             if (NDalicPINVOKE.SWIGPendingException.Pending)
1216                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1217             return ret;
1218         }
1219
1220         internal Vector3 GetSizeModeFactor()
1221         {
1222 #if NUI_PROPERTY_CHANGE_1
1223                 if (internalSizeModeFactor == null)
1224                 {
1225                     internalSizeModeFactor = new Vector3(OnSizeModeFactorChanged, 0, 0, 0);
1226                 }
1227                 Object.InternalRetrievingPropertyVector3(SwigCPtr, View.Property.SizeModeFactor, internalSizeModeFactor.SwigCPtr);
1228                 return internalSizeModeFactor;
1229 #else
1230
1231             Vector3 ret = new Vector3(Interop.Actor.GetSizeModeFactor(SwigCPtr), true);
1232             if (NDalicPINVOKE.SWIGPendingException.Pending)
1233                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1234             return ret;
1235 #endif
1236         }
1237
1238         internal void SetMinimumSize(Vector2 size)
1239         {
1240             Interop.ActorInternal.SetMinimumSize(SwigCPtr, Vector2.getCPtr(size));
1241             if (NDalicPINVOKE.SWIGPendingException.Pending)
1242                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1243         }
1244
1245         internal Vector2 GetMinimumSize()
1246         {
1247 #if NUI_PROPERTY_CHANGE_1
1248             if (internalMinimumSize == null)
1249             {
1250                 internalMinimumSize = new Size2D(OnMinimumSizeChanged, 0, 0);
1251             }
1252             Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MinimumSize, internalMinimumSize.SwigCPtr);
1253             return internalMinimumSize;
1254 #else
1255             Vector2 ret = new Vector2(Interop.ActorInternal.GetMinimumSize(SwigCPtr), true);
1256             if (NDalicPINVOKE.SWIGPendingException.Pending)
1257                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1258             return ret;
1259 #endif
1260         }
1261
1262         internal void SetMaximumSize(Vector2 size)
1263         {
1264             Interop.ActorInternal.SetMaximumSize(SwigCPtr, Vector2.getCPtr(size));
1265             if (NDalicPINVOKE.SWIGPendingException.Pending)
1266                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1267         }
1268
1269         internal Vector2 GetMaximumSize()
1270         {
1271 #if NUI_PROPERTY_CHANGE_1
1272             if (internalMaximumSize == null)
1273             {
1274                 internalMaximumSize = new Size2D(OnMaximumSizeChanged, 0, 0);
1275             }
1276             Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MaximumSize, internalMaximumSize.SwigCPtr);
1277             return internalMaximumSize;
1278 #else
1279
1280             Vector2 ret = new Vector2(Interop.ActorInternal.GetMaximumSize(SwigCPtr), true);
1281             if (NDalicPINVOKE.SWIGPendingException.Pending)
1282                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283             return ret;
1284 #endif
1285         }
1286
1287         internal int GetHierarchyDepth()
1288         {
1289             int ret = Interop.Actor.GetHierarchyDepth(SwigCPtr);
1290             if (NDalicPINVOKE.SWIGPendingException.Pending)
1291                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1292             return ret;
1293         }
1294
1295         internal uint GetRendererCount()
1296         {
1297             uint ret = Interop.Actor.GetRendererCount(SwigCPtr);
1298             if (NDalicPINVOKE.SWIGPendingException.Pending)
1299                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1300             return ret;
1301         }
1302
1303         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
1304         {
1305             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1306         }
1307
1308         internal bool IsTopLevelView()
1309         {
1310             if (GetParent() is Layer)
1311             {
1312                 return true;
1313             }
1314             return false;
1315         }
1316
1317         /// <summary>
1318         /// Check whether Current view don't has BackgroundVisual or not.
1319         /// Some API (like Animation, Borderline) required non-empty backgrounds.
1320         /// </summary>
1321         internal bool IsBackgroundEmpty()
1322         {
1323 #if NUI_VISUAL_PROPERTY_CHANGE_1
1324             int visualType = (int)Visual.Type.Invalid;
1325             Interop.View.InternalRetrievingVisualPropertyInt(this.SwigCPtr, Property.BACKGROUND, Visual.Property.Type, out visualType);
1326             return visualType == (int)Visual.Type.Invalid;
1327 #else
1328             PropertyMap background = Background;
1329             return (background == null || background.Empty());
1330 #endif
1331         }
1332
1333         internal void SetKeyInputFocus()
1334         {
1335             Interop.ViewInternal.SetKeyInputFocus(SwigCPtr);
1336             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1337         }
1338
1339         internal void ClearKeyInputFocus()
1340         {
1341             Interop.ViewInternal.ClearKeyInputFocus(SwigCPtr);
1342             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1343         }
1344
1345         internal PinchGestureDetector GetPinchGestureDetector()
1346         {
1347             PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.GetPinchGestureDetector(SwigCPtr), true);
1348             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349             return ret;
1350         }
1351
1352         internal PanGestureDetector GetPanGestureDetector()
1353         {
1354             PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.GetPanGestureDetector(SwigCPtr), true);
1355             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1356             return ret;
1357         }
1358
1359         internal TapGestureDetector GetTapGestureDetector()
1360         {
1361             TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.GetTapGestureDetector(SwigCPtr), true);
1362             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1363             return ret;
1364         }
1365
1366         internal LongPressGestureDetector GetLongPressGestureDetector()
1367         {
1368             LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.GetLongPressGestureDetector(SwigCPtr), true);
1369             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1370             return ret;
1371         }
1372
1373         internal IntPtr GetPtrfromView()
1374         {
1375             return (IntPtr)SwigCPtr;
1376         }
1377
1378         internal void RemoveChild(View child)
1379         {
1380             // If the view had focus, it clears focus.
1381             if (child == FocusManager.Instance.GetCurrentFocusView())
1382             {
1383                 FocusManager.Instance.ClearFocus();
1384             }
1385             // Do actual child removal
1386             Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
1387             if (NDalicPINVOKE.SWIGPendingException.Pending)
1388                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1389
1390             Children.Remove(child);
1391             child.InternalParent = null;
1392             LayoutCount -= child.LayoutCount;
1393
1394             OnChildRemoved(child);
1395             if (ChildRemoved != null)
1396             {
1397                 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1398                 {
1399                     Removed = child
1400                 };
1401                 ChildRemoved(this, e);
1402             }
1403         }
1404
1405         /// <summary>
1406         /// Removes the layout from this View.
1407         /// </summary>
1408         internal void ResetLayout()
1409         {
1410             LayoutCount--;
1411
1412             layout = null;
1413         }
1414
1415         internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1416         {
1417             return (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1418         }
1419
1420         /// TODO open as a protected level
1421         internal virtual void ApplyCornerRadius()
1422         {
1423             if (backgroundExtraData == null) return;
1424
1425 #if NUI_VISUAL_PROPERTY_CHANGE_1
1426             // Update corner radius properties to background and shadow by ActionUpdateProperty
1427             if (backgroundExtraData.CornerRadius != null)
1428             {
1429                 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1430                 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1431             }
1432             Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1433             Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1434 #else
1435             var cornerRadiusValue = backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius);
1436             var cornerRadiusPolicyValue = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
1437
1438             // Make current propertyMap
1439             PropertyMap currentPropertyMap = new PropertyMap();
1440             currentPropertyMap[Visual.Property.CornerRadius] = cornerRadiusValue;
1441             currentPropertyMap[Visual.Property.CornerRadiusPolicy] = cornerRadiusPolicyValue;
1442             var temp = new PropertyValue(currentPropertyMap);
1443
1444             // Update corner radius properties to background and shadow by ActionUpdateProperty
1445             DoAction(View.Property.BACKGROUND, ActionUpdateProperty, temp);
1446             DoAction(View.Property.SHADOW, ActionUpdateProperty, temp);
1447
1448             temp.Dispose();
1449             currentPropertyMap.Dispose();
1450             cornerRadiusValue.Dispose();
1451             cornerRadiusPolicyValue.Dispose();
1452 #endif
1453         }
1454
1455         /// TODO open as a protected level
1456         internal virtual void ApplyBorderline()
1457         {
1458             if (backgroundExtraData == null) return;
1459
1460 #if NUI_VISUAL_PROPERTY_CHANGE_1
1461             // ActionUpdateProperty works well only if BACKGROUND visual setup before.
1462             // If view don't have BACKGROUND visual, we set transparent background color in default.
1463             if (IsBackgroundEmpty())
1464             {
1465                 // BACKGROUND visual doesn't exist.
1466                 SetBackgroundColor(Color.Transparent);
1467                 // SetBackgroundColor function apply borderline internally.
1468                 // So we can just return now.
1469                 return;
1470             }
1471
1472             // Update borderline properties to background by ActionUpdateProperty
1473             Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineWidth, backgroundExtraData.BorderlineWidth);
1474             Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineColor, Vector4.getCPtr(backgroundExtraData.BorderlineColor ?? Color.Black));
1475             Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineOffset, backgroundExtraData.BorderlineOffset);
1476 #else
1477             // ActionUpdateProperty works well only if BACKGROUND visual setup before.
1478             // If view don't have BACKGROUND visual, we set transparent background color in default.
1479             using (PropertyMap backgroundPropertyMap = new PropertyMap())
1480             {
1481                 using (PropertyValue propertyValue = Object.GetProperty(SwigCPtr, Property.BACKGROUND))
1482                 {
1483                     propertyValue?.Get(backgroundPropertyMap);
1484                     if (backgroundPropertyMap.Empty())
1485                     {
1486                         // BACKGROUND visual doesn't exist.
1487                         SetBackgroundColor(Color.Transparent);
1488                         // SetBackgroundColor function apply borderline internally.
1489                         // So we can just return now.
1490                         return;
1491                     }
1492                 }
1493             }
1494
1495             var borderlineWidthValue = new PropertyValue(backgroundExtraData.BorderlineWidth);
1496             var borderlineColorValue = backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor);
1497             var borderlineOffsetValue = new PropertyValue(backgroundExtraData.BorderlineOffset);
1498
1499             // Make current propertyMap
1500             PropertyMap currentPropertyMap = new PropertyMap();
1501             currentPropertyMap[Visual.Property.BorderlineWidth] = borderlineWidthValue;
1502             currentPropertyMap[Visual.Property.BorderlineColor] = borderlineColorValue;
1503             currentPropertyMap[Visual.Property.BorderlineOffset] = borderlineOffsetValue;
1504             var temp = new PropertyValue(currentPropertyMap);
1505
1506             // Update borderline properties to background  by ActionUpdateProperty
1507             DoAction(View.Property.BACKGROUND, ActionUpdateProperty, temp);
1508
1509             temp.Dispose();
1510             currentPropertyMap.Dispose();
1511             borderlineWidthValue.Dispose();
1512             borderlineColorValue.Dispose();
1513             borderlineOffsetValue.Dispose();
1514 #endif
1515         }
1516
1517         /// <summary>
1518         /// Get selector value from the triggerable selector or related property.
1519         /// </summary>
1520         internal Selector<T> GetSelector<T>(TriggerableSelector<T> triggerableSelector, NUI.Binding.BindableProperty relatedProperty)
1521         {
1522             var selector = triggerableSelector?.Get();
1523             if (selector != null)
1524             {
1525                 return selector;
1526             }
1527
1528             var value = (T)GetValue(relatedProperty);
1529             return value == null ? null : new Selector<T>(value);
1530         }
1531
1532         internal void SetThemeApplied()
1533         {
1534             if (themeData == null) themeData = new ThemeData();
1535             themeData.ThemeApplied = true;
1536
1537             if (ThemeChangeSensitive && !themeData.ListeningThemeChangeEvent)
1538             {
1539                 themeData.ListeningThemeChangeEvent = true;
1540                 ThemeManager.ThemeChangedInternal.Add(OnThemeChanged);
1541             }
1542         }
1543
1544         /// <summary>
1545         /// you can override it to clean-up your own resources.
1546         /// </summary>
1547         /// <param name="type">DisposeTypes</param>
1548         /// <since_tizen> 3 </since_tizen>
1549         protected override void Dispose(DisposeTypes type)
1550         {
1551             if (disposed)
1552             {
1553                 return;
1554             }
1555
1556             disposeDebugging(type);
1557
1558             //_mergedStyle = null;
1559
1560             internalMaximumSize?.Dispose();
1561             internalMaximumSize = null;
1562             internalMinimumSize?.Dispose();
1563             internalMinimumSize = null;
1564             internalMargin?.Dispose();
1565             internalMargin = null;
1566             internalPadding?.Dispose();
1567             internalPadding = null;
1568             internalSizeModeFactor?.Dispose();
1569             internalSizeModeFactor = null;
1570             internalCellIndex?.Dispose();
1571             internalCellIndex = null;
1572             internalBackgroundColor?.Dispose();
1573             internalBackgroundColor = null;
1574             internalColor?.Dispose();
1575             internalColor = null;
1576             internalPivotPoint?.Dispose();
1577             internalPivotPoint = null;
1578             internalPosition?.Dispose();
1579             internalPosition = null;
1580             internalPosition2D?.Dispose();
1581             internalPosition2D = null;
1582             internalScale?.Dispose();
1583             internalScale = null;
1584             internalSize?.Dispose();
1585             internalSize = null;
1586             internalSize2D?.Dispose();
1587             internalSize2D = null;
1588
1589             panGestureDetector?.Dispose();
1590             panGestureDetector = null;
1591             longGestureDetector?.Dispose();
1592             longGestureDetector = null;
1593             pinchGestureDetector?.Dispose();
1594             pinchGestureDetector = null;
1595             tapGestureDetector?.Dispose();
1596             tapGestureDetector = null;
1597             rotationGestureDetector?.Dispose();
1598             rotationGestureDetector = null;
1599
1600 #if NUI_PROPERTY_CHANGE_3
1601             internalCurrentParentOrigin?.Dispose();
1602             internalCurrentParentOrigin = null;
1603             internalCurrentAnchorPoint?.Dispose();
1604             internalCurrentAnchorPoint = null;
1605             internalTargetSize?.Dispose();
1606             internalTargetSize = null;
1607             internalCurrentSize?.Dispose();
1608             internalCurrentSize = null;
1609             internalNaturalSize?.Dispose();
1610             internalNaturalSize = null;
1611             internalCurrentPosition?.Dispose();
1612             internalCurrentPosition = null;
1613             internalCurrentWorldPosition?.Dispose();
1614             internalCurrentWorldPosition = null;
1615             internalCurrentScale?.Dispose();
1616             internalCurrentScale = null;
1617             internalCurrentWorldScale?.Dispose();
1618             internalCurrentWorldScale = null;
1619             internalCurrentColor?.Dispose();
1620             internalCurrentColor = null;
1621             internalCurrentWorldColor?.Dispose();
1622             internalCurrentWorldColor = null;
1623             internalSizeModeFactor?.Dispose();
1624             internalSizeModeFactor = null;
1625 #endif
1626 #if NUI_VISUAL_PROPERTY_CHANGE_1
1627             internalCurrentScreenPosition?.Dispose();
1628             internalCurrentScreenPosition = null;
1629 #endif
1630
1631             if (type == DisposeTypes.Explicit)
1632             {
1633                 //Called by User
1634                 //Release your own managed resources here.
1635                 //You should release all of your own disposable objects here.
1636                 if (themeData != null)
1637                 {
1638                     themeData.selectorData?.Reset(this);
1639                     if (themeData.ListeningThemeChangeEvent)
1640                     {
1641                         ThemeManager.ThemeChangedInternal.Remove(OnThemeChanged);
1642                     }
1643                 }
1644                 if (widthConstraint != null)
1645                 {
1646                     widthConstraint.Remove();
1647                     widthConstraint.Dispose();
1648                 }
1649                 if (heightConstraint != null)
1650                 {
1651                     heightConstraint.Remove();
1652                     heightConstraint.Dispose();
1653                 }
1654             }
1655
1656             //Release your own unmanaged resources here.
1657             //You should not access any managed member here except static instance.
1658             //because the execution order of Finalizes is non-deterministic.
1659
1660             DisConnectFromSignals();
1661
1662             foreach (View view in Children)
1663             {
1664                 view.InternalParent = null;
1665             }
1666
1667             LayoutCount = 0;
1668
1669             NUILog.Debug($"[Dispose] View.Dispose({type}) END");
1670             NUILog.Debug($"=============================");
1671
1672             base.Dispose(type);
1673         }
1674
1675         /// This will not be public opened.
1676         [EditorBrowsable(EditorBrowsableState.Never)]
1677         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1678         {
1679             Interop.View.DeleteView(swigCPtr);
1680         }
1681
1682         /// <summary>
1683         /// The touch event handler for ControlState.
1684         /// Please change ControlState value by touch state if needed.
1685         /// </summary>
1686         /// <exception cref="ArgumentNullException"> Thrown when touch is null. </exception>
1687         [EditorBrowsable(EditorBrowsableState.Never)]
1688         protected virtual bool HandleControlStateOnTouch(Touch touch)
1689         {
1690             if (touch == null)
1691             {
1692                 throw new global::System.ArgumentNullException(nameof(touch));
1693             }
1694
1695             switch (touch.GetState(0))
1696             {
1697                 case PointStateType.Down:
1698                     ControlState += ControlState.Pressed;
1699                     break;
1700                 case PointStateType.Interrupted:
1701                 case PointStateType.Up:
1702                     if (ControlState.Contains(ControlState.Pressed))
1703                     {
1704                         ControlState -= ControlState.Pressed;
1705                     }
1706                     break;
1707                 default:
1708                     break;
1709             }
1710             return false;
1711         }
1712
1713         /// <summary>
1714         /// Internal callback of enabled property changes.
1715         /// Inherited view can override this method to implements enabled property changes.
1716         /// </summary>
1717         [EditorBrowsable(EditorBrowsableState.Never)]
1718         protected virtual void OnEnabled(bool enabled)
1719         {
1720             if (enabled)
1721             {
1722                 if (State == View.States.Disabled)
1723                 {
1724                     State = View.States.Normal;
1725                 }
1726                 if (enableControlState)
1727                 {
1728                     ControlState -= ControlState.Disabled;
1729                 }
1730             }
1731             else
1732             {
1733                 State = View.States.Disabled;
1734                 if (enableControlState)
1735                 {
1736                     ControlState += ControlState.Disabled;
1737                 }
1738             }
1739         }
1740
1741
1742         private void DisConnectFromSignals()
1743         {
1744             if (HasBody() == false)
1745             {
1746                 NUILog.Debug($"[Dispose] DisConnectFromSignals() No native body! No need to Disconnect Signals!");
1747                 return;
1748             }
1749             NUILog.Debug($"[Dispose] DisConnectFromSignals START");
1750             NUILog.Debug($"[Dispose] View.DisConnectFromSignals() type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1751             NUILog.Debug($"[Dispose] ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
1752
1753             if (onRelayoutEventCallback != null)
1754             {
1755                 NUILog.Debug($"[Dispose] onRelayoutEventCallback");
1756
1757                 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(GetBaseHandleCPtrHandleRef), false);
1758                 signal?.Disconnect(onRelayoutEventCallback);
1759                 onRelayoutEventCallback = null;
1760             }
1761
1762             if (offWindowEventCallback != null)
1763             {
1764                 NUILog.Debug($"[Dispose] offWindowEventCallback");
1765
1766                 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(GetBaseHandleCPtrHandleRef), false);
1767                 signal?.Disconnect(offWindowEventCallback);
1768                 offWindowEventCallback = null;
1769             }
1770
1771             if (onWindowEventCallback != null)
1772             {
1773                 NUILog.Debug($"[Dispose] onWindowEventCallback");
1774
1775                 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1776                 signal?.Disconnect(onWindowEventCallback);
1777                 onWindowEventCallback = null;
1778             }
1779
1780             if (wheelEventCallback != null)
1781             {
1782                 NUILog.Debug($"[Dispose] wheelEventCallback");
1783
1784                 using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(GetBaseHandleCPtrHandleRef), false);
1785                 signal?.Disconnect(wheelEventCallback);
1786                 wheelEventCallback = null;
1787             }
1788
1789             if (hoverEventCallback != null)
1790             {
1791                 NUILog.Debug($"[Dispose] hoverEventCallback");
1792
1793                 using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(GetBaseHandleCPtrHandleRef), false);
1794                 signal?.Disconnect(hoverEventCallback);
1795                 hoverEventCallback = null;
1796             }
1797
1798             if (hitTestResultDataCallback != null)
1799             {
1800                 NUILog.Debug($"[Dispose] hitTestResultDataCallback");
1801
1802                 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorHitTestResultSignal(GetBaseHandleCPtrHandleRef), false);
1803                 signal?.Disconnect(hitTestResultDataCallback);
1804                 hitTestResultDataCallback = null;
1805             }
1806
1807
1808             if (interceptTouchDataCallback != null)
1809             {
1810                 NUILog.Debug($"[Dispose] interceptTouchDataCallback");
1811
1812                 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(GetBaseHandleCPtrHandleRef), false);
1813                 signal?.Disconnect(interceptTouchDataCallback);
1814                 interceptTouchDataCallback = null;
1815             }
1816
1817             if (touchDataCallback != null)
1818             {
1819                 NUILog.Debug($"[Dispose] touchDataCallback");
1820
1821                 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(GetBaseHandleCPtrHandleRef), false);
1822                 signal?.Disconnect(touchDataCallback);
1823                 touchDataCallback = null;
1824             }
1825
1826             if (ResourcesLoadedCallback != null)
1827             {
1828                 NUILog.Debug($"[Dispose] ResourcesLoadedCallback");
1829
1830                 using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1831                 signal?.Disconnect(ResourcesLoadedCallback);
1832                 ResourcesLoadedCallback = null;
1833             }
1834
1835             if (keyCallback != null)
1836             {
1837                 NUILog.Debug($"[Dispose] keyCallback");
1838
1839                 using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
1840                 signal?.Disconnect(keyCallback);
1841                 keyCallback = null;
1842             }
1843
1844             if (keyInputFocusLostCallback != null)
1845             {
1846                 NUILog.Debug($"[Dispose] keyInputFocusLostCallback");
1847
1848                 using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(GetBaseHandleCPtrHandleRef), false);
1849                 signal?.Disconnect(keyInputFocusLostCallback);
1850                 keyInputFocusLostCallback = null;
1851                 keyInputFocusLostEventHandler = null;
1852             }
1853
1854             if (keyInputFocusGainedCallback != null)
1855             {
1856                 NUILog.Debug($"[Dispose] keyInputFocusGainedCallback");
1857
1858                 using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(GetBaseHandleCPtrHandleRef), false);
1859                 signal?.Disconnect(keyInputFocusGainedCallback);
1860                 keyInputFocusGainedCallback = null;
1861                 keyInputFocusGainedEventHandler = null;
1862             }
1863
1864             if (backgroundResourceLoadedCallback != null)
1865             {
1866                 NUILog.Debug($"[Dispose] backgroundResourceLoadedCallback");
1867
1868                 using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1869                 signal?.Disconnect(backgroundResourceLoadedCallback);
1870                 backgroundResourceLoadedCallback = null;
1871             }
1872
1873             if (onWindowSendEventCallback != null)
1874             {
1875                 NUILog.Debug($"[Dispose] onWindowSendEventCallback");
1876
1877                 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1878                 signal?.Disconnect(onWindowSendEventCallback);
1879                 onWindowSendEventCallback = null;
1880             }
1881             NUILog.Debug($"[Dispose] DisConnectFromSignals END");
1882         }
1883
1884         /// <summary>
1885         /// Apply initial style to the view.
1886         /// </summary>
1887         [EditorBrowsable(EditorBrowsableState.Never)]
1888         protected virtual void InitializeStyle(ViewStyle style = null)
1889         {
1890             var initialStyle = ThemeManager.GetInitialStyleWithoutClone(GetType());
1891             if (style == null)
1892             {
1893                 ApplyStyle(initialStyle);
1894             }
1895             else
1896             {
1897                 var refinedStyle = style;
1898                 if (style.IncludeDefaultStyle)
1899                 {
1900                     refinedStyle = initialStyle?.Merge(style);
1901                 }
1902                 ApplyStyle(refinedStyle);
1903             }
1904
1905             // Listen theme change event if needs.
1906             if (ThemeManager.PlatformThemeEnabled && initialStyle != null)
1907             {
1908                 SetThemeApplied();
1909             }
1910         }
1911
1912         private View ConvertIdToView(uint id)
1913         {
1914             View view = GetParent()?.FindCurrentChildById(id);
1915
1916             //If we can't find the parent's children, find in the top layer.
1917             if (!view)
1918             {
1919                 Container parent = GetParent();
1920                 while ((parent is View) && (parent != null))
1921                 {
1922                     parent = parent.GetParent();
1923                     if (parent is Layer)
1924                     {
1925                         view = parent.FindCurrentChildById(id);
1926                         break;
1927                     }
1928                 }
1929             }
1930
1931             return view;
1932         }
1933
1934         private void OnScaleChanged(float x, float y, float z)
1935         {
1936             Scale = new Vector3(x, y, z);
1937         }
1938
1939         private void OnBackgroundColorChanged(float r, float g, float b, float a)
1940         {
1941             BackgroundColor = new Color(r, g, b, a);
1942         }
1943
1944         private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1945         {
1946             Padding = new Extents(start, end, top, bottom);
1947         }
1948
1949         private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1950         {
1951             Margin = new Extents(start, end, top, bottom);
1952         }
1953
1954         private void OnAnchorPointChanged(float x, float y, float z)
1955         {
1956             AnchorPoint = new Position(x, y, z);
1957         }
1958
1959         private void OnCellIndexChanged(float x, float y)
1960         {
1961             CellIndex = new Vector2(x, y);
1962         }
1963
1964         private void OnFlexMarginChanged(float x, float y, float z, float w)
1965         {
1966             FlexMargin = new Vector4(x, y, z, w);
1967         }
1968
1969         private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1970         {
1971             PaddingEX = new Extents(start, end, top, bottom);
1972         }
1973
1974         private void OnSizeModeFactorChanged(float x, float y, float z)
1975         {
1976             SizeModeFactor = new Vector3(x, y, z);
1977         }
1978
1979         private bool EmptyOnTouch(object target, TouchEventArgs args)
1980         {
1981             return false;
1982         }
1983
1984         [EditorBrowsable(EditorBrowsableState.Never)]
1985         protected virtual bool CheckResourceReady()
1986         {
1987             return true;
1988         }
1989
1990         private ViewSelectorData EnsureSelectorData()
1991         {
1992             if (themeData == null) themeData = new ThemeData();
1993
1994             return themeData.selectorData ?? (themeData.selectorData = new ViewSelectorData());
1995         }
1996
1997         [Conditional("NUI_DISPOSE_DEBUG_ON")]
1998         private void disposeDebugging(DisposeTypes type)
1999         {
2000             DebugFileLogging.Instance.WriteLog($"View.Dispose({type}) START");
2001             DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
2002             if (HasBody())
2003             {
2004                 DebugFileLogging.Instance.WriteLog($"ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
2005             }
2006             else
2007             {
2008                 DebugFileLogging.Instance.WriteLog($"has no native body!");
2009             }
2010         }
2011
2012     }
2013 }