[NUI] Fix CA1819 : Properties should not return arrays (#2409)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ViewInternal.cs
1 /*
2  * Copyright(c) 2019 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.Collections.Generic;
21 using System.IO;
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.Binding;
24 using Tizen.NUI.Xaml;
25
26 namespace Tizen.NUI.BaseComponents
27 {
28     /// <summary>
29     /// View is the base class for all views.
30     /// </summary>
31     /// <since_tizen> 3 </since_tizen>
32     public partial class View
33     {
34         private ViewSelectorData selectorData;
35         internal string styleName;
36
37         /// <summary>
38         /// The color mode of View.
39         /// This specifies whether the View uses its own color, or inherits its parent color.
40         /// The default is ColorMode.UseOwnMultiplyParentColor.
41         /// </summary>
42         internal ColorMode ColorMode
43         {
44             set
45             {
46                 SetColorMode(value);
47             }
48             get
49             {
50                 return GetColorMode();
51             }
52         }
53
54         internal float WorldPositionX
55         {
56             get
57             {
58                 float returnValue = 0.0f;
59                 PropertyValue wordPositionX = GetProperty(View.Property.WorldPositionX);
60                 wordPositionX?.Get(out returnValue);
61                 wordPositionX?.Dispose();
62                 return returnValue;
63             }
64         }
65
66         internal float WorldPositionY
67         {
68             get
69             {
70                 float returnValue = 0.0f;
71                 PropertyValue wordPositionY = GetProperty(View.Property.WorldPositionY);
72                 wordPositionY?.Get(out returnValue);
73                 wordPositionY?.Dispose();
74                 return returnValue;
75             }
76         }
77
78         internal float WorldPositionZ
79         {
80             get
81             {
82                 float returnValue = 0.0f;
83                 PropertyValue wordPositionZ = GetProperty(View.Property.WorldPositionZ);
84                 wordPositionZ?.Get(out returnValue);
85                 wordPositionZ?.Dispose();
86                 return returnValue;
87             }
88         }
89
90         internal bool FocusState
91         {
92             get
93             {
94                 return IsKeyboardFocusable();
95             }
96             set
97             {
98                 SetKeyboardFocusable(value);
99             }
100         }
101
102         internal void SetLayout(LayoutItem layout)
103         {
104             this.layout = layout;
105             this.layout?.AttachToOwner(this);
106             this.layout?.RequestLayout();
107         }
108
109         internal void AttachTransitionsToChildren(LayoutTransition transition)
110         {
111             // Iterate children, adding the transition unless a transition
112             // for the same condition and property has already been
113             // explicitly added.
114             foreach (View view in Children)
115             {
116                 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
117             }
118         }
119
120         internal float ParentOriginX
121         {
122             get
123             {
124                 float returnValue = 0.0f;
125                 PropertyValue parentOriginX = GetProperty(View.Property.ParentOriginX);
126                 parentOriginX?.Get(out returnValue);
127                 parentOriginX?.Dispose();
128                 return returnValue;
129             }
130             set
131             {
132                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
133                 SetProperty(View.Property.ParentOriginX, setValue);
134                 setValue.Dispose();
135                 NotifyPropertyChanged();
136             }
137         }
138
139         internal float ParentOriginY
140         {
141             get
142             {
143                 float returnValue = 0.0f;
144                 PropertyValue parentOriginY = GetProperty(View.Property.ParentOriginY);
145                 parentOriginY?.Get(out returnValue);
146                 parentOriginY?.Dispose();
147                 return returnValue;
148             }
149             set
150             {
151                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
152                 SetProperty(View.Property.ParentOriginY, setValue);
153                 setValue.Dispose();
154                 NotifyPropertyChanged();
155             }
156         }
157
158         internal float ParentOriginZ
159         {
160             get
161             {
162                 float returnValue = 0.0f;
163                 PropertyValue parentOriginZ = GetProperty(View.Property.ParentOriginZ);
164                 parentOriginZ?.Get(out returnValue);
165                 parentOriginZ?.Dispose();
166                 return returnValue;
167             }
168             set
169             {
170                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
171                 SetProperty(View.Property.ParentOriginZ, setValue);
172                 setValue.Dispose();
173                 NotifyPropertyChanged();
174             }
175         }
176
177         internal float PivotPointX
178         {
179             get
180             {
181                 float returnValue = 0.0f;
182                 PropertyValue anchorPointX = GetProperty(View.Property.AnchorPointX);
183                 anchorPointX?.Get(out returnValue);
184                 anchorPointX?.Dispose();
185                 return returnValue;
186             }
187             set
188             {
189                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
190                 SetProperty(View.Property.AnchorPointX, setValue);
191                 setValue.Dispose();
192             }
193         }
194
195         internal float PivotPointY
196         {
197             get
198             {
199                 float returnValue = 0.0f;
200                 PropertyValue anchorPointY = GetProperty(View.Property.AnchorPointY);
201                 anchorPointY?.Get(out returnValue);
202                 anchorPointY?.Dispose();
203                 return returnValue;
204             }
205             set
206             {
207                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
208                 SetProperty(View.Property.AnchorPointY, setValue);
209                 setValue.Dispose();
210             }
211         }
212
213         internal float PivotPointZ
214         {
215             get
216             {
217                 float returnValue = 0.0f;
218                 PropertyValue anchorPointZ = GetProperty(View.Property.AnchorPointZ);
219                 anchorPointZ?.Get(out returnValue);
220                 anchorPointZ?.Dispose();
221                 return returnValue;
222             }
223             set
224             {
225                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
226                 SetProperty(View.Property.AnchorPointZ, setValue);
227                 setValue.Dispose();
228             }
229         }
230
231         internal Matrix WorldMatrix
232         {
233             get
234             {
235                 Matrix returnValue = new Matrix();
236                 PropertyValue wordMatrix = GetProperty(View.Property.WorldMatrix);
237                 wordMatrix?.Get(returnValue);
238                 wordMatrix?.Dispose();
239                 return returnValue;
240             }
241         }
242
243         /// <summary>
244         /// Indicates that this View should listen Touch event to handle its ControlState.
245         /// </summary>
246         private bool enableControlState = false;
247
248         private int LeftFocusableViewId
249         {
250             get
251             {
252                 int returnValue = 0;
253                 PropertyValue leftFocusableViewId = GetProperty(View.Property.LeftFocusableViewId);
254                 leftFocusableViewId?.Get(out returnValue);
255                 leftFocusableViewId?.Dispose();
256                 return returnValue;
257             }
258             set
259             {
260                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
261                 SetProperty(View.Property.LeftFocusableViewId, setValue);
262                 setValue.Dispose();
263             }
264         }
265
266         private int RightFocusableViewId
267         {
268             get
269             {
270                 int returnValue = 0;
271                 PropertyValue rightFocusableViewId = GetProperty(View.Property.RightFocusableViewId);
272                 rightFocusableViewId?.Get(out returnValue);
273                 rightFocusableViewId?.Dispose();
274                 return returnValue;
275             }
276             set
277             {
278                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
279                 SetProperty(View.Property.RightFocusableViewId, setValue);
280                 setValue.Dispose();
281             }
282         }
283
284         private int UpFocusableViewId
285         {
286             get
287             {
288                 int returnValue = 0;
289                 PropertyValue upFocusableViewId = GetProperty(View.Property.UpFocusableViewId);
290                 upFocusableViewId?.Get(out returnValue);
291                 upFocusableViewId?.Dispose();
292                 return returnValue;
293             }
294             set
295             {
296                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
297                 SetProperty(View.Property.UpFocusableViewId, setValue);
298                 setValue.Dispose();
299             }
300         }
301
302         private int DownFocusableViewId
303         {
304             get
305             {
306                 int returnValue = 0;
307                 PropertyValue downFocusableViewId = GetProperty(View.Property.DownFocusableViewId);
308                 downFocusableViewId?.Get(out returnValue);
309                 downFocusableViewId?.Dispose();
310                 return returnValue;
311             }
312             set
313             {
314                 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
315                 SetProperty(View.Property.DownFocusableViewId, setValue);
316                 setValue.Dispose();
317             }
318         }
319
320         private ViewSelectorData SelectorData
321         {
322             get
323             {
324                 if (selectorData == null)
325                 {
326                     selectorData = new ViewSelectorData();
327                 }
328                 return selectorData;
329             }
330         }
331
332         internal void Raise()
333         {
334             var parentChildren = GetParent()?.Children;
335
336             if (parentChildren != null)
337             {
338                 int currentIndex = parentChildren.IndexOf(this);
339
340                 // If the view is not already the last item in the list.
341                 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
342                 {
343                     View temp = parentChildren[currentIndex + 1];
344                     parentChildren[currentIndex + 1] = this;
345                     parentChildren[currentIndex] = temp;
346
347                     Interop.NDalic.Raise(SwigCPtr);
348                     if (NDalicPINVOKE.SWIGPendingException.Pending)
349                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
350                 }
351             }
352         }
353
354         internal void Lower()
355         {
356             var parentChildren = GetParent()?.Children;
357
358             if (parentChildren != null)
359             {
360                 int currentIndex = parentChildren.IndexOf(this);
361
362                 // If the view is not already the first item in the list.
363                 if (currentIndex > 0 && currentIndex < parentChildren.Count)
364                 {
365                     View temp = parentChildren[currentIndex - 1];
366                     parentChildren[currentIndex - 1] = this;
367                     parentChildren[currentIndex] = temp;
368
369                     Interop.NDalic.Lower(SwigCPtr);
370                     if (NDalicPINVOKE.SWIGPendingException.Pending)
371                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372                 }
373             }
374         }
375
376         /// <summary>
377         /// Raises the view to above the target view.
378         /// </summary>
379         /// <remarks>The sibling order of views within the parent will be updated automatically.
380         /// Views on the level above the target view will still be shown above this view.
381         /// Raising this view above views with the same sibling order as each other will raise this view above them.
382         /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
383         /// </remarks>
384         /// <param name="target">Will be raised above this view.</param>
385         internal void RaiseAbove(View target)
386         {
387             var parentChildren = GetParent()?.Children;
388
389             if (parentChildren != null)
390             {
391                 int currentIndex = parentChildren.IndexOf(this);
392                 int targetIndex = parentChildren.IndexOf(target);
393
394                 if (currentIndex < 0 || targetIndex < 0 ||
395                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
396                 {
397                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
398                     return;
399                 }
400                 // If the currentIndex is less than the target index and the target has the same parent.
401                 if (currentIndex < targetIndex)
402                 {
403                     parentChildren.Remove(this);
404                     parentChildren.Insert(targetIndex, this);
405
406                     Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
407                     if (NDalicPINVOKE.SWIGPendingException.Pending)
408                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409                 }
410             }
411
412         }
413
414         /// <summary>
415         /// Lowers the view to below the target view.
416         /// </summary>
417         /// <remarks>The sibling order of views within the parent will be updated automatically.
418         /// Lowering this view below views with the same sibling order as each other will lower this view above them.
419         /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
420         /// </remarks>
421         /// <param name="target">Will be lowered below this view.</param>
422         internal void LowerBelow(View target)
423         {
424             var parentChildren = GetParent()?.Children;
425
426             if (parentChildren != null)
427             {
428                 int currentIndex = parentChildren.IndexOf(this);
429                 int targetIndex = parentChildren.IndexOf(target);
430                 if (currentIndex < 0 || targetIndex < 0 ||
431                    currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
432                 {
433                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
434                     return;
435                 }
436
437                 // If the currentIndex is not already the 0th index and the target has the same parent.
438                 if ((currentIndex != 0) && (targetIndex != -1) &&
439                     (currentIndex > targetIndex))
440                 {
441                     parentChildren.Remove(this);
442                     parentChildren.Insert(targetIndex, this);
443
444                     Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
445                     if (NDalicPINVOKE.SWIGPendingException.Pending)
446                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447                 }
448             }
449
450         }
451
452         internal string GetName()
453         {
454             string ret = Interop.Actor.GetName(SwigCPtr);
455             if (NDalicPINVOKE.SWIGPendingException.Pending)
456                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457             return ret;
458         }
459
460         internal void SetName(string name)
461         {
462             Interop.Actor.SetName(SwigCPtr, name);
463             if (NDalicPINVOKE.SWIGPendingException.Pending)
464                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465         }
466
467         internal uint GetId()
468         {
469             uint ret = Interop.Actor.GetId(SwigCPtr);
470             if (NDalicPINVOKE.SWIGPendingException.Pending)
471                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
472             return ret;
473         }
474
475         internal bool IsRoot()
476         {
477             bool ret = Interop.ActorInternal.IsRoot(SwigCPtr);
478             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
479             return ret;
480         }
481
482         internal bool OnWindow()
483         {
484             bool ret = Interop.Actor.OnStage(SwigCPtr);
485             if (NDalicPINVOKE.SWIGPendingException.Pending)
486                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487             return ret;
488         }
489
490         internal View FindChildById(uint id)
491         {
492             //to fix memory leak issue, match the handle count with native side.
493             IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
494             View ret = this.GetInstanceSafely<View>(cPtr);
495             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496             return ret;
497         }
498
499         internal override View FindCurrentChildById(uint id)
500         {
501             return FindChildById(id);
502         }
503
504         internal void SetParentOrigin(Vector3 origin)
505         {
506             Interop.ActorInternal.SetParentOrigin(SwigCPtr, Vector3.getCPtr(origin));
507             if (NDalicPINVOKE.SWIGPendingException.Pending)
508                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
509         }
510
511         internal Vector3 GetCurrentParentOrigin()
512         {
513             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentParentOrigin(SwigCPtr), true);
514             if (NDalicPINVOKE.SWIGPendingException.Pending)
515                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516             return ret;
517         }
518
519         internal void SetAnchorPoint(Vector3 anchorPoint)
520         {
521             Interop.Actor.SetAnchorPoint(SwigCPtr, Vector3.getCPtr(anchorPoint));
522             if (NDalicPINVOKE.SWIGPendingException.Pending)
523                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
524         }
525
526         internal Vector3 GetCurrentAnchorPoint()
527         {
528             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentAnchorPoint(SwigCPtr), true);
529             if (NDalicPINVOKE.SWIGPendingException.Pending)
530                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
531             return ret;
532         }
533
534         internal void SetSize(float width, float height)
535         {
536             Interop.ActorInternal.SetSize(SwigCPtr, width, height);
537             if (NDalicPINVOKE.SWIGPendingException.Pending)
538                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539         }
540
541         internal void SetSize(float width, float height, float depth)
542         {
543             Interop.ActorInternal.SetSize(SwigCPtr, width, height, depth);
544             if (NDalicPINVOKE.SWIGPendingException.Pending)
545                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546         }
547
548         internal void SetSize(Vector2 size)
549         {
550             Interop.ActorInternal.SetSizeVector2(SwigCPtr, Vector2.getCPtr(size));
551             if (NDalicPINVOKE.SWIGPendingException.Pending)
552                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553         }
554
555         internal void SetSize(Vector3 size)
556         {
557             Interop.ActorInternal.SetSizeVector3(SwigCPtr, Vector3.getCPtr(size));
558             if (NDalicPINVOKE.SWIGPendingException.Pending)
559                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560         }
561
562         internal Vector3 GetTargetSize()
563         {
564             Vector3 ret = new Vector3(Interop.ActorInternal.GetTargetSize(SwigCPtr), true);
565             if (NDalicPINVOKE.SWIGPendingException.Pending)
566                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
567             return ret;
568         }
569
570         internal Size2D GetCurrentSize()
571         {
572             Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
573             if (NDalicPINVOKE.SWIGPendingException.Pending)
574                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575             Size2D size = new Size2D((int)ret.Width, (int)ret.Height);
576             ret.Dispose();
577             return size;
578         }
579
580         internal Size2D GetCurrentSizeFloat()
581         {
582             Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
583             if (NDalicPINVOKE.SWIGPendingException.Pending)
584                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585             return ret;
586         }
587
588         internal Vector3 GetNaturalSize()
589         {
590             Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
591             if (NDalicPINVOKE.SWIGPendingException.Pending)
592                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
593             return ret;
594         }
595
596         internal void SetPosition(float x, float y)
597         {
598             Interop.ActorInternal.SetPosition(SwigCPtr, x, y);
599             if (NDalicPINVOKE.SWIGPendingException.Pending)
600                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601         }
602
603         internal void SetPosition(float x, float y, float z)
604         {
605             Interop.ActorInternal.SetPosition(SwigCPtr, x, y, z);
606             if (NDalicPINVOKE.SWIGPendingException.Pending)
607                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608         }
609
610         internal void SetPosition(Vector3 position)
611         {
612             Interop.ActorInternal.SetPosition(SwigCPtr, Vector3.getCPtr(position));
613             if (NDalicPINVOKE.SWIGPendingException.Pending)
614                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615         }
616
617         internal void SetX(float x)
618         {
619             Interop.ActorInternal.SetX(SwigCPtr, x);
620             if (NDalicPINVOKE.SWIGPendingException.Pending)
621                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
622         }
623
624         internal void SetY(float y)
625         {
626             Interop.ActorInternal.SetY(SwigCPtr, y);
627             if (NDalicPINVOKE.SWIGPendingException.Pending)
628                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
629         }
630
631         internal void SetZ(float z)
632         {
633             Interop.ActorInternal.SetZ(SwigCPtr, z);
634             if (NDalicPINVOKE.SWIGPendingException.Pending)
635                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636         }
637
638         internal void TranslateBy(Vector3 distance)
639         {
640             Interop.ActorInternal.TranslateBy(SwigCPtr, Vector3.getCPtr(distance));
641             if (NDalicPINVOKE.SWIGPendingException.Pending)
642                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643         }
644
645         internal Position GetCurrentPosition()
646         {
647             Position ret = new Position(Interop.Actor.GetCurrentPosition(SwigCPtr), true);
648             if (NDalicPINVOKE.SWIGPendingException.Pending)
649                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
650             return ret;
651         }
652
653         internal Vector3 GetCurrentWorldPosition()
654         {
655             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldPosition(SwigCPtr), true);
656             if (NDalicPINVOKE.SWIGPendingException.Pending)
657                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658             return ret;
659         }
660
661         internal void SetInheritPosition(bool inherit)
662         {
663             Interop.ActorInternal.SetInheritPosition(SwigCPtr, inherit);
664             if (NDalicPINVOKE.SWIGPendingException.Pending)
665                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
666         }
667
668         internal bool IsPositionInherited()
669         {
670             bool ret = Interop.ActorInternal.IsPositionInherited(SwigCPtr);
671             if (NDalicPINVOKE.SWIGPendingException.Pending)
672                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673             return ret;
674         }
675
676         internal void SetOrientation(Degree angle, Vector3 axis)
677         {
678             Interop.ActorInternal.SetOrientationDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
679             if (NDalicPINVOKE.SWIGPendingException.Pending)
680                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681         }
682
683         internal void SetOrientation(Radian angle, Vector3 axis)
684         {
685             Interop.ActorInternal.SetOrientationRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
686             if (NDalicPINVOKE.SWIGPendingException.Pending)
687                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688         }
689
690         internal void SetOrientation(Rotation orientation)
691         {
692             Interop.ActorInternal.SetOrientationQuaternion(SwigCPtr, Rotation.getCPtr(orientation));
693             if (NDalicPINVOKE.SWIGPendingException.Pending)
694                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
695         }
696
697         internal Rotation GetCurrentOrientation()
698         {
699             Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentOrientation(SwigCPtr), true);
700             if (NDalicPINVOKE.SWIGPendingException.Pending)
701                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
702             return ret;
703         }
704
705         internal void SetInheritOrientation(bool inherit)
706         {
707             Interop.ActorInternal.SetInheritOrientation(SwigCPtr, inherit);
708             if (NDalicPINVOKE.SWIGPendingException.Pending)
709                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710         }
711
712         internal bool IsOrientationInherited()
713         {
714             bool ret = Interop.ActorInternal.IsOrientationInherited(SwigCPtr);
715             if (NDalicPINVOKE.SWIGPendingException.Pending)
716                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717             return ret;
718         }
719
720         internal Rotation GetCurrentWorldOrientation()
721         {
722             Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentWorldOrientation(SwigCPtr), true);
723             if (NDalicPINVOKE.SWIGPendingException.Pending)
724                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725             return ret;
726         }
727
728         internal void SetScale(float scale)
729         {
730             Interop.ActorInternal.SetScale(SwigCPtr, scale);
731             if (NDalicPINVOKE.SWIGPendingException.Pending)
732                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733         }
734
735         internal void SetScale(float scaleX, float scaleY, float scaleZ)
736         {
737             Interop.ActorInternal.SetScale(SwigCPtr, scaleX, scaleY, scaleZ);
738             if (NDalicPINVOKE.SWIGPendingException.Pending)
739                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740         }
741
742         internal void SetScale(Vector3 scale)
743         {
744             Interop.ActorInternal.SetScale(SwigCPtr, Vector3.getCPtr(scale));
745             if (NDalicPINVOKE.SWIGPendingException.Pending)
746                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747         }
748
749         internal Vector3 GetCurrentScale()
750         {
751             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentScale(SwigCPtr), true);
752             if (NDalicPINVOKE.SWIGPendingException.Pending)
753                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
754             return ret;
755         }
756
757         internal Vector3 GetCurrentWorldScale()
758         {
759             Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldScale(SwigCPtr), true);
760             if (NDalicPINVOKE.SWIGPendingException.Pending)
761                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762             return ret;
763         }
764
765         internal void SetInheritScale(bool inherit)
766         {
767             Interop.ActorInternal.SetInheritScale(SwigCPtr, inherit);
768             if (NDalicPINVOKE.SWIGPendingException.Pending)
769                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770         }
771
772         internal bool IsScaleInherited()
773         {
774             bool ret = Interop.ActorInternal.IsScaleInherited(SwigCPtr);
775             if (NDalicPINVOKE.SWIGPendingException.Pending)
776                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777             return ret;
778         }
779
780         internal Matrix GetCurrentWorldMatrix()
781         {
782             Matrix ret = new Matrix(Interop.ActorInternal.GetCurrentWorldMatrix(SwigCPtr), true);
783             if (NDalicPINVOKE.SWIGPendingException.Pending)
784                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785             return ret;
786         }
787
788         internal void SetVisible(bool visible)
789         {
790             Interop.Actor.SetVisible(SwigCPtr, visible);
791             if (NDalicPINVOKE.SWIGPendingException.Pending)
792                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793         }
794
795         internal bool IsVisible()
796         {
797             bool ret = Interop.ActorInternal.IsVisible(SwigCPtr);
798             if (NDalicPINVOKE.SWIGPendingException.Pending)
799                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800             return ret;
801         }
802
803         internal void SetOpacity(float opacity)
804         {
805             Interop.ActorInternal.SetOpacity(SwigCPtr, opacity);
806             if (NDalicPINVOKE.SWIGPendingException.Pending)
807                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808         }
809
810         internal float GetCurrentOpacity()
811         {
812             float ret = Interop.ActorInternal.GetCurrentOpacity(SwigCPtr);
813             if (NDalicPINVOKE.SWIGPendingException.Pending)
814                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815             return ret;
816         }
817
818         internal void SetColor(Vector4 color)
819         {
820             Interop.ActorInternal.SetColor(SwigCPtr, Vector4.getCPtr(color));
821             if (NDalicPINVOKE.SWIGPendingException.Pending)
822                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823         }
824
825         internal Vector4 GetCurrentColor()
826         {
827             Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentColor(SwigCPtr), true);
828             if (NDalicPINVOKE.SWIGPendingException.Pending)
829                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830             return ret;
831         }
832         internal ColorMode GetColorMode()
833         {
834             ColorMode ret = (ColorMode)Interop.ActorInternal.GetColorMode(SwigCPtr);
835             if (NDalicPINVOKE.SWIGPendingException.Pending)
836                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837             return ret;
838         }
839
840         internal Vector4 GetCurrentWorldColor()
841         {
842             Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentWorldColor(SwigCPtr), true);
843             if (NDalicPINVOKE.SWIGPendingException.Pending)
844                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
845             return ret;
846         }
847
848         internal void SetDrawMode(DrawModeType drawMode)
849         {
850             Interop.ActorInternal.SetDrawMode(SwigCPtr, (int)drawMode);
851             if (NDalicPINVOKE.SWIGPendingException.Pending)
852                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
853         }
854
855         internal DrawModeType GetDrawMode()
856         {
857             DrawModeType ret = (DrawModeType)Interop.ActorInternal.GetDrawMode(SwigCPtr);
858             if (NDalicPINVOKE.SWIGPendingException.Pending)
859                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
860             return ret;
861         }
862
863         internal void SetKeyboardFocusable(bool focusable)
864         {
865             Interop.ActorInternal.SetKeyboardFocusable(SwigCPtr, focusable);
866             if (NDalicPINVOKE.SWIGPendingException.Pending)
867                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
868         }
869
870         internal bool IsKeyboardFocusable()
871         {
872             bool ret = Interop.ActorInternal.IsKeyboardFocusable(SwigCPtr);
873             if (NDalicPINVOKE.SWIGPendingException.Pending)
874                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875             return ret;
876         }
877
878         internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
879         {
880             Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
881             if (NDalicPINVOKE.SWIGPendingException.Pending)
882                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
883         }
884
885         internal ResizePolicyType GetResizePolicy(DimensionType dimension)
886         {
887             ResizePolicyType ret = (ResizePolicyType)Interop.Actor.GetResizePolicy(SwigCPtr, (int)dimension);
888             if (NDalicPINVOKE.SWIGPendingException.Pending)
889                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
890             return ret;
891         }
892
893         internal Vector3 GetSizeModeFactor()
894         {
895             Vector3 ret = new Vector3(Interop.Actor.GetSizeModeFactor(SwigCPtr), true);
896             if (NDalicPINVOKE.SWIGPendingException.Pending)
897                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
898             return ret;
899         }
900
901         internal void SetMinimumSize(Vector2 size)
902         {
903             Interop.ActorInternal.SetMinimumSize(SwigCPtr, Vector2.getCPtr(size));
904             if (NDalicPINVOKE.SWIGPendingException.Pending)
905                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906         }
907
908         internal Vector2 GetMinimumSize()
909         {
910             Vector2 ret = new Vector2(Interop.ActorInternal.GetMinimumSize(SwigCPtr), true);
911             if (NDalicPINVOKE.SWIGPendingException.Pending)
912                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913             return ret;
914         }
915
916         internal void SetMaximumSize(Vector2 size)
917         {
918             Interop.ActorInternal.SetMaximumSize(SwigCPtr, Vector2.getCPtr(size));
919             if (NDalicPINVOKE.SWIGPendingException.Pending)
920                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921         }
922
923         internal Vector2 GetMaximumSize()
924         {
925             Vector2 ret = new Vector2(Interop.ActorInternal.GetMaximumSize(SwigCPtr), true);
926             if (NDalicPINVOKE.SWIGPendingException.Pending)
927                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
928             return ret;
929         }
930
931         internal int GetHierarchyDepth()
932         {
933             int ret = Interop.Actor.GetHierarchyDepth(SwigCPtr);
934             if (NDalicPINVOKE.SWIGPendingException.Pending)
935                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936             return ret;
937         }
938
939         internal uint GetRendererCount()
940         {
941             uint ret = Interop.Actor.GetRendererCount(SwigCPtr);
942             if (NDalicPINVOKE.SWIGPendingException.Pending)
943                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
944             return ret;
945         }
946
947         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
948         {
949             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
950         }
951
952         internal bool IsTopLevelView()
953         {
954             if (GetParent() is Layer)
955             {
956                 return true;
957             }
958             return false;
959         }
960
961         internal void SetKeyInputFocus()
962         {
963             Interop.ViewInternal.SetKeyInputFocus(SwigCPtr);
964             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
965         }
966
967         internal void ClearKeyInputFocus()
968         {
969             Interop.ViewInternal.ClearKeyInputFocus(SwigCPtr);
970             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
971         }
972
973         internal PinchGestureDetector GetPinchGestureDetector()
974         {
975             PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.GetPinchGestureDetector(SwigCPtr), true);
976             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
977             return ret;
978         }
979
980         internal PanGestureDetector GetPanGestureDetector()
981         {
982             PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.GetPanGestureDetector(SwigCPtr), true);
983             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
984             return ret;
985         }
986
987         internal TapGestureDetector GetTapGestureDetector()
988         {
989             TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.GetTapGestureDetector(SwigCPtr), true);
990             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
991             return ret;
992         }
993
994         internal LongPressGestureDetector GetLongPressGestureDetector()
995         {
996             LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.GetLongPressGestureDetector(SwigCPtr), true);
997             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
998             return ret;
999         }
1000
1001         internal IntPtr GetPtrfromView()
1002         {
1003             return (IntPtr)SwigCPtr;
1004         }
1005
1006         internal void RemoveChild(View child)
1007         {
1008             // Do actual child removal
1009             Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
1010             if (NDalicPINVOKE.SWIGPendingException.Pending)
1011                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1012
1013             Children.Remove(child);
1014             child.InternalParent = null;
1015
1016             if (ChildRemoved != null)
1017             {
1018                 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1019                 {
1020                     Removed = child
1021                 };
1022                 ChildRemoved(this, e);
1023             }
1024         }
1025
1026         /// <summary>
1027         /// Removes the layout from this View.
1028         /// </summary>
1029         internal void ResetLayout()
1030         {
1031             layout = null;
1032         }
1033
1034         internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1035         {
1036             return (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1037         }
1038
1039         /// TODO open as a protected level
1040         internal virtual void ApplyCornerRadius()
1041         {
1042             if (backgroundExtraData == null) return;
1043
1044             // Apply to the background visual
1045             PropertyMap backgroundMap = new PropertyMap();
1046             PropertyValue background = Tizen.NUI.Object.GetProperty(SwigCPtr, View.Property.BACKGROUND);
1047             if (background.Get(backgroundMap) && !backgroundMap.Empty())
1048             {
1049                 backgroundMap[Visual.Property.CornerRadius] = new PropertyValue(backgroundExtraData.CornerRadius);
1050                 backgroundMap[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
1051                 var temp = new PropertyValue(backgroundMap);
1052                 Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.BACKGROUND, temp);
1053                 temp.Dispose();
1054             }
1055             backgroundMap.Dispose();
1056             background.Dispose();
1057
1058             // Apply to the shadow visual
1059             PropertyMap shadowMap = new PropertyMap();
1060             PropertyValue shadow = Tizen.NUI.Object.GetProperty(SwigCPtr, View.Property.SHADOW);
1061             if (shadow.Get(shadowMap) && !shadowMap.Empty())
1062             {
1063                 shadowMap[Visual.Property.CornerRadius] = new PropertyValue(backgroundExtraData.CornerRadius);
1064                 shadowMap[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
1065                 var temp = new PropertyValue(shadowMap);
1066                 Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.SHADOW, temp);
1067                 temp.Dispose();
1068             }
1069             shadowMap.Dispose();
1070             shadow.Dispose();
1071         }
1072
1073         internal void UpdateStyle()
1074         {
1075             ViewStyle newStyle;
1076             if (styleName == null) newStyle = ThemeManager.GetStyle(GetType());
1077             else newStyle = ThemeManager.GetStyle(styleName);
1078
1079             if (newStyle != null && (viewStyle == null || viewStyle.GetType() == newStyle.GetType())) ApplyStyle(newStyle);
1080         }
1081
1082         /// <summary>
1083         /// you can override it to clean-up your own resources.
1084         /// </summary>
1085         /// <param name="type">DisposeTypes</param>
1086         /// <since_tizen> 3 </since_tizen>
1087         protected override void Dispose(DisposeTypes type)
1088         {
1089             if (disposed)
1090             {
1091                 return;
1092             }
1093
1094             //_mergedStyle = null;
1095
1096             if (type == DisposeTypes.Explicit)
1097             {
1098                 //Called by User
1099                 //Release your own managed resources here.
1100                 //You should release all of your own disposable objects here.
1101                 selectorData?.Reset(this);
1102                 if (themeChangeSensitive)
1103                 {
1104                     ThemeManager.ThemeChangedInternal.Remove(OnThemeChanged);
1105                 }
1106             }
1107
1108             //Release your own unmanaged resources here.
1109             //You should not access any managed member here except static instance.
1110             //because the execution order of Finalizes is non-deterministic.
1111             if (this != null)
1112             {
1113                 DisConnectFromSignals();
1114             }
1115
1116             foreach (View view in Children)
1117             {
1118                 view.InternalParent = null;
1119             }
1120
1121             base.Dispose(type);
1122         }
1123
1124         /// This will not be public opened.
1125         [EditorBrowsable(EditorBrowsableState.Never)]
1126         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1127         {
1128             Interop.View.DeleteView(swigCPtr);
1129         }
1130
1131         /// <summary>
1132         /// The touch event handler for ControlState.
1133         /// Please change ControlState value by touch state if needed.
1134         /// </summary>
1135         /// <exception cref="ArgumentNullException"> Thrown when touch is null. </exception>
1136         [EditorBrowsable(EditorBrowsableState.Never)]
1137         protected virtual bool HandleControlStateOnTouch(Touch touch)
1138         {
1139             if (touch == null)
1140             {
1141                 throw new global::System.ArgumentNullException(nameof(touch));
1142             }
1143
1144             switch (touch.GetState(0))
1145             {
1146                 case PointStateType.Down:
1147                     ControlState += ControlState.Pressed;
1148                     break;
1149                 case PointStateType.Interrupted:
1150                 case PointStateType.Up:
1151                     if (ControlState.Contains(ControlState.Pressed))
1152                     {
1153                         ControlState -= ControlState.Pressed;
1154                     }
1155                     break;
1156                 default:
1157                     break;
1158             }
1159             return false;
1160         }
1161
1162         private void DisConnectFromSignals()
1163         {
1164             // Save current CPtr.
1165             global::System.Runtime.InteropServices.HandleRef currentCPtr = SwigCPtr;
1166
1167             // Use BaseHandle CPtr as current might have been deleted already in derived classes.
1168             SwigCPtr = GetBaseHandleCPtrHandleRef;
1169
1170             if (_onRelayoutEventCallback != null)
1171             {
1172                 ViewSignal signal = this.OnRelayoutSignal();
1173                 signal?.Disconnect(_onRelayoutEventCallback);
1174                 signal?.Dispose();
1175                 _onRelayoutEventCallback = null;
1176             }
1177
1178             if (_offWindowEventCallback != null)
1179             {
1180                 ViewSignal signal = this.OffWindowSignal();
1181                 signal?.Disconnect(_offWindowEventCallback);
1182                 signal?.Dispose();
1183                 _offWindowEventCallback = null;
1184             }
1185
1186             if (_onWindowEventCallback != null)
1187             {
1188                 ViewSignal signal = this.OnWindowSignal();
1189                 signal?.Disconnect(_onWindowEventCallback);
1190                 signal?.Dispose();
1191                 _onWindowEventCallback = null;
1192             }
1193
1194             if (_wheelEventCallback != null)
1195             {
1196                 WheelSignal signal = this.WheelEventSignal();
1197                 signal?.Disconnect(_wheelEventCallback);
1198                 signal?.Dispose();
1199             }
1200
1201             if (WindowWheelEventHandler != null)
1202             {
1203                 NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent;
1204             }
1205
1206             if (_hoverEventCallback != null)
1207             {
1208                 HoverSignal signal = this.HoveredSignal();
1209                 signal?.Disconnect(_hoverEventCallback);
1210                 signal?.Dispose();
1211             }
1212
1213             if (_interceptTouchDataCallback != null)
1214             {
1215                 TouchDataSignal signal = this.InterceptTouchSignal();
1216                 signal?.Disconnect(_interceptTouchDataCallback);
1217                 signal?.Dispose();
1218             }
1219
1220             if (_touchDataCallback != null)
1221             {
1222                 TouchDataSignal signal = this.TouchSignal();
1223                 signal?.Disconnect(_touchDataCallback);
1224                 signal?.Dispose();
1225             }
1226
1227             if (_ResourcesLoadedCallback != null)
1228             {
1229                 ViewSignal signal = this.ResourcesLoadedSignal();
1230                 signal?.Disconnect(_ResourcesLoadedCallback);
1231                 signal?.Dispose();
1232                 _ResourcesLoadedCallback = null;
1233             }
1234
1235             if (_keyCallback != null)
1236             {
1237                 ControlKeySignal signal = this.KeyEventSignal();
1238                 signal?.Disconnect(_keyCallback);
1239                 signal?.Dispose();
1240             }
1241
1242             if (_keyInputFocusLostCallback != null)
1243             {
1244                 KeyInputFocusSignal signal = this.KeyInputFocusLostSignal();
1245                 signal?.Disconnect(_keyInputFocusLostCallback);
1246                 signal?.Dispose();
1247             }
1248
1249             if (_keyInputFocusGainedCallback != null)
1250             {
1251                 KeyInputFocusSignal signal = this.KeyInputFocusGainedSignal();
1252                 signal?.Disconnect(_keyInputFocusGainedCallback);
1253                 signal?.Dispose();
1254             }
1255
1256             if (_backgroundResourceLoadedCallback != null)
1257             {
1258                 ViewSignal signal = this.ResourcesLoadedSignal();
1259                 signal?.Disconnect(_backgroundResourceLoadedCallback);
1260                 signal?.Dispose();
1261                 _backgroundResourceLoadedCallback = null;
1262             }
1263
1264             if (_onWindowSendEventCallback != null)
1265             {
1266                 ViewSignal signal = this.OnWindowSignal();
1267                 signal?.Disconnect(_onWindowSendEventCallback);
1268                 signal?.Dispose();
1269             }
1270
1271             // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
1272             // Restore current CPtr.
1273             SwigCPtr = currentCPtr;
1274         }
1275
1276         private View ConvertIdToView(uint id)
1277         {
1278             View view = GetParent()?.FindCurrentChildById(id);
1279
1280             //If we can't find the parent's children, find in the top layer.
1281             if (!view)
1282             {
1283                 Container parent = GetParent();
1284                 while ((parent is View) && (parent != null))
1285                 {
1286                     parent = parent.GetParent();
1287                     if (parent is Layer)
1288                     {
1289                         view = parent.FindCurrentChildById(id);
1290                         break;
1291                     }
1292                 }
1293             }
1294
1295             return view;
1296         }
1297
1298         private void OnScaleChanged(float x, float y, float z)
1299         {
1300             Scale = new Vector3(x, y, z);
1301         }
1302
1303         private void OnBackgroundColorChanged(float r, float g, float b, float a)
1304         {
1305             BackgroundColor = new Color(r, g, b, a);
1306         }
1307
1308         private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1309         {
1310             Padding = new Extents(start, end, top, bottom);
1311         }
1312
1313         private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1314         {
1315             Margin = new Extents(start, end, top, bottom);
1316         }
1317
1318         private void OnColorChanged(float r, float g, float b, float a)
1319         {
1320             Color = new Color(r, g, b, a);
1321         }
1322
1323         private void OnAnchorPointChanged(float x, float y, float z)
1324         {
1325             AnchorPoint = new Position(x, y, z);
1326         }
1327
1328         private void OnCellIndexChanged(float x, float y)
1329         {
1330             CellIndex = new Vector2(x, y);
1331         }
1332
1333         private void OnFlexMarginChanged(float x, float y, float z, float w)
1334         {
1335             FlexMargin = new Vector4(x, y, z, w);
1336         }
1337
1338         private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1339         {
1340             PaddingEX = new Extents(start, end, top, bottom);
1341         }
1342
1343         private void OnSizeModeFactorChanged(float x, float y, float z)
1344         {
1345             SizeModeFactor = new Vector3(x, y, z);
1346         }
1347
1348         private bool EmptyOnTouch(object target, TouchEventArgs args)
1349         {
1350             return false;
1351         }
1352
1353         private void InitializeStyle(ViewStyle style)
1354         {
1355             if (style != null) ApplyStyle(style.Clone());   // Use given style
1356             else if (ThemeManager.ThemeApplied) UpdateStyle(); // Use style in the current theme
1357         }
1358     }
1359 }