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