[NUI] Split large files (#1081)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.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 using System;
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
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 : Container, IResourcesProvider
30     {
31         /// <summary>
32         /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
33         /// </summary>
34         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
35         [EditorBrowsable(EditorBrowsableState.Never)]
36         public bool layoutSet = false;
37
38         /// <summary>
39         /// Flag to allow Layouting to be disabled for Views.
40         /// Once a View has a Layout set then any children added to Views from then on will receive
41         /// automatic Layouts.
42         /// </summary>
43         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
44         [EditorBrowsable(EditorBrowsableState.Never)]
45         public static bool layoutingDisabled{get; set;} = true;
46
47         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
48         private LayoutItem _layout; // Exclusive layout assigned to this View.
49
50         // List of transitions paired with the condition that uses the transition.
51         private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52         private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53         private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54         private float _weight = 0.0f; // Weighting of child View in a Layout
55         private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
56         private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
57         private bool _backgroundImageSynchronosLoading = false;
58         private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
59         private string[] transitionNames;
60
61         /// <summary>
62         /// Creates a new instance of a view.
63         /// </summary>
64         /// <since_tizen> 3 </since_tizen>
65         public View() : this(Interop.View.View_New(), true)
66         {
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         /// <summary>
71         /// Create a new instance of a View with setting the status of shown or hidden.
72         /// </summary>
73         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
74         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
75         [EditorBrowsable(EditorBrowsableState.Never)]
76         public View(bool shown) : this(Interop.View.View_New(), true)
77         {
78             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79             SetVisible(shown);
80         }
81
82         internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
83         {
84             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85             if(!shown)
86             {
87                 SetVisible(false);
88             }
89         }
90
91         internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
92         {
93             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
94             if (HasBody())
95             {
96                 PositionUsesPivotPoint = false;
97             }
98
99             _onWindowSendEventCallback = SendViewAddedEventToWindow;
100             this.OnWindowSignal().Connect(_onWindowSendEventCallback);
101
102             if (!shown)
103             {
104                 SetVisible(false);
105             }
106         }
107
108         internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
109         {
110             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111
112             if (!shown)
113             {
114                 SetVisible(false);
115             }
116         }
117
118         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
119         [EditorBrowsable(EditorBrowsableState.Never)]
120         public bool IsResourcesCreated
121         {
122             get
123             {
124                 return Application.Current.IsResourcesCreated;
125             }
126         }
127
128         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
129         [EditorBrowsable(EditorBrowsableState.Never)]
130         public ResourceDictionary XamlResources
131         {
132             get
133             {
134                 return Application.Current.XamlResources;
135             }
136             set
137             {
138                 Application.Current.XamlResources = value;
139             }
140         }
141
142         /// <summary>
143         /// The StyleName, type string.
144         /// </summary>
145         /// <since_tizen> 3 </since_tizen>
146         public string StyleName
147         {
148             get
149             {
150                 return (string)GetValue(StyleNameProperty);
151             }
152             set
153             {
154                 SetValue(StyleNameProperty, value);
155                 NotifyPropertyChanged();
156             }
157         }
158
159         /// <summary>
160         /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
161         /// </summary>
162         /// <since_tizen> 3 </since_tizen>
163         public Color BackgroundColor
164         {
165             get
166             {
167                 return (Color)GetValue(BackgroundColorProperty);
168             }
169             set
170             {
171                 SetValue(BackgroundColorProperty, value);
172                 NotifyPropertyChanged();
173             }
174         }
175
176         /// <summary>
177         /// The mutually exclusive with "backgroundColor" and "background" type Map.
178         /// </summary>
179         /// <since_tizen> 3 </since_tizen>
180         public string BackgroundImage
181         {
182             get
183             {
184                 return (string)GetValue(BackgroundImageProperty);
185             }
186             set
187             {
188                 SetValue(BackgroundImageProperty, value);
189                 NotifyPropertyChanged();
190             }
191         }
192
193         /// <summary>
194         /// The background of view.
195         /// </summary>
196         /// <since_tizen> 3 </since_tizen>
197         public Tizen.NUI.PropertyMap Background
198         {
199             get
200             {
201                 return (PropertyMap)GetValue(BackgroundProperty);
202             }
203             set
204             {
205                 SetValue(BackgroundProperty, value);
206                 NotifyPropertyChanged();
207             }
208         }
209
210         /// <summary>
211         /// The current state of the view.
212         /// </summary>
213         /// <since_tizen> 3 </since_tizen>
214         public States State
215         {
216             get
217             {
218                 return (States)GetValue(StateProperty);
219             }
220             set
221             {
222                 SetValue(StateProperty, value);
223                 NotifyPropertyChanged();
224             }
225         }
226
227         /// <summary>
228         /// The current sub state of the view.
229         /// </summary>
230         /// <since_tizen> 3 </since_tizen>
231         public States SubState
232         {
233             get
234             {
235                 return (States)GetValue(SubStateProperty);
236             }
237             set
238             {
239                 SetValue(SubStateProperty, value);
240                 NotifyPropertyChanged();
241             }
242         }
243
244         /// <summary>
245         /// Displays a tooltip
246         /// </summary>
247         /// <since_tizen> 3 </since_tizen>
248         public Tizen.NUI.PropertyMap Tooltip
249         {
250             get
251             {
252                 return (PropertyMap)GetValue(TooltipProperty);
253             }
254             set
255             {
256                 SetValue(TooltipProperty, value);
257                 NotifyPropertyChanged();
258             }
259         }
260
261         /// <summary>
262         /// Displays a tooltip as a text.
263         /// </summary>
264         /// <since_tizen> 3 </since_tizen>
265         public string TooltipText
266         {
267             set
268             {
269                 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
270                 NotifyPropertyChanged();
271             }
272         }
273
274         /// <summary>
275         /// The Child property of FlexContainer.<br />
276         /// The proportion of the free space in the container, the flex item will receive.<br />
277         /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
278         /// </summary>
279         /// <since_tizen> 3 </since_tizen>
280         public float Flex
281         {
282             get
283             {
284                 return (float)GetValue(FlexProperty);
285             }
286             set
287             {
288                 SetValue(FlexProperty, value);
289                 NotifyPropertyChanged();
290             }
291         }
292
293         /// <summary>
294         /// The Child property of FlexContainer.<br />
295         /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
296         /// </summary>
297         /// <since_tizen> 3 </since_tizen>
298         public int AlignSelf
299         {
300             get
301             {
302                 return (int)GetValue(AlignSelfProperty);
303             }
304             set
305             {
306                 SetValue(AlignSelfProperty, value);
307                 NotifyPropertyChanged();
308             }
309         }
310
311         /// <summary>
312         /// The Child property of FlexContainer.<br />
313         /// The space around the flex item.<br />
314         /// </summary>
315         /// <since_tizen> 3 </since_tizen>
316         public Vector4 FlexMargin
317         {
318             get
319             {
320                 return (Vector4)GetValue(FlexMarginProperty);
321             }
322             set
323             {
324                 SetValue(FlexMarginProperty, value);
325                 NotifyPropertyChanged();
326             }
327         }
328
329         /// <summary>
330         /// The top-left cell this child occupies, if not set, the first available cell is used.
331         /// </summary>
332         /// <since_tizen> 3 </since_tizen>
333         public Vector2 CellIndex
334         {
335             get
336             {
337                 return (Vector2)GetValue(CellIndexProperty);
338             }
339             set
340             {
341                 SetValue(CellIndexProperty, value);
342                 NotifyPropertyChanged();
343             }
344         }
345
346         /// <summary>
347         /// The number of rows this child occupies, if not set, the default value is 1.
348         /// </summary>
349         /// <since_tizen> 3 </since_tizen>
350         public float RowSpan
351         {
352             get
353             {
354                 return (float)GetValue(RowSpanProperty);
355             }
356             set
357             {
358                 SetValue(RowSpanProperty, value);
359                 NotifyPropertyChanged();
360             }
361         }
362
363         /// <summary>
364         /// The number of columns this child occupies, if not set, the default value is 1.
365         /// </summary>
366         /// <since_tizen> 3 </since_tizen>
367         public float ColumnSpan
368         {
369             get
370             {
371                 return (float)GetValue(ColumnSpanProperty);
372             }
373             set
374             {
375                 SetValue(ColumnSpanProperty, value);
376                 NotifyPropertyChanged();
377             }
378         }
379
380         /// <summary>
381         /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
382         /// </summary>
383         /// <since_tizen> 3 </since_tizen>
384         public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
385         {
386             get
387             {
388                 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
389             }
390             set
391             {
392                 SetValue(CellHorizontalAlignmentProperty, value);
393                 NotifyPropertyChanged();
394             }
395         }
396
397         /// <summary>
398         /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
399         /// </summary>
400         /// <since_tizen> 3 </since_tizen>
401         public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
402         {
403             get
404             {
405                 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
406             }
407             set
408             {
409                 SetValue(CellVerticalAlignmentProperty, value);
410                 NotifyPropertyChanged();
411             }
412         }
413
414         /// <summary>
415         /// The left focusable view.<br />
416         /// This will return null if not set.<br />
417         /// This will also return null if the specified left focusable view is not on a window.<br />
418         /// </summary>
419         /// <since_tizen> 3 </since_tizen>
420         public View LeftFocusableView
421         {
422             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
423             get
424             {
425                 return (View)GetValue(LeftFocusableViewProperty);
426             }
427             set
428             {
429                 SetValue(LeftFocusableViewProperty, value);
430                 NotifyPropertyChanged();
431             }
432         }
433
434         /// <summary>
435         /// The right focusable view.<br />
436         /// This will return null if not set.<br />
437         /// This will also return null if the specified right focusable view is not on a window.<br />
438         /// </summary>
439         /// <since_tizen> 3 </since_tizen>
440         public View RightFocusableView
441         {
442             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
443             get
444             {
445                 return (View)GetValue(RightFocusableViewProperty);
446             }
447             set
448             {
449                 SetValue(RightFocusableViewProperty, value);
450                 NotifyPropertyChanged();
451             }
452         }
453
454         /// <summary>
455         /// The up focusable view.<br />
456         /// This will return null if not set.<br />
457         /// This will also return null if the specified up focusable view is not on a window.<br />
458         /// </summary>
459         /// <since_tizen> 3 </since_tizen>
460         public View UpFocusableView
461         {
462             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
463             get
464             {
465                 return (View)GetValue(UpFocusableViewProperty);
466             }
467             set
468             {
469                 SetValue(UpFocusableViewProperty, value);
470                 NotifyPropertyChanged();
471             }
472         }
473
474         /// <summary>
475         /// The down focusable view.<br />
476         /// This will return null if not set.<br />
477         /// This will also return null if the specified down focusable view is not on a window.<br />
478         /// </summary>
479         /// <since_tizen> 3 </since_tizen>
480         public View DownFocusableView
481         {
482             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
483             get
484             {
485                 return (View)GetValue(DownFocusableViewProperty);
486             }
487             set
488             {
489                 SetValue(DownFocusableViewProperty, value);
490                 NotifyPropertyChanged();
491             }
492         }
493
494         /// <summary>
495         /// Whether the view should be focusable by keyboard navigation.
496         /// </summary>
497         /// <since_tizen> 3 </since_tizen>
498         public bool Focusable
499         {
500             set
501             {
502                 SetValue(FocusableProperty, value);
503                 NotifyPropertyChanged();
504             }
505             get
506             {
507                 return (bool)GetValue(FocusableProperty);
508             }
509         }
510
511         /// <summary>
512         ///  Retrieves the position of the view.<br />
513         ///  The coordinates are relative to the view's parent.<br />
514         /// </summary>
515         /// <since_tizen> 3 </since_tizen>
516         public Position CurrentPosition
517         {
518             get
519             {
520                 return GetCurrentPosition();
521             }
522         }
523
524         /// <summary>
525         /// Sets the size of a view for the width and the height.<br />
526         /// Geometry can be scaled to fit within this area.<br />
527         /// This does not interfere with the view's scale factor.<br />
528         /// The views default depth is the minimum of width and height.<br />
529         /// </summary>
530         /// <remarks>
531         /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
532         /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
533         /// Please note that this multi-cascade setting is especially possible for this NUI object (Size2D). <br />
534         /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
535         /// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f); <br />
536         /// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f; <br />
537         /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimum size is set. <br />
538         /// </remarks>
539         /// <since_tizen> 3 </since_tizen>
540         public Size2D Size2D
541         {
542             get
543             {
544                 Size2D temp = (Size2D)GetValue(Size2DProperty);
545                 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
546             }
547             set
548             {
549                 SetValue(Size2DProperty, value);
550                 // Set Specification so when layouts measure this View it matches the value set here.
551                 // All Views are currently Layouts.
552                 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
553                 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
554                 _widthPolicy = value.Width;
555                 _heightPolicy = value.Height;
556                 _layout?.RequestLayout();
557                 NotifyPropertyChanged();
558             }
559         }
560
561         /// <summary>
562         ///  Retrieves the size of the view.<br />
563         ///  The coordinates are relative to the view's parent.<br />
564         /// </summary>
565         /// <since_tizen> 3 </since_tizen>
566         public Size2D CurrentSize
567         {
568             get
569             {
570                 return GetCurrentSize();
571             }
572         }
573
574         /// <summary>
575         /// Retrieves and sets the view's opacity.<br />
576         /// </summary>
577         /// <since_tizen> 3 </since_tizen>
578         public float Opacity
579         {
580             get
581             {
582                 return (float)GetValue(OpacityProperty);
583             }
584             set
585             {
586                 SetValue(OpacityProperty, value);
587                 NotifyPropertyChanged();
588             }
589         }
590
591         /// <summary>
592         /// Sets the position of the view for X and Y.<br />
593         /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
594         /// If the position inheritance is disabled, sets the world position.<br />
595         /// </summary>
596         /// <remarks>
597         /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
598         /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
599         /// Please note that this multi-cascade setting is especially possible for this NUI object (Position2D). <br />
600         /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
601         /// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f); <br />
602         /// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f; <br />
603         /// </remarks>
604         /// <since_tizen> 3 </since_tizen>
605         public Position2D Position2D
606         {
607             get
608             {
609                 Position2D temp = (Position2D)GetValue(Position2DProperty);
610                 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
611             }
612             set
613             {
614                 SetValue(Position2DProperty, value);
615                 NotifyPropertyChanged();
616             }
617         }
618
619         /// <summary>
620         /// Retrieves the screen postion of the view.<br />
621         /// </summary>
622         /// <since_tizen> 3 </since_tizen>
623         public Vector2 ScreenPosition
624         {
625             get
626             {
627                 Vector2 temp = new Vector2(0.0f, 0.0f);
628                 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
629                 return temp;
630             }
631         }
632
633         /// <summary>
634         /// Determines whether the pivot point should be used to determine the position of the view.
635         /// This is true by default.
636         /// </summary>
637         /// <remarks>If false, then the top-left of the view is used for the position.
638         /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
639         /// </remarks>
640         /// <since_tizen> 3 </since_tizen>
641         public bool PositionUsesPivotPoint
642         {
643             get
644             {
645                 return (bool)GetValue(PositionUsesPivotPointProperty);
646             }
647             set
648             {
649                 SetValue(PositionUsesPivotPointProperty, value);
650                 NotifyPropertyChanged();
651             }
652         }
653
654         /// <summary>
655         /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
656         /// </summary>
657         /// <since_tizen> 3 </since_tizen>
658         [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
659             "Like: " +
660             "View view = new View(); " +
661             "view.PivotPoint = PivotPoint.Center; " +
662             "view.PositionUsesPivotPoint = true;" +
663             " Deprecated in API5: Will be removed in API8")]
664         [EditorBrowsable(EditorBrowsableState.Never)]
665         public bool PositionUsesAnchorPoint
666         {
667             get
668             {
669                 bool temp = false;
670                 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
671                 return temp;
672             }
673             set
674             {
675                 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
676                 NotifyPropertyChanged();
677             }
678         }
679
680         /// <summary>
681         /// Queries whether the view is connected to the stage.<br />
682         /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
683         /// </summary>
684         /// <since_tizen> 3 </since_tizen>
685         public bool IsOnWindow
686         {
687             get
688             {
689                 return OnWindow();
690             }
691         }
692
693         /// <summary>
694         /// Gets the depth in the hierarchy for the view.
695         /// </summary>
696         /// <since_tizen> 3 </since_tizen>
697         public int HierarchyDepth
698         {
699             get
700             {
701                 return GetHierarchyDepth();
702             }
703         }
704
705         /// <summary>
706         /// Sets the sibling order of the view so the depth position can be defined within the same parent.
707         /// </summary>
708         /// <remarks>
709         /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
710         /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
711         /// The values set by this property will likely change.
712         /// </remarks>
713         /// <since_tizen> 3 </since_tizen>
714         public int SiblingOrder
715         {
716             get
717             {
718                 return (int)GetValue(SiblingOrderProperty);
719             }
720             set
721             {
722                 SetValue(SiblingOrderProperty, value);
723                 NotifyPropertyChanged();
724             }
725         }
726
727         /// <summary>
728         /// Returns the natural size of the view.
729         /// </summary>
730         /// <remarks>
731         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
732         /// </remarks>
733         /// <since_tizen> 5 </since_tizen>
734         public Vector3 NaturalSize
735         {
736             get
737             {
738                 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
739                 if (NDalicPINVOKE.SWIGPendingException.Pending)
740                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
741                 return ret;
742             }
743         }
744
745         /// <summary>
746         /// Returns the natural size (Size2D) of the view.
747         /// </summary>
748         /// <remarks>
749         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
750         /// </remarks>
751         /// <since_tizen> 4 </since_tizen>
752         public Size2D NaturalSize2D
753         {
754             get
755             {
756                 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
757                 if (NDalicPINVOKE.SWIGPendingException.Pending)
758                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759
760                 return new Size2D((int)temp.Width, (int)temp.Height);
761             }
762         }
763
764         /// <summary>
765         /// Gets or sets the origin of a view within its parent's area.<br />
766         /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
767         /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
768         /// A view's position is the distance between this origin and the view's anchor-point.<br />
769         /// </summary>
770         /// <pre>The view has been initialized.</pre>
771         /// <since_tizen> 3 </since_tizen>
772         public Position ParentOrigin
773         {
774             get
775             {
776                 Position tmp = (Position)GetValue(ParentOriginProperty);
777                 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
778             }
779             set
780             {
781                 SetValue(ParentOriginProperty, value);
782                 NotifyPropertyChanged();
783             }
784         }
785
786         /// <summary>
787         /// Gets or sets the anchor-point of a view.<br />
788         /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the view, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
789         /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
790         /// A view position is the distance between its parent-origin and this anchor-point.<br />
791         /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
792         /// <pre>The view has been initialized.</pre>
793         /// </summary>
794         /// <since_tizen> 3 </since_tizen>
795         public Position PivotPoint
796         {
797             get
798             {
799                 Position tmp = (Position)GetValue(PivotPointProperty);
800                 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
801             }
802             set
803             {
804                 SetValue(PivotPointProperty, value);
805                 NotifyPropertyChanged();
806             }
807         }
808
809         /// <summary>
810         /// Gets or sets the size width of the view.
811         /// </summary>
812         /// <remarks>
813         /// <para>
814         /// Animatable - This property can be animated using <c>Animation</c> class.
815         /// </para>
816         /// </remarks>
817         /// <since_tizen> 3 </since_tizen>
818         public float SizeWidth
819         {
820             get
821             {
822                 return (float)GetValue(SizeWidthProperty);
823             }
824             set
825             {
826                 SetValue(SizeWidthProperty, value);
827                 WidthSpecification = (int)Math.Ceiling(value);
828                 NotifyPropertyChanged();
829             }
830         }
831
832         /// <summary>
833         /// Gets or sets the size height of the view.
834         /// </summary>
835         /// <remarks>
836         /// <para>
837         /// Animatable - This property can be animated using <c>Animation</c> class.
838         /// </para>
839         /// </remarks>
840         /// <since_tizen> 3 </since_tizen>
841         public float SizeHeight
842         {
843             get
844             {
845                 return (float)GetValue(SizeHeightProperty);
846             }
847             set
848             {
849                 SetValue(SizeHeightProperty, value);
850                 HeightSpecification = (int)Math.Ceiling(value);
851                 NotifyPropertyChanged();
852             }
853         }
854
855         /// <summary>
856         /// Gets or sets the position of the view.<br />
857         /// By default, sets the position vector between the parent origin and pivot point (default).<br />
858         /// If the position inheritance is disabled, sets the world position.<br />
859         /// </summary>
860         /// <remarks>
861         /// <para>
862         /// Animatable - This property can be animated using <c>Animation</c> class.
863         /// </para>
864         /// </remarks>
865         /// <since_tizen> 3 </since_tizen>
866         public Position Position
867         {
868             get
869             {
870                 Position tmp = (Position)GetValue(PositionProperty);
871                 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
872             }
873             set
874             {
875                 SetValue(PositionProperty, value);
876                 NotifyPropertyChanged();
877             }
878         }
879
880         /// <summary>
881         /// Gets or sets the position X of the view.
882         /// </summary>
883         /// <remarks>
884         /// <para>
885         /// Animatable - This property can be animated using <c>Animation</c> class.
886         /// </para>
887         /// </remarks>
888         /// <since_tizen> 3 </since_tizen>
889         public float PositionX
890         {
891             get
892             {
893                 return (float)GetValue(PositionXProperty);
894             }
895             set
896             {
897                 SetValue(PositionXProperty, value);
898                 NotifyPropertyChanged();
899             }
900         }
901
902         /// <summary>
903         /// Gets or sets the position Y of the view.
904         /// </summary>
905         /// <remarks>
906         /// <para>
907         /// Animatable - This property can be animated using <c>Animation</c> class.
908         /// </para>
909         /// </remarks>
910         /// <since_tizen> 3 </since_tizen>
911         public float PositionY
912         {
913             get
914             {
915                 return (float)GetValue(PositionYProperty);
916             }
917             set
918             {
919                 SetValue(PositionYProperty, value);
920                 NotifyPropertyChanged();
921             }
922         }
923
924         /// <summary>
925         /// Gets or sets the position Z of the view.
926         /// </summary>
927         /// <remarks>
928         /// <para>
929         /// Animatable - This property can be animated using <c>Animation</c> class.
930         /// </para>
931         /// </remarks>
932         /// <since_tizen> 3 </since_tizen>
933         public float PositionZ
934         {
935             get
936             {
937                 return (float)GetValue(PositionZProperty);
938             }
939             set
940             {
941                 SetValue(PositionZProperty, value);
942                 NotifyPropertyChanged();
943             }
944         }
945
946         /// <summary>
947         /// Gets or sets the world position of the view.
948         /// </summary>
949         /// <since_tizen> 3 </since_tizen>
950         public Vector3 WorldPosition
951         {
952             get
953             {
954                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
955                 GetProperty(View.Property.WORLD_POSITION).Get(temp);
956                 return temp;
957             }
958         }
959
960         /// <summary>
961         /// Gets or sets the orientation of the view.<br />
962         /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
963         /// </summary>
964         /// <remarks>
965         /// <para>
966         /// This is an asynchronous method.
967         /// </para>
968         /// <para>
969         /// Animatable - This property can be animated using <c>Animation</c> class.
970         /// </para>
971         /// </remarks>
972         /// <since_tizen> 3 </since_tizen>
973         public Rotation Orientation
974         {
975             get
976             {
977                 return (Rotation)GetValue(OrientationProperty);
978             }
979             set
980             {
981                 SetValue(OrientationProperty, value);
982                 NotifyPropertyChanged();
983             }
984         }
985
986         /// <summary>
987         /// Gets or sets the world orientation of the view.<br />
988         /// </summary>
989         /// <since_tizen> 3 </since_tizen>
990         public Rotation WorldOrientation
991         {
992             get
993             {
994                 Rotation temp = new Rotation();
995                 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
996                 return temp;
997             }
998         }
999
1000         /// <summary>
1001         /// Gets or sets the scale factor applied to the view.<br />
1002         /// </summary>
1003         /// <remarks>
1004         /// <para>
1005         /// Animatable - This property can be animated using <c>Animation</c> class.
1006         /// </para>
1007         /// </remarks>
1008         /// <since_tizen> 3 </since_tizen>
1009         public Vector3 Scale
1010         {
1011             get
1012             {
1013                 return (Vector3)GetValue(ScaleProperty);
1014             }
1015             set
1016             {
1017                 SetValue(ScaleProperty, value);
1018                 NotifyPropertyChanged();
1019             }
1020         }
1021
1022         /// <summary>
1023         /// Gets or sets the scale X factor applied to the view.
1024         /// </summary>
1025         /// <remarks>
1026         /// <para>
1027         /// Animatable - This property can be animated using <c>Animation</c> class.
1028         /// </para>
1029         /// </remarks>
1030         /// <since_tizen> 3 </since_tizen>
1031         public float ScaleX
1032         {
1033             get
1034             {
1035                 return (float)GetValue(ScaleXProperty);
1036             }
1037             set
1038             {
1039                 SetValue(ScaleXProperty, value);
1040                 NotifyPropertyChanged();
1041             }
1042         }
1043
1044         /// <summary>
1045         /// Gets or sets the scale Y factor applied to the view.
1046         /// </summary>
1047         /// <remarks>
1048         /// <para>
1049         /// Animatable - This property can be animated using <c>Animation</c> class.
1050         /// </para>
1051         /// </remarks>
1052         /// <since_tizen> 3 </since_tizen>
1053         public float ScaleY
1054         {
1055             get
1056             {
1057                 return (float)GetValue(ScaleYProperty);
1058             }
1059             set
1060             {
1061                 SetValue(ScaleYProperty, value);
1062                 NotifyPropertyChanged();
1063             }
1064         }
1065
1066         /// <summary>
1067         /// Gets or sets the scale Z factor applied to the view.
1068         /// </summary>
1069         /// <remarks>
1070         /// <para>
1071         /// Animatable - This property can be animated using <c>Animation</c> class.
1072         /// </para>
1073         /// </remarks>
1074         /// <since_tizen> 3 </since_tizen>
1075         public float ScaleZ
1076         {
1077             get
1078             {
1079                 return (float)GetValue(ScaleZProperty);
1080             }
1081             set
1082             {
1083                 SetValue(ScaleZProperty, value);
1084                 NotifyPropertyChanged();
1085             }
1086         }
1087
1088         /// <summary>
1089         /// Gets the world scale of the view.
1090         /// </summary>
1091         /// <since_tizen> 3 </since_tizen>
1092         public Vector3 WorldScale
1093         {
1094             get
1095             {
1096                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1097                 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1098                 return temp;
1099             }
1100         }
1101
1102         /// <summary>
1103         /// Retrieves the visibility flag of the view.
1104         /// </summary>
1105         /// <remarks>
1106         /// <para>
1107         /// If the view is not visible, then the view and its children will not be rendered.
1108         /// This is regardless of the individual visibility values of the children, i.e., the view will only be rendered if all of its parents have visibility set to true.
1109         /// </para>
1110         /// <para>
1111         /// Animatable - This property can be animated using <c>Animation</c> class.
1112         /// </para>
1113         /// </remarks>
1114         /// <since_tizen> 3 </since_tizen>
1115         public bool Visibility
1116         {
1117             get
1118             {
1119                 bool temp = false;
1120                 GetProperty(View.Property.VISIBLE).Get(out temp);
1121                 return temp;
1122             }
1123         }
1124
1125         /// <summary>
1126         /// Gets the view's world color.
1127         /// </summary>
1128         /// <since_tizen> 3 </since_tizen>
1129         public Vector4 WorldColor
1130         {
1131             get
1132             {
1133                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1134                 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1135                 return temp;
1136             }
1137         }
1138
1139         /// <summary>
1140         /// Gets or sets the view's name.
1141         /// </summary>
1142         /// <since_tizen> 3 </since_tizen>
1143         public string Name
1144         {
1145             get
1146             {
1147                 return (string)GetValue(NameProperty);
1148             }
1149             set
1150             {
1151                 SetValue(NameProperty, value);
1152                 NotifyPropertyChanged();
1153             }
1154         }
1155
1156         /// <summary>
1157         /// Get the number of children held by the view.
1158         /// </summary>
1159         /// <since_tizen> 3 </since_tizen>
1160         public new uint ChildCount
1161         {
1162             get
1163             {
1164                 return GetChildCount();
1165             }
1166         }
1167
1168         /// <summary>
1169         /// Gets the view's ID.
1170         /// Readonly
1171         /// </summary>
1172         /// <since_tizen> 3 </since_tizen>
1173         public uint ID
1174         {
1175             get
1176             {
1177                 return GetId();
1178             }
1179         }
1180
1181         /// <summary>
1182         /// Gets or sets the status of whether the view should emit touch or hover signals.
1183         /// </summary>
1184         /// <since_tizen> 3 </since_tizen>
1185         public bool Sensitive
1186         {
1187             get
1188             {
1189                 return (bool)GetValue(SensitiveProperty);
1190             }
1191             set
1192             {
1193                 SetValue(SensitiveProperty, value);
1194                 NotifyPropertyChanged();
1195             }
1196         }
1197
1198         /// <summary>
1199         /// Gets or sets the status of whether the view should receive a notification when touch or hover motion events leave the boundary of the view.
1200         /// </summary>
1201         /// <since_tizen> 3 </since_tizen>
1202         public bool LeaveRequired
1203         {
1204             get
1205             {
1206                 return (bool)GetValue(LeaveRequiredProperty);
1207             }
1208             set
1209             {
1210                 SetValue(LeaveRequiredProperty, value);
1211                 NotifyPropertyChanged();
1212             }
1213         }
1214
1215         /// <summary>
1216         /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1217         /// </summary>
1218         /// <since_tizen> 3 </since_tizen>
1219         public bool InheritOrientation
1220         {
1221             get
1222             {
1223                 return (bool)GetValue(InheritOrientationProperty);
1224             }
1225             set
1226             {
1227                 SetValue(InheritOrientationProperty, value);
1228                 NotifyPropertyChanged();
1229             }
1230         }
1231
1232         /// <summary>
1233         /// Gets or sets the status of whether a child view inherits it's parent's scale.
1234         /// </summary>
1235         /// <since_tizen> 3 </since_tizen>
1236         public bool InheritScale
1237         {
1238             get
1239             {
1240                 return (bool)GetValue(InheritScaleProperty);
1241             }
1242             set
1243             {
1244                 SetValue(InheritScaleProperty, value);
1245                 NotifyPropertyChanged();
1246             }
1247         }
1248
1249         /// <summary>
1250         /// Gets or sets the status of how the view and its children should be drawn.<br />
1251         /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1252         /// If an object is in a 3D layer, it will be depth-tested against other objects in the world, i.e., it may be obscured if other objects are in front.<br />
1253         /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1254         /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1255         /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1256         /// </summary>
1257         /// <since_tizen> 3 </since_tizen>
1258         public DrawModeType DrawMode
1259         {
1260             get
1261             {
1262                 return (DrawModeType)GetValue(DrawModeProperty);
1263             }
1264             set
1265             {
1266                 SetValue(DrawModeProperty, value);
1267                 NotifyPropertyChanged();
1268             }
1269         }
1270
1271         /// <summary>
1272         /// Gets or sets the relative to parent size factor of the view.<br />
1273         /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1274         /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1275         /// </summary>
1276         /// <since_tizen> 3 </since_tizen>
1277         public Vector3 SizeModeFactor
1278         {
1279             get
1280             {
1281                 return (Vector3)GetValue(SizeModeFactorProperty);
1282             }
1283             set
1284             {
1285                 SetValue(SizeModeFactorProperty, value);
1286                 NotifyPropertyChanged();
1287             }
1288         }
1289
1290         /// <summary>
1291         /// Gets or sets the width resize policy to be used.
1292         /// </summary>
1293         /// <since_tizen> 3 </since_tizen>
1294         public ResizePolicyType WidthResizePolicy
1295         {
1296             get
1297             {
1298                 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1299             }
1300             set
1301             {
1302                 SetValue(WidthResizePolicyProperty, value);
1303                 // Match ResizePolicy to new Layouting.
1304                 // Parent relative policies can not be mapped at this point as parent size unknown.
1305                 switch (value)
1306                 {
1307                     case ResizePolicyType.UseNaturalSize:
1308                     {
1309                         WidthSpecification = LayoutParamPolicies.WrapContent;
1310                         break;
1311                     }
1312                     case ResizePolicyType.FillToParent:
1313                     {
1314                         WidthSpecification = LayoutParamPolicies.MatchParent;
1315                         break;
1316                     }
1317                     case ResizePolicyType.FitToChildren:
1318                     {
1319                         WidthSpecification = LayoutParamPolicies.WrapContent;
1320                         break;
1321                     }
1322                     default:
1323                         break;
1324                 }
1325                 NotifyPropertyChanged();
1326             }
1327         }
1328
1329         /// <summary>
1330         /// Gets or sets the height resize policy to be used.
1331         /// </summary>
1332         /// <since_tizen> 3 </since_tizen>
1333         public ResizePolicyType HeightResizePolicy
1334         {
1335             get
1336             {
1337                 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1338             }
1339             set
1340             {
1341                 SetValue(HeightResizePolicyProperty, value);
1342                 // Match ResizePolicy to new Layouting.
1343                 // Parent relative policies can not be mapped at this point as parent size unknown.
1344                 switch (value)
1345                 {
1346                     case ResizePolicyType.UseNaturalSize:
1347                     {
1348                         HeightSpecification = LayoutParamPolicies.WrapContent;
1349                         break;
1350                     }
1351                     case ResizePolicyType.FillToParent:
1352                     {
1353                         HeightSpecification = LayoutParamPolicies.MatchParent;
1354                         break;
1355                     }
1356                     case ResizePolicyType.FitToChildren:
1357                     {
1358                         HeightSpecification = LayoutParamPolicies.WrapContent;
1359                         break;
1360                     }
1361                     default:
1362                         break;
1363                 }
1364                 NotifyPropertyChanged();
1365             }
1366         }
1367
1368         /// <summary>
1369         /// Gets or sets the policy to use when setting size with size negotiation.<br />
1370         /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1371         /// </summary>
1372         /// <since_tizen> 3 </since_tizen>
1373         public SizeScalePolicyType SizeScalePolicy
1374         {
1375             get
1376             {
1377                 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1378             }
1379             set
1380             {
1381                 SetValue(SizeScalePolicyProperty, value);
1382                 NotifyPropertyChanged();
1383             }
1384         }
1385
1386         /// <summary>
1387         ///  Gets or sets the status of whether the width size is dependent on the height size.
1388         /// </summary>
1389         /// <since_tizen> 3 </since_tizen>
1390         public bool WidthForHeight
1391         {
1392             get
1393             {
1394                 return (bool)GetValue(WidthForHeightProperty);
1395             }
1396             set
1397             {
1398                 SetValue(WidthForHeightProperty, value);
1399                 NotifyPropertyChanged();
1400             }
1401         }
1402
1403         /// <summary>
1404         /// Gets or sets the status of whether the height size is dependent on the width size.
1405         /// </summary>
1406         /// <since_tizen> 3 </since_tizen>
1407         public bool HeightForWidth
1408         {
1409             get
1410             {
1411                 return (bool)GetValue(HeightForWidthProperty);
1412             }
1413             set
1414             {
1415                 SetValue(HeightForWidthProperty, value);
1416                 NotifyPropertyChanged();
1417             }
1418         }
1419
1420         /// <summary>
1421         /// Gets or sets the padding for use in layout.
1422         /// </summary>
1423         /// <since_tizen> 5 </since_tizen>
1424         public Extents Padding
1425         {
1426             get
1427             {
1428                 // If View has a Layout then padding in stored in the base Layout class
1429                 if (Layout !=null)
1430                 {
1431                     return Layout.Padding;
1432                 }
1433                 else
1434                 {
1435                     return (Extents)GetValue(PaddingProperty);
1436                 }
1437                 // Two return points to prevent creating a zeroed Extent native object before assignment
1438             }
1439             set
1440             {
1441                 Extents padding = value;
1442                 if (Layout !=null)
1443                 {
1444                     // Layout set so store Padding in LayoutItem instead of in View.
1445                     // If View stores the Padding value then Legacy Size Negotiation will overwrite
1446                     // the position and sizes measure in the Layouting.
1447                     Layout.Padding = value;
1448                     // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1449                     // Let the View keeps it's padding.  Still store Padding in Layout to reduce code paths.
1450                     if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1451                     {
1452                         padding =  new Extents(0,0,0,0); // Reset value stored in View.
1453                     }
1454                     _layout?.RequestLayout();
1455                 }
1456                 SetValue(PaddingProperty, padding);
1457                 NotifyPropertyChanged();
1458                 _layout?.RequestLayout();
1459             }
1460         }
1461
1462         /// <summary>
1463         /// Gets or sets the minimum size the view can be assigned in size negotiation.
1464         /// </summary>
1465         /// <since_tizen> 3 </since_tizen>
1466         public Size2D MinimumSize
1467         {
1468             get
1469             {
1470                 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1471                 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1472             }
1473             set
1474             {
1475                 if (_layout != null)
1476                 {
1477                     // Note: it only works if minimum size is >= than natural size.
1478                     // To force the size it should be done through the width&height spec or Size2D.
1479                     _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1480                     _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1481                     _layout.RequestLayout();
1482                 }
1483                 SetValue(MinimumSizeProperty, value);
1484                 NotifyPropertyChanged();
1485             }
1486         }
1487
1488         /// <summary>
1489         /// Gets or sets the maximum size the view can be assigned in size negotiation.
1490         /// </summary>
1491         /// <since_tizen> 3 </since_tizen>
1492         public Size2D MaximumSize
1493         {
1494             get
1495             {
1496                 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1497                 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1498             }
1499             set
1500             {
1501                 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1502                 // MATCH_PARENT spec + parent container size can be used to limit
1503                 if (_layout != null)
1504                 {
1505                     // Note: it only works if minimum size is >= than natural size.
1506                     // To force the size it should be done through the width&height spec or Size2D.
1507                     _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1508                     _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1509                     _layout.RequestLayout();
1510                 }
1511                 SetValue(MaximumSizeProperty, value);
1512                 NotifyPropertyChanged();
1513             }
1514         }
1515
1516         /// <summary>
1517         /// Gets or sets whether a child view inherits it's parent's position.<br />
1518         /// Default is to inherit.<br />
1519         /// Switching this off means that using position sets the view's world position, i.e., translates from the world origin (0,0,0) to the pivot point of the view.<br />
1520         /// </summary>
1521         /// <since_tizen> 3 </since_tizen>
1522         public bool InheritPosition
1523         {
1524             get
1525             {
1526                 return (bool)GetValue(InheritPositionProperty);
1527             }
1528             set
1529             {
1530                 SetValue(InheritPositionProperty, value);
1531                 NotifyPropertyChanged();
1532             }
1533         }
1534
1535         /// <summary>
1536         /// Gets or sets the clipping behavior (mode) of it's children.
1537         /// </summary>
1538         /// <since_tizen> 3 </since_tizen>
1539         public ClippingModeType ClippingMode
1540         {
1541             get
1542             {
1543                 return (ClippingModeType)GetValue(ClippingModeProperty);
1544             }
1545             set
1546             {
1547                 SetValue(ClippingModeProperty, value);
1548                 NotifyPropertyChanged();
1549             }
1550         }
1551
1552         /// <summary>
1553         /// Gets the number of renderers held by the view.
1554         /// </summary>
1555         /// <since_tizen> 3 </since_tizen>
1556         public uint RendererCount
1557         {
1558             get
1559             {
1560                 return GetRendererCount();
1561             }
1562         }
1563
1564         /// <summary>
1565         /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1566         /// </summary>
1567         /// <since_tizen> 3 </since_tizen>
1568         [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1569             "Like: " +
1570             "View view = new View(); " +
1571             "view.PivotPoint = PivotPoint.Center; " +
1572             "view.PositionUsesPivotPoint = true;")]
1573         [EditorBrowsable(EditorBrowsableState.Never)]
1574         public Position AnchorPoint
1575         {
1576             get
1577             {
1578                 Position temp = new Position(0.0f, 0.0f, 0.0f);
1579                 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1580                 return temp;
1581             }
1582             set
1583             {
1584                 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1585                 NotifyPropertyChanged();
1586             }
1587         }
1588
1589         /// <summary>
1590         /// Sets the size of a view for the width, the height and the depth.<br />
1591         /// Geometry can be scaled to fit within this area.<br />
1592         /// This does not interfere with the view's scale factor.<br />
1593         /// The views default depth is the minimum of width and height.<br />
1594         /// </summary>
1595         /// <remarks>
1596         /// <para>
1597         /// Please note that multi-cascade setting is not possible for this NUI object. <br />
1598         /// It is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
1599         /// For example, this code is working fine : view.Size = new Size( 1.0f, 1.0f, 0.0f); <br />
1600         /// but this will not work! : view.Size.Width = 2.0f; view.Size.Height = 2.0f; <br />
1601         /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimu size is set. <br />
1602         /// </para>
1603         /// <para>
1604         /// Animatable - This property can be animated using <c>Animation</c> class.
1605         /// </para>
1606         /// </remarks>
1607         /// <since_tizen> 5 </since_tizen>
1608         public Size Size
1609         {
1610             get
1611             {
1612                 Size tmp = (Size)GetValue(SizeProperty);
1613                 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1614             }
1615             set
1616             {
1617                 SetValue(SizeProperty, value);
1618                 // Set Specification so when layouts measure this View it matches the value set here.
1619                 // All Views are currently Layouts.
1620                 WidthSpecification = (int)Math.Ceiling(value.Width);
1621                 HeightSpecification = (int)Math.Ceiling(value.Height);
1622                 NotifyPropertyChanged();
1623             }
1624         }
1625
1626         /// <summary>
1627         /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1628         /// </summary>
1629         /// <since_tizen> 3 </since_tizen>
1630         [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1631             "Like: " +
1632             "Container parent =  view.GetParent(); " +
1633             "View view = parent as View;")]
1634         [EditorBrowsable(EditorBrowsableState.Never)]
1635         public new View Parent
1636         {
1637             get
1638             {
1639                 View ret;
1640                 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1641                 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1642                 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1643
1644                 if (basehandle is Layer layer)
1645                 {
1646                     ret = new View(Layer.getCPtr(layer).Handle, false);
1647                     NUILog.Error("This Parent property is deprecated, shoud do not be used");
1648                 }
1649                 else
1650                 {
1651                     ret = basehandle as View;
1652                 }
1653
1654                 Interop.BaseHandle.delete_BaseHandle(CPtr);
1655                 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1656
1657                 if (NDalicPINVOKE.SWIGPendingException.Pending)
1658                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1659                 return ret;
1660             }
1661         }
1662
1663         /// <summary>
1664         /// Gets/Sets whether inherit parent's the layout Direction.
1665         /// </summary>
1666         /// <since_tizen> 4 </since_tizen>
1667         public bool InheritLayoutDirection
1668         {
1669             get
1670             {
1671                 return (bool)GetValue(InheritLayoutDirectionProperty);
1672             }
1673             set
1674             {
1675                 SetValue(InheritLayoutDirectionProperty, value);
1676                 NotifyPropertyChanged();
1677             }
1678         }
1679
1680         /// <summary>
1681         /// Gets/Sets the layout Direction.
1682         /// </summary>
1683         /// <since_tizen> 4 </since_tizen>
1684         public ViewLayoutDirectionType LayoutDirection
1685         {
1686             get
1687             {
1688                 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1689             }
1690             set
1691             {
1692                 SetValue(LayoutDirectionProperty, value);
1693                 NotifyPropertyChanged();
1694                 _layout?.RequestLayout();
1695             }
1696         }
1697
1698         /// <summary>
1699         /// Gets or sets the Margin for use in layout.
1700         /// </summary>
1701         /// <remarks>
1702         /// Margin property is supported by Layout algorithms and containers.
1703         /// Please Set Layout if you want to use Margin property.
1704         /// </remarks>
1705         /// <since_tizen> 4 </since_tizen>
1706         public Extents Margin
1707         {
1708             get
1709             {
1710                 // If View has a Layout then margin is stored in Layout.
1711                 if (Layout != null)
1712                 {
1713                     return Layout.Margin;
1714                 }
1715                 else
1716                 {
1717                     // If Layout not set then return margin stored in View.
1718                     return (Extents)GetValue(MarginProperty);
1719                 }
1720                 // Two return points to prevent creating a zeroed Extent native object before assignment
1721             }
1722             set
1723             {
1724                 if (Layout != null)
1725                 {
1726                     // Layout set so store Margin in LayoutItem instead of View.
1727                     // If View stores the Margin too then the Legacy Size Negotiation will
1728                     // overwrite the position and size values measured in the Layouting.
1729                     Layout.Margin = value;
1730                     SetValue(MarginProperty, new Extents(0,0,0,0));
1731                     _layout?.RequestLayout();
1732                 }
1733                 else
1734                 {
1735                     SetValue(MarginProperty, value);
1736                 }
1737                 NotifyPropertyChanged();
1738                 _layout?.RequestLayout();
1739             }
1740         }
1741
1742         ///<summary>
1743         /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1744         ///</summary>
1745         /// <since_tizen> 6 </since_tizen>
1746         public int WidthSpecification
1747         {
1748             get
1749             {
1750                 return _widthPolicy;
1751             }
1752             set
1753             {
1754                 _widthPolicy = value;
1755                 if (_widthPolicy >= 0)
1756                 {
1757                     _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1758                     Size2D.Width = _widthPolicy;
1759
1760                 }
1761                 _layout?.RequestLayout();
1762             }
1763         }
1764
1765         ///<summary>
1766         /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1767         ///</summary>
1768         /// <since_tizen> 6 </since_tizen>
1769         [EditorBrowsable(EditorBrowsableState.Never)]
1770         public int HeightSpecification
1771         {
1772             get
1773             {
1774                 return _heightPolicy;
1775             }
1776             set
1777             {
1778                 _heightPolicy = value;
1779                 if (_heightPolicy >= 0)
1780                 {
1781                     _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1782                     Size2D.Height = _heightPolicy;
1783
1784                 }
1785                _layout?.RequestLayout();
1786             }
1787         }
1788
1789         ///<summary>
1790         /// Gets the List of transitions for this View.
1791         ///</summary>
1792         /// <since_tizen> 6 </since_tizen>
1793         public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1794         {
1795             get
1796             {
1797                 if (_layoutTransitions == null)
1798                 {
1799                     _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1800                 }
1801                 return _layoutTransitions;
1802             }
1803         }
1804
1805         ///<summary>
1806         /// Set a layout transitions for this View.
1807         ///</summary>
1808         /// <remarks>
1809         /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1810         /// </remarks>
1811         /// <since_tizen> 6 </since_tizen>
1812         public LayoutTransition LayoutTransition
1813         {
1814             set
1815             {
1816                 if (_layoutTransitions == null)
1817                 {
1818                     _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1819                 }
1820                 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1821
1822                 AttachTransitionsToChildren(value);
1823             }
1824         }
1825
1826         /// <summary>
1827         /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
1828         /// </summary>
1829         /// <since_tizen> 4 </since_tizen>
1830         [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
1831         [EditorBrowsable(EditorBrowsableState.Never)]
1832         public Extents PaddingEX
1833         {
1834             get
1835             {
1836                 Extents temp = new Extents(0, 0, 0, 0);
1837                 GetProperty(View.Property.PADDING).Get(temp);
1838                 return temp;
1839             }
1840             set
1841             {
1842                 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
1843                 NotifyPropertyChanged();
1844                 _layout?.RequestLayout();
1845             }
1846         }
1847
1848         /// <since_tizen> 6 </since_tizen>
1849         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1850         [EditorBrowsable(EditorBrowsableState.Never)]
1851         public Style XamlStyle
1852         {
1853             get
1854             {
1855                 return (Style)GetValue(XamlStyleProperty);
1856             }
1857             set
1858             {
1859                 SetValue(XamlStyleProperty, value);
1860             }
1861         }
1862
1863         /// <summary>
1864         /// The Color of View. This is an RGBA value.
1865         /// </summary>
1866         /// <remarks>
1867         /// <para>
1868         /// Animatable - This property can be animated using <c>Animation</c> class.
1869         /// </para>
1870         /// </remarks>
1871         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1872         [EditorBrowsable(EditorBrowsableState.Never)]
1873         public Color Color
1874         {
1875             set
1876             {
1877                 SetColor(value);
1878             }
1879             get
1880             {
1881                 return GetCurrentColor();
1882             }
1883         }
1884
1885         /// <summary>
1886         /// Set the layout on this View. Replaces any existing Layout.
1887         /// </summary>
1888         /// <since_tizen> 6 </since_tizen>
1889         public LayoutItem Layout
1890         {
1891             get
1892             {
1893                 return _layout;
1894             }
1895             set
1896             {
1897                 // Do nothing if layout provided is already set on this View.
1898                 if (value == _layout)
1899                 {
1900                     return;
1901                 }
1902
1903                 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
1904                 layoutingDisabled = false;
1905                 layoutSet = true;
1906
1907                 // If new layout being set already has a owner then that owner receives a replacement default layout.
1908                 // First check if the layout to be set already has a owner.
1909                 if (value?.Owner != null)
1910                 {
1911                     // Previous owner of the layout gets a default layout as a replacement.
1912                     value.Owner.Layout = new LayoutGroup();
1913
1914                     // Copy Margin and Padding to replacement LayoutGroup.
1915                     value.Owner.Layout.Margin = value.Margin;
1916                     value.Owner.Layout.Padding = value.Padding;
1917                 }
1918
1919                 // Copy Margin and Padding to new layout being set or restore padding and margin back to
1920                 // View if no replacement. Previously margin and padding values would have been moved from
1921                 // the View to the layout.
1922                 if (_layout != null ) // Existing layout
1923                 {
1924                     if (value != null)
1925                     {
1926                         // Existing layout being replaced so copy over margin and padding values.
1927                         value.Margin = _layout.Margin;
1928                         value.Padding = _layout.Padding;
1929                     }
1930                     else
1931                     {
1932                       // Layout not being replaced so restore margin and padding to View.
1933                       SetValue(MarginProperty, _layout.Margin);
1934                       SetValue(PaddingProperty, _layout.Padding);
1935                       NotifyPropertyChanged();
1936                     }
1937                 }
1938                 else
1939                 {
1940                     // First Layout to be added to the View hence copy
1941
1942                     // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
1943                     if (value !=null)
1944                     {
1945                         if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
1946                         {
1947                             // If View already has a margin set then store it in Layout instead.
1948                             value.Margin = Margin;
1949                             SetValue(MarginProperty, new Extents(0,0,0,0));
1950                             NotifyPropertyChanged();
1951                         }
1952
1953                         if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
1954                         {
1955                             // If View already has a padding set then store it in Layout instead.
1956                             value.Padding = Padding;
1957                             SetValue(PaddingProperty, new Extents(0,0,0,0));
1958                             NotifyPropertyChanged();
1959                         }
1960                     }
1961                 }
1962
1963                 // Remove existing layout from it's parent layout group.
1964                 _layout?.Unparent();
1965
1966                 // Set layout to this view
1967                 SetLayout(value);
1968             }
1969         }
1970
1971         /// <summary>
1972         /// The weight of the View, used to share available space in a layout with siblings.
1973         /// </summary>
1974         /// <since_tizen> 6 </since_tizen>
1975         public float Weight
1976         {
1977             get
1978             {
1979                 return _weight;
1980             }
1981             set
1982             {
1983                 _weight = value;
1984                 _layout?.RequestLayout();
1985             }
1986         }
1987
1988         /// <summary>
1989         ///  Whether to load the BackgroundImage synchronously.
1990         ///  If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
1991         ///  Note: For Normal Quad images only.
1992         /// </summary>
1993         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1994         [EditorBrowsable(EditorBrowsableState.Never)]
1995         public bool BackgroundImageSynchronosLoading
1996         {
1997             get
1998             {
1999                 return _backgroundImageSynchronosLoading;
2000             }
2001             set
2002             {
2003                 _backgroundImageSynchronosLoading = value;
2004                 string bgUrl = "";
2005                 int visualType = 0;
2006                 Background.Find(Visual.Property.Type)?.Get(out visualType);
2007                 if (visualType == (int)Visual.Type.Image)
2008                 {
2009                     Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2010                 }
2011
2012                 if (bgUrl.Length != 0)
2013                 {
2014                     PropertyMap bgMap = this.Background;
2015                     bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2016                     Background = bgMap;
2017                 }
2018             }
2019         }
2020
2021         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2022         [EditorBrowsable(EditorBrowsableState.Never)]
2023         public Vector2 UpdateSizeHint
2024         {
2025             get
2026             {
2027                 return (Vector2)GetValue(UpdateSizeHintProperty);
2028             }
2029             set
2030             {
2031                 SetValue(UpdateSizeHintProperty, value);
2032                 NotifyPropertyChanged();
2033             }
2034         }
2035
2036         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2037         [EditorBrowsable(EditorBrowsableState.Never)]
2038         public string[] TransitionNames
2039         {
2040             get
2041             {
2042                 return transitionNames;
2043             }
2044             set
2045             {
2046                 transitionNames = value;
2047                 LoadTransitions();
2048             }
2049         }
2050     }
2051 }