[AT-SPI] Move code from View.cs to ViewAccessibility.cs (#3016)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 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         internal BackgroundExtraData backgroundExtraData;
32
33         private bool layoutSet = false;
34         private LayoutItem layout; // Exclusive layout assigned to this View.
35
36         // List of transitions paired with the condition that uses the transition.
37         private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
38         private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
39         private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
40         private float weight = 0.0f; // Weighting of child View in a Layout
41         private bool backgroundImageSynchronosLoading = false;
42         private bool controlStatePropagation = false;
43         private ViewStyle viewStyle;
44         private bool themeChangeSensitive = false;
45         private bool excludeLayouting = false;
46         private LayoutTransition layoutTransition;
47         private ControlState controlStates = ControlState.Normal;
48         private TransitionOptions transitionOptions = null;
49
50         static View() { }
51
52         /// <summary>
53         /// Creates a new instance of a view.
54         /// </summary>
55         /// <since_tizen> 3 </since_tizen>
56         public View() : this(Interop.View.New(), true)
57         {
58             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
59         }
60
61         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
62         [EditorBrowsable(EditorBrowsableState.Never)]
63         public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
64         {
65         }
66
67         /// <summary>
68         /// Create a new instance of a View with setting the status of shown or hidden.
69         /// </summary>
70         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
71         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
72         [EditorBrowsable(EditorBrowsableState.Never)]
73         public View(bool shown) : this(Interop.View.New(), true)
74         {
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76             SetVisible(shown);
77         }
78
79         internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
80         {
81             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82             if (!shown)
83             {
84                 SetVisible(false);
85             }
86
87             backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
88         }
89
90         internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
91         {
92             InitializeStyle(viewStyle);
93         }
94
95         internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
96         {
97             if (HasBody())
98             {
99                 PositionUsesPivotPoint = false;
100             }
101
102             onWindowSendEventCallback = SendViewAddedEventToWindow;
103             this.OnWindowSignal().Connect(onWindowSendEventCallback);
104
105             if (!shown)
106             {
107                 SetVisible(false);
108             }
109         }
110
111         internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
112         {
113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114
115             if (!shown)
116             {
117                 SetVisible(false);
118             }
119         }
120
121         /// <summary>
122         /// The event that is triggered when the View's ControlState is changed.
123         /// </summary>
124         [EditorBrowsable(EditorBrowsableState.Never)]
125         public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
126
127         internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
128
129
130         /// <summary>
131         /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
132         /// </summary>
133         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
134         [EditorBrowsable(EditorBrowsableState.Never)]
135         public bool LayoutSet
136         {
137             get
138             {
139                 return layoutSet;
140             }
141         }
142
143         /// <summary>
144         /// Flag to allow Layouting to be disabled for Views.
145         /// Once a View has a Layout set then any children added to Views from then on will receive
146         /// automatic Layouts.
147         /// </summary>
148         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
149         [EditorBrowsable(EditorBrowsableState.Never)]
150         public static bool LayoutingDisabled { get; set; } = true;
151
152         /// <summary>
153         /// The style instance applied to this view.
154         /// Note that please do not modify the ViewStyle.
155         /// Modifying ViewStyle will affect other views with same ViewStyle.
156         /// </summary>
157         [EditorBrowsable(EditorBrowsableState.Never)]
158         protected ViewStyle ViewStyle
159         {
160             get
161             {
162                 if (null == viewStyle)
163                 {
164                     ApplyStyle(CreateViewStyle());
165                 }
166
167                 return viewStyle;
168             }
169         }
170
171         /// <summary>
172         /// Get/Set the control state.
173         /// Note that the ControlState only available for the classes derived from Control.
174         /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
175         /// please set <see cref="EnableControlState"/> to true.
176         /// </summary>
177         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178         [EditorBrowsable(EditorBrowsableState.Never)]
179         public ControlState ControlState
180         {
181             get
182             {
183                 return controlStates;
184             }
185             protected set
186             {
187                 if (controlStates == value)
188                 {
189                     return;
190                 }
191
192                 var prevState = controlStates;
193
194                 controlStates = value;
195
196                 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
197
198                 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
199
200                 if (controlStatePropagation)
201                 {
202                     foreach (View child in Children)
203                     {
204                         child.ControlState = value;
205                     }
206                 }
207
208                 OnControlStateChanged(changeInfo);
209
210                 ControlStateChangedEvent?.Invoke(this, changeInfo);
211             }
212         }
213
214         /// <summary>
215         /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
216         /// </summary>
217         /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
218         [EditorBrowsable(EditorBrowsableState.Never)]
219         public bool ExcludeLayouting
220         {
221             get
222             {
223                 return excludeLayouting;
224             }
225             set
226             {
227                 excludeLayouting = value;
228                 if (Layout != null && Layout.SetPositionByLayout == value)
229                 {
230                     Layout.SetPositionByLayout = !value;
231                     Layout.RequestLayout();
232                 }
233             }
234         }
235
236         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
237         [EditorBrowsable(EditorBrowsableState.Never)]
238         public bool IsResourcesCreated
239         {
240             get
241             {
242                 return Application.Current.IsResourcesCreated;
243             }
244         }
245
246         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
247         [EditorBrowsable(EditorBrowsableState.Never)]
248         public ResourceDictionary XamlResources
249         {
250             get
251             {
252                 return Application.Current.XamlResources;
253             }
254             set
255             {
256                 Application.Current.XamlResources = value;
257             }
258         }
259
260         /// <summary>
261         /// The StyleName, type string.
262         /// The value indicates DALi style name defined in json theme file.
263         /// </summary>
264         /// <since_tizen> 3 </since_tizen>
265         public string StyleName
266         {
267             get
268             {
269                 return (string)GetValue(StyleNameProperty);
270             }
271             set
272             {
273                 SetValue(StyleNameProperty, value);
274                 NotifyPropertyChanged();
275             }
276         }
277
278         /// <summary>
279         /// The KeyInputFocus, type bool.
280         /// </summary>
281         [EditorBrowsable(EditorBrowsableState.Never)]
282         public bool KeyInputFocus
283         {
284             get
285             {
286                 return (bool)GetValue(KeyInputFocusProperty);
287             }
288             set
289             {
290                 SetValue(KeyInputFocusProperty, value);
291                 NotifyPropertyChanged();
292             }
293         }
294
295         /// <summary>
296         /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
297         /// </summary>
298         /// <remarks>
299         /// <para>
300         /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
301         /// </para>
302         /// <para>
303         /// Animatable - This property can be animated using <c>Animation</c> class.
304         /// <code>
305         /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
306         /// </code>
307         /// </para>
308         /// </remarks>
309         /// <since_tizen> 3 </since_tizen>
310         public Color BackgroundColor
311         {
312             get
313             {
314                 Color temp = (Color)GetValue(BackgroundColorProperty);
315                 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
316             }
317             set
318             {
319                 SetValue(BackgroundColorProperty, value);
320                 NotifyPropertyChanged();
321             }
322         }
323
324         /// <summary>
325         /// The mutually exclusive with "backgroundColor" and "background" type Map.
326         /// </summary>
327         /// <since_tizen> 3 </since_tizen>
328         public string BackgroundImage
329         {
330             get
331             {
332                 return (string)GetValue(BackgroundImageProperty);
333             }
334             set
335             {
336                 SetValue(BackgroundImageProperty, value);
337                 NotifyPropertyChanged();
338             }
339         }
340
341         /// <summary>
342         /// Get or set the border of background image.
343         /// </summary>
344         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
345         [EditorBrowsable(EditorBrowsableState.Never)]
346         public Rectangle BackgroundImageBorder
347         {
348             get
349             {
350                 return (Rectangle)GetValue(BackgroundImageBorderProperty);
351             }
352             set
353             {
354                 SetValue(BackgroundImageBorderProperty, value);
355                 NotifyPropertyChanged();
356             }
357         }
358
359         /// <summary>
360         /// The background of view.
361         /// </summary>
362         /// <since_tizen> 3 </since_tizen>
363         public Tizen.NUI.PropertyMap Background
364         {
365             get
366             {
367                 return (PropertyMap)GetValue(BackgroundProperty);
368             }
369             set
370             {
371                 SetValue(BackgroundProperty, value);
372                 NotifyPropertyChanged();
373             }
374         }
375
376         /// <summary>
377         /// Describes a shadow as an image for a View.
378         /// It is null by default.
379         /// </summary>
380         /// <remarks>
381         /// Getter returns copied instance of current shadow.
382         /// </remarks>
383         /// <remarks>
384         /// The mutually exclusive with "BoxShadow".
385         /// </remarks>
386         /// <remarks>
387         /// <para>
388         /// Animatable - This property can be animated using <c>Animation</c> class.
389         /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
390         /// <code>
391         /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
392         /// </code>
393         /// Animatable sub-property : Offset.
394         /// </para>
395         /// </remarks>
396         [EditorBrowsable(EditorBrowsableState.Never)]
397         public ImageShadow ImageShadow
398         {
399             get
400             {
401                 return (ImageShadow)GetValue(ImageShadowProperty);
402             }
403             set
404             {
405                 SetValue(ImageShadowProperty, value);
406                 NotifyPropertyChanged();
407             }
408         }
409
410         /// <summary>
411         /// Describes a box shaped shadow drawing for a View.
412         /// It is null by default.
413         /// </summary>
414         /// <remarks>
415         /// The mutually exclusive with "ImageShadow".
416         /// </remarks>
417         /// <remarks>
418         /// <para>
419         /// Animatable - This property can be animated using <c>Animation</c> class.
420         /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
421         /// <code>
422         /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
423         /// </code>
424         /// Animatable sub-property : Offset, Color, BlurRadius.
425         /// </para>
426         /// </remarks>
427         /// <since_tizen> 9 </since_tizen>
428         public Shadow BoxShadow
429         {
430             get
431             {
432                 return (Shadow)GetValue(BoxShadowProperty);
433             }
434             set
435             {
436                 SetValue(BoxShadowProperty, value);
437                 NotifyPropertyChanged();
438             }
439         }
440
441         /// <summary>
442         /// The radius for the rounded corners of the View.
443         /// This will rounds background and shadow edges.
444         /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
445         /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
446         /// </summary>
447         /// <remarks>
448         /// <para>
449         /// Animatable - This property can be animated using <c>Animation</c> class.
450         /// </para>
451         /// </remarks>
452         /// <since_tizen> 9 </since_tizen>
453         public Vector4 CornerRadius
454         {
455             get
456             {
457                 return (Vector4)GetValue(CornerRadiusProperty);
458             }
459             set
460             {
461                 SetValue(CornerRadiusProperty, value);
462                 NotifyPropertyChanged();
463             }
464         }
465
466
467         /// <summary>
468         /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
469         /// It is absolute by default.
470         /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
471         /// </summary>
472         /// <since_tizen> 9 </since_tizen>
473         public VisualTransformPolicyType CornerRadiusPolicy
474         {
475             get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
476             set => SetValue(CornerRadiusPolicyProperty, value);
477         }
478
479         /// <summary>
480         /// The current state of the view.
481         /// </summary>
482         /// <since_tizen> 3 </since_tizen>
483         public States State
484         {
485             get
486             {
487                 return (States)GetValue(StateProperty);
488             }
489             set
490             {
491                 SetValue(StateProperty, value);
492                 NotifyPropertyChanged();
493             }
494         }
495
496         /// <summary>
497         /// The current sub state of the view.
498         /// </summary>
499         /// <since_tizen> 3 </since_tizen>
500         public States SubState
501         {
502             get
503             {
504                 return (States)GetValue(SubStateProperty);
505             }
506             set
507             {
508                 SetValue(SubStateProperty, value);
509                 NotifyPropertyChanged();
510             }
511         }
512
513         /// <summary>
514         /// Displays a tooltip
515         /// </summary>
516         /// <since_tizen> 3 </since_tizen>
517         public Tizen.NUI.PropertyMap Tooltip
518         {
519             get
520             {
521                 return (PropertyMap)GetValue(TooltipProperty);
522             }
523             set
524             {
525                 SetValue(TooltipProperty, value);
526                 NotifyPropertyChanged();
527             }
528         }
529
530         /// <summary>
531         /// Displays a tooltip as a text.
532         /// </summary>
533         /// <since_tizen> 3 </since_tizen>
534         public string TooltipText
535         {
536             get
537             {
538                 using (var propertyValue = GetProperty(Property.TOOLTIP))
539                 {
540                     if (propertyValue != null && propertyValue.Get(out string retrivedValue))
541                     {
542                         return retrivedValue;
543                     }
544                     NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
545                     return "error to get TooltipText";
546                 }
547             }
548             set
549             {
550                 var temp = new Tizen.NUI.PropertyValue(value);
551                 SetProperty(View.Property.TOOLTIP, temp);
552                 temp.Dispose();
553                 NotifyPropertyChanged();
554             }
555         }
556
557         /// <summary>
558         /// The Child property of FlexContainer.<br />
559         /// The proportion of the free space in the container, the flex item will receive.<br />
560         /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
561         /// </summary>
562         /// <since_tizen> 3 </since_tizen>
563         [Obsolete("Deprecated in API8, will be removed in API10.")]
564         public float Flex
565         {
566             get
567             {
568                 return (float)GetValue(FlexProperty);
569             }
570             set
571             {
572                 SetValue(FlexProperty, value);
573                 NotifyPropertyChanged();
574             }
575         }
576
577         /// <summary>
578         /// The Child property of FlexContainer.<br />
579         /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
580         /// </summary>
581         /// <since_tizen> 3 </since_tizen>
582         [Obsolete("Deprecated in API8, will be removed in API10.")]
583         public int AlignSelf
584         {
585             get
586             {
587                 return (int)GetValue(AlignSelfProperty);
588             }
589             set
590             {
591                 SetValue(AlignSelfProperty, value);
592                 NotifyPropertyChanged();
593             }
594         }
595
596         /// <summary>
597         /// The Child property of FlexContainer.<br />
598         /// The space around the flex item.<br />
599         /// </summary>
600         /// <remarks>
601         /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
602         /// </remarks>
603         /// <since_tizen> 3 </since_tizen>
604         [Obsolete("Deprecated in API8, will be removed in API10.")]
605         public Vector4 FlexMargin
606         {
607             get
608             {
609                 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
610                 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
611             }
612             set
613             {
614                 SetValue(FlexMarginProperty, value);
615                 NotifyPropertyChanged();
616             }
617         }
618
619         /// <summary>
620         /// The top-left cell this child occupies, if not set, the first available cell is used.
621         /// </summary>
622         /// <remarks>
623         /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
624         /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
625         /// </remarks>
626         /// <since_tizen> 3 </since_tizen>
627         public Vector2 CellIndex
628         {
629             get
630             {
631                 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
632                 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
633             }
634             set
635             {
636                 SetValue(CellIndexProperty, value);
637                 NotifyPropertyChanged();
638             }
639         }
640
641         /// <summary>
642         /// The number of rows this child occupies, if not set, the default value is 1.
643         /// </summary>
644         /// <remarks>
645         /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
646         /// </remarks>
647         /// <since_tizen> 3 </since_tizen>
648         public float RowSpan
649         {
650             get
651             {
652                 return (float)GetValue(RowSpanProperty);
653             }
654             set
655             {
656                 SetValue(RowSpanProperty, value);
657                 NotifyPropertyChanged();
658             }
659         }
660
661         /// <summary>
662         /// The number of columns this child occupies, if not set, the default value is 1.
663         /// </summary>
664         /// <remarks>
665         /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
666         /// </remarks>
667         /// <since_tizen> 3 </since_tizen>
668         public float ColumnSpan
669         {
670             get
671             {
672                 return (float)GetValue(ColumnSpanProperty);
673             }
674             set
675             {
676                 SetValue(ColumnSpanProperty, value);
677                 NotifyPropertyChanged();
678             }
679         }
680
681         /// <summary>
682         /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
683         /// </summary>
684         /// <remarks>
685         /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
686         /// </remarks>
687         /// <since_tizen> 3 </since_tizen>
688         public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
689         {
690             get
691             {
692                 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
693             }
694             set
695             {
696                 SetValue(CellHorizontalAlignmentProperty, value);
697                 NotifyPropertyChanged();
698             }
699         }
700
701         /// <summary>
702         /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
703         /// </summary>
704         /// <remarks>
705         /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
706         /// </remarks>
707         /// <since_tizen> 3 </since_tizen>
708         public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
709         {
710             get
711             {
712                 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
713             }
714             set
715             {
716                 SetValue(CellVerticalAlignmentProperty, value);
717                 NotifyPropertyChanged();
718             }
719         }
720
721         /// <summary>
722         /// The left focusable view.<br />
723         /// This will return null if not set.<br />
724         /// This will also return null if the specified left focusable view is not on a window.<br />
725         /// </summary>
726         /// <since_tizen> 3 </since_tizen>
727         public View LeftFocusableView
728         {
729             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
730             get
731             {
732                 return (View)GetValue(LeftFocusableViewProperty);
733             }
734             set
735             {
736                 SetValue(LeftFocusableViewProperty, value);
737                 NotifyPropertyChanged();
738             }
739         }
740
741         /// <summary>
742         /// The right focusable view.<br />
743         /// This will return null if not set.<br />
744         /// This will also return null if the specified right focusable view is not on a window.<br />
745         /// </summary>
746         /// <since_tizen> 3 </since_tizen>
747         public View RightFocusableView
748         {
749             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
750             get
751             {
752                 return (View)GetValue(RightFocusableViewProperty);
753             }
754             set
755             {
756                 SetValue(RightFocusableViewProperty, value);
757                 NotifyPropertyChanged();
758             }
759         }
760
761         /// <summary>
762         /// The up focusable view.<br />
763         /// This will return null if not set.<br />
764         /// This will also return null if the specified up focusable view is not on a window.<br />
765         /// </summary>
766         /// <since_tizen> 3 </since_tizen>
767         public View UpFocusableView
768         {
769             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
770             get
771             {
772                 return (View)GetValue(UpFocusableViewProperty);
773             }
774             set
775             {
776                 SetValue(UpFocusableViewProperty, value);
777                 NotifyPropertyChanged();
778             }
779         }
780
781         /// <summary>
782         /// The down focusable view.<br />
783         /// This will return null if not set.<br />
784         /// This will also return null if the specified down focusable view is not on a window.<br />
785         /// </summary>
786         /// <since_tizen> 3 </since_tizen>
787         public View DownFocusableView
788         {
789             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
790             get
791             {
792                 return (View)GetValue(DownFocusableViewProperty);
793             }
794             set
795             {
796                 SetValue(DownFocusableViewProperty, value);
797                 NotifyPropertyChanged();
798             }
799         }
800
801         /// <summary>
802         /// Whether the view should be focusable by keyboard navigation.
803         /// </summary>
804         /// <since_tizen> 3 </since_tizen>
805         public bool Focusable
806         {
807             set
808             {
809                 SetValue(FocusableProperty, value);
810                 NotifyPropertyChanged();
811             }
812             get
813             {
814                 return (bool)GetValue(FocusableProperty);
815             }
816         }
817
818         /// <summary>
819         ///  Retrieves the position of the view.<br />
820         ///  The coordinates are relative to the view's parent.<br />
821         /// </summary>
822         /// <since_tizen> 3 </since_tizen>
823         public Position CurrentPosition
824         {
825             get
826             {
827                 return GetCurrentPosition();
828             }
829         }
830
831         /// <summary>
832         /// Sets the size of a view for the width and the height.<br />
833         /// Geometry can be scaled to fit within this area.<br />
834         /// This does not interfere with the view's scale factor.<br />
835         /// The views default depth is the minimum of width and height.<br />
836         /// </summary>
837         /// <remarks>
838         /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
839         /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
840         /// </remarks>
841         /// <since_tizen> 3 </since_tizen>
842         public Size2D Size2D
843         {
844             get
845             {
846                 Size2D temp = (Size2D)GetValue(Size2DProperty);
847                 int width = temp.Width;
848                 int height = temp.Height;
849
850                 if (this.Layout == null)
851                 {
852                     if (width < 0) { width = 0; }
853                     if (height < 0) { height = 0; }
854                 }
855
856                 return new Size2D(OnSize2DChanged, width, height);
857             }
858             set
859             {
860                 SetValue(Size2DProperty, value);
861
862                 NotifyPropertyChanged();
863             }
864         }
865
866         /// <summary>
867         ///  Retrieves the size of the view.<br />
868         ///  The coordinates are relative to the view's parent.<br />
869         /// </summary>
870         /// <since_tizen> 3 </since_tizen>
871         public Size2D CurrentSize
872         {
873             get
874             {
875                 return GetCurrentSize();
876             }
877         }
878
879         /// <summary>
880         /// Retrieves and sets the view's opacity.<br />
881         /// </summary>
882         /// <since_tizen> 3 </since_tizen>
883         public float Opacity
884         {
885             get
886             {
887                 return (float)GetValue(OpacityProperty);
888             }
889             set
890             {
891                 SetValue(OpacityProperty, value);
892                 NotifyPropertyChanged();
893             }
894         }
895
896         /// <summary>
897         /// Sets the position of the view for X and Y.<br />
898         /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
899         /// If the position inheritance is disabled, sets the world position.<br />
900         /// </summary>
901         /// <remarks>
902         /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
903         /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
904         /// </remarks>
905         /// <since_tizen> 3 </since_tizen>
906         public Position2D Position2D
907         {
908             get
909             {
910                 Position2D temp = (Position2D)GetValue(Position2DProperty);
911                 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
912             }
913             set
914             {
915                 SetValue(Position2DProperty, value);
916                 NotifyPropertyChanged();
917             }
918         }
919
920         /// <summary>
921         /// Retrieves the screen position of the view.<br />
922         /// </summary>
923         /// <since_tizen> 3 </since_tizen>
924         public Vector2 ScreenPosition
925         {
926             get
927             {
928                 Vector2 temp = new Vector2(0.0f, 0.0f);
929                 var pValue = GetProperty(View.Property.ScreenPosition);
930                 pValue.Get(temp);
931                 pValue.Dispose();
932                 return temp;
933             }
934         }
935
936         /// <summary>
937         /// Determines whether the pivot point should be used to determine the position of the view.
938         /// This is false by default.
939         /// </summary>
940         /// <remarks>If false, then the top-left of the view is used for the position.
941         /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
942         /// </remarks>
943         /// <since_tizen> 3 </since_tizen>
944         public bool PositionUsesPivotPoint
945         {
946             get
947             {
948                 return (bool)GetValue(PositionUsesPivotPointProperty);
949             }
950             set
951             {
952                 SetValue(PositionUsesPivotPointProperty, value);
953                 NotifyPropertyChanged();
954             }
955         }
956
957         /// <summary>
958         /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
959         /// </summary>
960         /// <since_tizen> 3 </since_tizen>
961         [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
962             "Like: " +
963             "View view = new View(); " +
964             "view.PivotPoint = PivotPoint.Center; " +
965             "view.PositionUsesPivotPoint = true;" +
966             " Deprecated in API5: Will be removed in API8")]
967         [EditorBrowsable(EditorBrowsableState.Never)]
968         public bool PositionUsesAnchorPoint
969         {
970             get
971             {
972                 bool temp = false;
973                 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
974                 pValue.Get(out temp);
975                 pValue.Dispose();
976                 return temp;
977             }
978             set
979             {
980                 var temp = new Tizen.NUI.PropertyValue(value);
981                 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
982                 temp.Dispose();
983                 NotifyPropertyChanged();
984             }
985         }
986
987         /// <summary>
988         /// Queries whether the view is connected to the stage.<br />
989         /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
990         /// </summary>
991         /// <since_tizen> 3 </since_tizen>
992         public bool IsOnWindow
993         {
994             get
995             {
996                 return OnWindow();
997             }
998         }
999
1000         /// <summary>
1001         /// Gets the depth in the hierarchy for the view.
1002         /// </summary>
1003         /// <since_tizen> 3 </since_tizen>
1004         public int HierarchyDepth
1005         {
1006             get
1007             {
1008                 return GetHierarchyDepth();
1009             }
1010         }
1011
1012         /// <summary>
1013         /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1014         /// </summary>
1015         /// <remarks>
1016         /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1017         /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1018         /// The values set by this property will likely change.
1019         /// </remarks>
1020         /// <since_tizen> 3 </since_tizen>
1021         public int SiblingOrder
1022         {
1023             get
1024             {
1025                 return (int)GetValue(SiblingOrderProperty);
1026             }
1027             set
1028             {
1029                 SetValue(SiblingOrderProperty, value);
1030
1031                 LayoutGroup layout = Layout as LayoutGroup;
1032                 layout?.ChangeLayoutSiblingOrder(value);
1033
1034                 NotifyPropertyChanged();
1035             }
1036         }
1037
1038         /// <summary>
1039         /// Returns the natural size of the view.
1040         /// </summary>
1041         /// <remarks>
1042         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1043         /// </remarks>
1044         /// <since_tizen> 5 </since_tizen>
1045         public Vector3 NaturalSize
1046         {
1047             get
1048             {
1049                 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1050                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1051                 return ret;
1052             }
1053         }
1054
1055         /// <summary>
1056         /// Returns the natural size (Size2D) of the view.
1057         /// </summary>
1058         /// <remarks>
1059         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1060         /// </remarks>
1061         /// <since_tizen> 4 </since_tizen>
1062         public Size2D NaturalSize2D
1063         {
1064             get
1065             {
1066                 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1067                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1068
1069                 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1070                 temp.Dispose();
1071                 return sz;
1072             }
1073         }
1074
1075         /// <summary>
1076         /// Gets or sets the origin of a view within its parent's area.<br />
1077         /// 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 />
1078         /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1079         /// A view's position is the distance between this origin and the view's anchor-point.<br />
1080         /// </summary>
1081         /// <pre>The view has been initialized.</pre>
1082         /// <since_tizen> 3 </since_tizen>
1083         public Position ParentOrigin
1084         {
1085             get
1086             {
1087                 Position tmp = (Position)GetValue(ParentOriginProperty);
1088                 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1089             }
1090             set
1091             {
1092                 SetValue(ParentOriginProperty, value);
1093                 NotifyPropertyChanged();
1094             }
1095         }
1096
1097         /// <summary>
1098         /// Gets or sets the anchor-point of a view.<br />
1099         /// 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 />
1100         /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1101         /// A view position is the distance between its parent-origin and this anchor-point.<br />
1102         /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1103         /// <pre>The view has been initialized.</pre>
1104         /// </summary>
1105         /// <remarks>
1106         /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1107         /// </remarks>
1108         /// <since_tizen> 3 </since_tizen>
1109         public Position PivotPoint
1110         {
1111             get
1112             {
1113                 Position tmp = (Position)GetValue(PivotPointProperty);
1114                 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1115             }
1116             set
1117             {
1118                 SetValue(PivotPointProperty, value);
1119                 NotifyPropertyChanged();
1120             }
1121         }
1122
1123         /// <summary>
1124         /// Gets or sets the size width of the view.
1125         /// </summary>
1126         /// <remarks>
1127         /// <para>
1128         /// Animatable - This property can be animated using <c>Animation</c> class.
1129         /// </para>
1130         /// </remarks>
1131         /// <since_tizen> 3 </since_tizen>
1132         public float SizeWidth
1133         {
1134             get
1135             {
1136                 return (float)GetValue(SizeWidthProperty);
1137             }
1138             set
1139             {
1140                 SetValue(SizeWidthProperty, value);
1141                 NotifyPropertyChanged();
1142             }
1143         }
1144
1145         /// <summary>
1146         /// Gets or sets the size height of the view.
1147         /// </summary>
1148         /// <remarks>
1149         /// <para>
1150         /// Animatable - This property can be animated using <c>Animation</c> class.
1151         /// </para>
1152         /// </remarks>
1153         /// <since_tizen> 3 </since_tizen>
1154         public float SizeHeight
1155         {
1156             get
1157             {
1158                 return (float)GetValue(SizeHeightProperty);
1159             }
1160             set
1161             {
1162                 SetValue(SizeHeightProperty, value);
1163                 NotifyPropertyChanged();
1164             }
1165         }
1166
1167         /// <summary>
1168         /// Gets or sets the position of the view.<br />
1169         /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1170         /// If the position inheritance is disabled, sets the world position.<br />
1171         /// </summary>
1172         /// <remarks>
1173         /// <para>
1174         /// Animatable - This property can be animated using <c>Animation</c> class.
1175         /// </para>
1176         /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1177         /// </remarks>
1178         /// <since_tizen> 3 </since_tizen>
1179         public Position Position
1180         {
1181             get
1182             {
1183                 Position tmp = (Position)GetValue(PositionProperty);
1184                 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1185             }
1186             set
1187             {
1188                 SetValue(PositionProperty, value);
1189                 NotifyPropertyChanged();
1190             }
1191         }
1192
1193         /// <summary>
1194         /// Gets or sets the position X of the view.
1195         /// </summary>
1196         /// <remarks>
1197         /// <para>
1198         /// Animatable - This property can be animated using <c>Animation</c> class.
1199         /// </para>
1200         /// </remarks>
1201         /// <since_tizen> 3 </since_tizen>
1202         public float PositionX
1203         {
1204             get
1205             {
1206                 return (float)GetValue(PositionXProperty);
1207             }
1208             set
1209             {
1210                 SetValue(PositionXProperty, value);
1211                 NotifyPropertyChanged();
1212             }
1213         }
1214
1215         /// <summary>
1216         /// Gets or sets the position Y of the view.
1217         /// </summary>
1218         /// <remarks>
1219         /// <para>
1220         /// Animatable - This property can be animated using <c>Animation</c> class.
1221         /// </para>
1222         /// </remarks>
1223         /// <since_tizen> 3 </since_tizen>
1224         public float PositionY
1225         {
1226             get
1227             {
1228                 return (float)GetValue(PositionYProperty);
1229             }
1230             set
1231             {
1232                 SetValue(PositionYProperty, value);
1233                 NotifyPropertyChanged();
1234             }
1235         }
1236
1237         /// <summary>
1238         /// Gets or sets the position Z of the view.
1239         /// </summary>
1240         /// <remarks>
1241         /// <para>
1242         /// Animatable - This property can be animated using <c>Animation</c> class.
1243         /// </para>
1244         /// </remarks>
1245         /// <since_tizen> 3 </since_tizen>
1246         public float PositionZ
1247         {
1248             get
1249             {
1250                 return (float)GetValue(PositionZProperty);
1251             }
1252             set
1253             {
1254                 SetValue(PositionZProperty, value);
1255                 NotifyPropertyChanged();
1256             }
1257         }
1258
1259         /// <summary>
1260         /// Gets or sets the world position of the view.
1261         /// </summary>
1262         /// <since_tizen> 3 </since_tizen>
1263         public Vector3 WorldPosition
1264         {
1265             get
1266             {
1267                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1268                 var pValue = GetProperty(View.Property.WorldPosition);
1269                 pValue.Get(temp);
1270                 pValue.Dispose();
1271                 return temp;
1272             }
1273         }
1274
1275         /// <summary>
1276         /// Gets or sets the orientation of the view.<br />
1277         /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1278         /// </summary>
1279         /// <remarks>
1280         /// <para>
1281         /// This is an asynchronous method.
1282         /// </para>
1283         /// <para>
1284         /// Animatable - This property can be animated using <c>Animation</c> class.
1285         /// </para>
1286         /// </remarks>
1287         /// <since_tizen> 3 </since_tizen>
1288         public Rotation Orientation
1289         {
1290             get
1291             {
1292                 return (Rotation)GetValue(OrientationProperty);
1293             }
1294             set
1295             {
1296                 SetValue(OrientationProperty, value);
1297                 NotifyPropertyChanged();
1298             }
1299         }
1300
1301         /// <summary>
1302         /// Gets or sets the world orientation of the view.<br />
1303         /// </summary>
1304         /// <since_tizen> 3 </since_tizen>
1305         public Rotation WorldOrientation
1306         {
1307             get
1308             {
1309                 Rotation temp = new Rotation();
1310                 var pValue = GetProperty(View.Property.WorldOrientation);
1311                 pValue.Get(temp);
1312                 pValue.Dispose();
1313                 return temp;
1314             }
1315         }
1316
1317         /// <summary>
1318         /// Gets or sets the scale factor applied to the view.<br />
1319         /// </summary>
1320         /// <remarks>
1321         /// <para>
1322         /// Animatable - This property can be animated using <c>Animation</c> class.
1323         /// </para>
1324         /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1325         /// </remarks>
1326         /// <since_tizen> 3 </since_tizen>
1327         public Vector3 Scale
1328         {
1329             get
1330             {
1331                 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1332                 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1333             }
1334             set
1335             {
1336                 SetValue(ScaleProperty, value);
1337                 NotifyPropertyChanged();
1338             }
1339         }
1340
1341         /// <summary>
1342         /// Gets or sets the scale X factor applied to the view.
1343         /// </summary>
1344         /// <remarks>
1345         /// <para>
1346         /// Animatable - This property can be animated using <c>Animation</c> class.
1347         /// </para>
1348         /// </remarks>
1349         /// <since_tizen> 3 </since_tizen>
1350         public float ScaleX
1351         {
1352             get
1353             {
1354                 return (float)GetValue(ScaleXProperty);
1355             }
1356             set
1357             {
1358                 SetValue(ScaleXProperty, value);
1359                 NotifyPropertyChanged();
1360             }
1361         }
1362
1363         /// <summary>
1364         /// Gets or sets the scale Y factor applied to the view.
1365         /// </summary>
1366         /// <remarks>
1367         /// <para>
1368         /// Animatable - This property can be animated using <c>Animation</c> class.
1369         /// </para>
1370         /// </remarks>
1371         /// <since_tizen> 3 </since_tizen>
1372         public float ScaleY
1373         {
1374             get
1375             {
1376                 return (float)GetValue(ScaleYProperty);
1377             }
1378             set
1379             {
1380                 SetValue(ScaleYProperty, value);
1381                 NotifyPropertyChanged();
1382             }
1383         }
1384
1385         /// <summary>
1386         /// Gets or sets the scale Z factor applied to the view.
1387         /// </summary>
1388         /// <remarks>
1389         /// <para>
1390         /// Animatable - This property can be animated using <c>Animation</c> class.
1391         /// </para>
1392         /// </remarks>
1393         /// <since_tizen> 3 </since_tizen>
1394         public float ScaleZ
1395         {
1396             get
1397             {
1398                 return (float)GetValue(ScaleZProperty);
1399             }
1400             set
1401             {
1402                 SetValue(ScaleZProperty, value);
1403                 NotifyPropertyChanged();
1404             }
1405         }
1406
1407         /// <summary>
1408         /// Gets the world scale of the view.
1409         /// </summary>
1410         /// <since_tizen> 3 </since_tizen>
1411         public Vector3 WorldScale
1412         {
1413             get
1414             {
1415                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1416                 var pValue = GetProperty(View.Property.WorldScale);
1417                 pValue.Get(temp);
1418                 pValue.Dispose();
1419                 return temp;
1420             }
1421         }
1422
1423         /// <summary>
1424         /// Retrieves the visibility flag of the view.
1425         /// </summary>
1426         /// <remarks>
1427         /// <para>
1428         /// If the view is not visible, then the view and its children will not be rendered.
1429         /// 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.
1430         /// </para>
1431         /// <para>
1432         /// Animatable - This property can be animated using <c>Animation</c> class.
1433         /// </para>
1434         /// </remarks>
1435         /// <since_tizen> 3 </since_tizen>
1436         public bool Visibility
1437         {
1438             get
1439             {
1440                 bool temp = false;
1441                 var pValue = GetProperty(View.Property.VISIBLE);
1442                 pValue.Get(out temp);
1443                 pValue.Dispose();
1444                 return temp;
1445             }
1446         }
1447
1448         /// <summary>
1449         /// Gets the view's world color.
1450         /// </summary>
1451         /// <since_tizen> 3 </since_tizen>
1452         public Vector4 WorldColor
1453         {
1454             get
1455             {
1456                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1457                 var pValue = GetProperty(View.Property.WorldColor);
1458                 pValue.Get(temp);
1459                 pValue.Dispose();
1460                 return temp;
1461             }
1462         }
1463
1464         /// <summary>
1465         /// Gets or sets the view's name.
1466         /// </summary>
1467         /// <since_tizen> 3 </since_tizen>
1468         public string Name
1469         {
1470             get
1471             {
1472                 return (string)GetValue(NameProperty);
1473             }
1474             set
1475             {
1476                 SetValue(NameProperty, value);
1477                 NotifyPropertyChanged();
1478             }
1479         }
1480
1481         /// <summary>
1482         /// Get the number of children held by the view.
1483         /// </summary>
1484         /// <since_tizen> 3 </since_tizen>
1485         public new uint ChildCount
1486         {
1487             get
1488             {
1489                 return Convert.ToUInt32(Children.Count);
1490             }
1491         }
1492
1493         /// <summary>
1494         /// Gets the view's ID.
1495         /// Read-only
1496         /// </summary>
1497         /// <since_tizen> 3 </since_tizen>
1498         public uint ID
1499         {
1500             get
1501             {
1502                 return GetId();
1503             }
1504         }
1505
1506         /// <summary>
1507         /// Gets or sets the status of whether the view should emit touch or hover signals.
1508         /// </summary>
1509         /// <since_tizen> 3 </since_tizen>
1510         public bool Sensitive
1511         {
1512             get
1513             {
1514                 return (bool)GetValue(SensitiveProperty);
1515             }
1516             set
1517             {
1518                 SetValue(SensitiveProperty, value);
1519                 NotifyPropertyChanged();
1520             }
1521         }
1522
1523         /// <summary>
1524         /// 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.
1525         /// </summary>
1526         /// <since_tizen> 3 </since_tizen>
1527         public bool LeaveRequired
1528         {
1529             get
1530             {
1531                 return (bool)GetValue(LeaveRequiredProperty);
1532             }
1533             set
1534             {
1535                 SetValue(LeaveRequiredProperty, value);
1536                 NotifyPropertyChanged();
1537             }
1538         }
1539
1540         /// <summary>
1541         /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1542         /// </summary>
1543         /// <since_tizen> 3 </since_tizen>
1544         public bool InheritOrientation
1545         {
1546             get
1547             {
1548                 return (bool)GetValue(InheritOrientationProperty);
1549             }
1550             set
1551             {
1552                 SetValue(InheritOrientationProperty, value);
1553                 NotifyPropertyChanged();
1554             }
1555         }
1556
1557         /// <summary>
1558         /// Gets or sets the status of whether a child view inherits it's parent's scale.
1559         /// </summary>
1560         /// <since_tizen> 3 </since_tizen>
1561         public bool InheritScale
1562         {
1563             get
1564             {
1565                 return (bool)GetValue(InheritScaleProperty);
1566             }
1567             set
1568             {
1569                 SetValue(InheritScaleProperty, value);
1570                 NotifyPropertyChanged();
1571             }
1572         }
1573
1574         /// <summary>
1575         /// Gets or sets the status of how the view and its children should be drawn.<br />
1576         /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1577         /// 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 />
1578         /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1579         /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1580         /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1581         /// </summary>
1582         /// <since_tizen> 3 </since_tizen>
1583         public DrawModeType DrawMode
1584         {
1585             get
1586             {
1587                 return (DrawModeType)GetValue(DrawModeProperty);
1588             }
1589             set
1590             {
1591                 SetValue(DrawModeProperty, value);
1592                 NotifyPropertyChanged();
1593             }
1594         }
1595
1596         /// <summary>
1597         /// Gets or sets the relative to parent size factor of the view.<br />
1598         /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1599         /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1600         /// </summary>
1601         /// <remarks>
1602         /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1603         /// </remarks>
1604         /// <since_tizen> 3 </since_tizen>
1605         public Vector3 SizeModeFactor
1606         {
1607             get
1608             {
1609                 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1610                 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1611             }
1612             set
1613             {
1614                 SetValue(SizeModeFactorProperty, value);
1615                 NotifyPropertyChanged();
1616             }
1617         }
1618
1619         /// <summary>
1620         /// Gets or sets the width resize policy to be used.
1621         /// </summary>
1622         /// <since_tizen> 3 </since_tizen>
1623         public ResizePolicyType WidthResizePolicy
1624         {
1625             get
1626             {
1627                 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1628             }
1629             set
1630             {
1631                 SetValue(WidthResizePolicyProperty, value);
1632                 NotifyPropertyChanged();
1633             }
1634         }
1635
1636         /// <summary>
1637         /// Gets or sets the height resize policy to be used.
1638         /// </summary>
1639         /// <since_tizen> 3 </since_tizen>
1640         public ResizePolicyType HeightResizePolicy
1641         {
1642             get
1643             {
1644                 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1645             }
1646             set
1647             {
1648                 SetValue(HeightResizePolicyProperty, value);
1649                 NotifyPropertyChanged();
1650             }
1651         }
1652
1653         /// <summary>
1654         /// Gets or sets the policy to use when setting size with size negotiation.<br />
1655         /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1656         /// </summary>
1657         /// <since_tizen> 3 </since_tizen>
1658         public SizeScalePolicyType SizeScalePolicy
1659         {
1660             get
1661             {
1662                 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1663             }
1664             set
1665             {
1666                 SetValue(SizeScalePolicyProperty, value);
1667                 NotifyPropertyChanged();
1668             }
1669         }
1670
1671         /// <summary>
1672         ///  Gets or sets the status of whether the width size is dependent on the height size.
1673         /// </summary>
1674         /// <since_tizen> 3 </since_tizen>
1675         public bool WidthForHeight
1676         {
1677             get
1678             {
1679                 return (bool)GetValue(WidthForHeightProperty);
1680             }
1681             set
1682             {
1683                 SetValue(WidthForHeightProperty, value);
1684                 NotifyPropertyChanged();
1685             }
1686         }
1687
1688         /// <summary>
1689         /// Gets or sets the status of whether the height size is dependent on the width size.
1690         /// </summary>
1691         /// <since_tizen> 3 </since_tizen>
1692         public bool HeightForWidth
1693         {
1694             get
1695             {
1696                 return (bool)GetValue(HeightForWidthProperty);
1697             }
1698             set
1699             {
1700                 SetValue(HeightForWidthProperty, value);
1701                 NotifyPropertyChanged();
1702             }
1703         }
1704
1705         /// <summary>
1706         /// Gets or sets the padding for use in layout.
1707         /// </summary>
1708         /// <remarks>
1709         /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1710         /// </remarks>
1711         /// <since_tizen> 5 </since_tizen>
1712         public Extents Padding
1713         {
1714             get
1715             {
1716                 // If View has a Layout then padding in stored in the base Layout class
1717                 if (Layout != null)
1718                 {
1719                     return Layout.Padding;
1720                 }
1721                 else
1722                 {
1723                     Extents temp = (Extents)GetValue(PaddingProperty);
1724                     return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1725                 }
1726                 // Two return points to prevent creating a zeroed Extent native object before assignment
1727             }
1728             set
1729             {
1730                 Extents padding = value;
1731                 if (Layout != null)
1732                 {
1733                     // Layout set so store Padding in LayoutItem instead of in View.
1734                     // If View stores the Padding value then Legacy Size Negotiation will overwrite
1735                     // the position and sizes measure in the Layouting.
1736                     Layout.Padding = value;
1737                     // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1738                     // Let the View keeps it's padding.  Still store Padding in Layout to reduce code paths.
1739                     if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1740                     {
1741                         padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1742                     }
1743                 }
1744
1745                 SetValue(PaddingProperty, padding);
1746                 NotifyPropertyChanged();
1747             }
1748         }
1749
1750         /// <summary>
1751         /// Gets or sets the minimum size the view can be assigned in size negotiation.
1752         /// </summary>
1753         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1754         /// <remarks>
1755         /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1756         /// </remarks>
1757         /// <since_tizen> 3 </since_tizen>
1758         public Size2D MinimumSize
1759         {
1760             get
1761             {
1762                 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1763                 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1764             }
1765             set
1766             {
1767                 if (value == null)
1768                 {
1769                     throw new ArgumentNullException(nameof(value));
1770                 }
1771                 if (layout != null)
1772                 {
1773                     // Note: it only works if minimum size is >= than natural size.
1774                     // To force the size it should be done through the width&height spec or Size2D.
1775                     layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1776                     layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1777                     layout.RequestLayout();
1778                 }
1779                 SetValue(MinimumSizeProperty, value);
1780                 NotifyPropertyChanged();
1781             }
1782         }
1783
1784         /// <summary>
1785         /// Gets or sets the maximum size the view can be assigned in size negotiation.
1786         /// </summary>
1787         /// <remarks>
1788         /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1789         /// </remarks>
1790         /// <since_tizen> 3 </since_tizen>
1791         public Size2D MaximumSize
1792         {
1793             get
1794             {
1795                 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1796                 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1797             }
1798             set
1799             {
1800                 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1801                 // MATCH_PARENT spec + parent container size can be used to limit
1802                 if (layout != null)
1803                 {
1804                     layout.RequestLayout();
1805                 }
1806                 SetValue(MaximumSizeProperty, value);
1807                 NotifyPropertyChanged();
1808             }
1809         }
1810
1811         /// <summary>
1812         /// Gets or sets whether a child view inherits it's parent's position.<br />
1813         /// Default is to inherit.<br />
1814         /// 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 />
1815         /// </summary>
1816         /// <since_tizen> 3 </since_tizen>
1817         public bool InheritPosition
1818         {
1819             get
1820             {
1821                 return (bool)GetValue(InheritPositionProperty);
1822             }
1823             set
1824             {
1825                 SetValue(InheritPositionProperty, value);
1826                 NotifyPropertyChanged();
1827             }
1828         }
1829
1830         /// <summary>
1831         /// Gets or sets the clipping behavior (mode) of it's children.
1832         /// </summary>
1833         /// <since_tizen> 3 </since_tizen>
1834         public ClippingModeType ClippingMode
1835         {
1836             get
1837             {
1838                 return (ClippingModeType)GetValue(ClippingModeProperty);
1839             }
1840             set
1841             {
1842                 SetValue(ClippingModeProperty, value);
1843                 NotifyPropertyChanged();
1844             }
1845         }
1846
1847         /// <summary>
1848         /// Gets the number of renderers held by the view.
1849         /// </summary>
1850         /// <since_tizen> 3 </since_tizen>
1851         public uint RendererCount
1852         {
1853             get
1854             {
1855                 return GetRendererCount();
1856             }
1857         }
1858
1859         /// <summary>
1860         /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1861         /// </summary>
1862         /// <remarks>
1863         /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1864         /// </remarks>
1865         /// <since_tizen> 3 </since_tizen>
1866         [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1867             "Like: " +
1868             "View view = new View(); " +
1869             "view.PivotPoint = PivotPoint.Center; " +
1870             "view.PositionUsesPivotPoint = true;")]
1871         [EditorBrowsable(EditorBrowsableState.Never)]
1872         public Position AnchorPoint
1873         {
1874             get
1875             {
1876                 Position temp = new Position(0.0f, 0.0f, 0.0f);
1877                 var pValue = GetProperty(View.Property.AnchorPoint);
1878                 pValue.Get(temp);
1879                 pValue.Dispose();
1880                 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1881                 temp.Dispose();
1882                 return ret;
1883             }
1884             set
1885             {
1886                 var temp = new Tizen.NUI.PropertyValue(value);
1887                 SetProperty(View.Property.AnchorPoint, temp);
1888                 temp.Dispose();
1889                 NotifyPropertyChanged();
1890             }
1891         }
1892
1893         /// <summary>
1894         /// Sets the size of a view for the width, the height and the depth.<br />
1895         /// Geometry can be scaled to fit within this area.<br />
1896         /// This does not interfere with the view's scale factor.<br />
1897         /// The views default depth is the minimum of width and height.<br />
1898         /// </summary>
1899         /// <remarks>
1900         /// <para>
1901         /// Animatable - This property can be animated using <c>Animation</c> class.
1902         /// </para>
1903         /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1904         /// </remarks>
1905         /// <since_tizen> 5 </since_tizen>
1906         public Size Size
1907         {
1908             get
1909             {
1910                 Size tmp = (Size)GetValue(SizeProperty);
1911                 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1912             }
1913             set
1914             {
1915                 SetValue(SizeProperty, value);
1916                 NotifyPropertyChanged();
1917             }
1918         }
1919
1920         /// <summary>
1921         /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1922         /// </summary>
1923         /// <since_tizen> 3 </since_tizen>
1924         [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1925             "Like: " +
1926             "Container parent =  view.GetParent(); " +
1927             "View view = parent as View;")]
1928         [EditorBrowsable(EditorBrowsableState.Never)]
1929         public new View Parent
1930         {
1931             get
1932             {
1933                 View ret;
1934                 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1935                 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1936                 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1937
1938                 if (basehandle is Layer layer)
1939                 {
1940                     ret = new View(Layer.getCPtr(layer).Handle, false);
1941                     NUILog.Error("This Parent property is deprecated, should do not be used");
1942                 }
1943                 else
1944                 {
1945                     ret = basehandle as View;
1946                 }
1947
1948                 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1949                 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1950
1951                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1952                 return ret;
1953             }
1954         }
1955
1956         /// <summary>
1957         /// Gets/Sets whether inherit parent's the layout Direction.
1958         /// </summary>
1959         /// <since_tizen> 4 </since_tizen>
1960         public bool InheritLayoutDirection
1961         {
1962             get
1963             {
1964                 return (bool)GetValue(InheritLayoutDirectionProperty);
1965             }
1966             set
1967             {
1968                 SetValue(InheritLayoutDirectionProperty, value);
1969                 NotifyPropertyChanged();
1970             }
1971         }
1972
1973         /// <summary>
1974         /// Gets/Sets the layout Direction.
1975         /// </summary>
1976         /// <since_tizen> 4 </since_tizen>
1977         public ViewLayoutDirectionType LayoutDirection
1978         {
1979             get
1980             {
1981                 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1982             }
1983             set
1984             {
1985                 SetValue(LayoutDirectionProperty, value);
1986                 NotifyPropertyChanged();
1987                 layout?.RequestLayout();
1988             }
1989         }
1990
1991         /// <summary>
1992         /// Gets or sets the Margin for use in layout.
1993         /// </summary>
1994         /// <remarks>
1995         /// Margin property is supported by Layout algorithms and containers.
1996         /// Please Set Layout if you want to use Margin property.
1997         /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1998         /// </remarks>
1999         /// <since_tizen> 4 </since_tizen>
2000         public Extents Margin
2001         {
2002             get
2003             {
2004                 // If View has a Layout then margin is stored in Layout.
2005                 if (Layout != null)
2006                 {
2007                     return Layout.Margin;
2008                 }
2009                 else
2010                 {
2011                     // If Layout not set then return margin stored in View.
2012                     Extents temp = (Extents)GetValue(MarginProperty);
2013                     return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2014                 }
2015                 // Two return points to prevent creating a zeroed Extent native object before assignment
2016             }
2017             set
2018             {
2019                 if (Layout != null)
2020                 {
2021                     // Layout set so store Margin in LayoutItem instead of View.
2022                     // If View stores the Margin too then the Legacy Size Negotiation will
2023                     // overwrite the position and size values measured in the Layouting.
2024                     Layout.Margin = value;
2025                     SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2026                     layout?.RequestLayout();
2027                 }
2028                 else
2029                 {
2030                     SetValue(MarginProperty, value);
2031                 }
2032                 NotifyPropertyChanged();
2033                 layout?.RequestLayout();
2034             }
2035         }
2036
2037         ///<summary>
2038         /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2039         ///</summary>
2040         /// <example>
2041         /// <code>
2042         /// // matchParentView matches its size to its parent size.
2043         /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2044         /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2045         ///
2046         /// // wrapContentView wraps its children with their desired size.
2047         /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2048         /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2049         ///
2050         /// // exactSizeView shows itself with an exact size.
2051         /// exactSizeView.WidthSpecification = 100;
2052         /// exactSizeView.HeightSpecification = 100;
2053         /// </code>
2054         /// </example>
2055         /// <since_tizen> 6 </since_tizen>
2056         public int WidthSpecification
2057         {
2058             get
2059             {
2060                 return widthPolicy;
2061             }
2062             set
2063             {
2064                 if (value == widthPolicy)
2065                     return;
2066
2067                 widthPolicy = value;
2068                 if (widthPolicy >= 0)
2069                 {
2070                     if (heightPolicy >= 0) // Policy an exact value
2071                     {
2072                         // Create Size2D only both _widthPolicy and _heightPolicy are set.
2073                         Size2D = new Size2D(widthPolicy, heightPolicy);
2074                     }
2075                 }
2076                 layout?.RequestLayout();
2077             }
2078         }
2079
2080         ///<summary>
2081         /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2082         ///</summary>
2083         /// <example>
2084         /// <code>
2085         /// // matchParentView matches its size to its parent size.
2086         /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2087         /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2088         ///
2089         /// // wrapContentView wraps its children with their desired size.
2090         /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2091         /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2092         ///
2093         /// // exactSizeView shows itself with an exact size.
2094         /// exactSizeView.WidthSpecification = 100;
2095         /// exactSizeView.HeightSpecification = 100;
2096         /// </code>
2097         /// </example>
2098         /// <since_tizen> 6 </since_tizen>
2099         public int HeightSpecification
2100         {
2101             get
2102             {
2103                 return heightPolicy;
2104             }
2105             set
2106             {
2107                 if (value == heightPolicy)
2108                     return;
2109
2110                 heightPolicy = value;
2111                 if (heightPolicy >= 0)
2112                 {
2113                     if (widthPolicy >= 0) // Policy an exact value
2114                     {
2115                         // Create Size2D only both _widthPolicy and _heightPolicy are set.
2116                         Size2D = new Size2D(widthPolicy, heightPolicy);
2117                     }
2118                 }
2119                 layout?.RequestLayout();
2120             }
2121         }
2122
2123         ///<summary>
2124         /// Gets the List of transitions for this View.
2125         ///</summary>
2126         /// <since_tizen> 6 </since_tizen>
2127         public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2128         {
2129             get
2130             {
2131                 if (layoutTransitions == null)
2132                 {
2133                     layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2134                 }
2135                 return layoutTransitions;
2136             }
2137         }
2138
2139         ///<summary>
2140         /// Sets a layout transitions for this View.
2141         ///</summary>
2142         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2143         /// <remarks>
2144         /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2145         /// </remarks>
2146         /// <since_tizen> 6 </since_tizen>
2147         public LayoutTransition LayoutTransition
2148         {
2149             get
2150             {
2151                 return layoutTransition;
2152             }
2153             set
2154             {
2155                 if (value == null)
2156                 {
2157                     throw new global::System.ArgumentNullException(nameof(value));
2158                 }
2159                 if (layoutTransitions == null)
2160                 {
2161                     layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2162                 }
2163
2164                 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2165
2166                 AttachTransitionsToChildren(value);
2167
2168                 layoutTransition = value;
2169             }
2170         }
2171
2172         /// <summary>
2173         /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2174         /// </summary>
2175         /// <remarks>
2176         /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2177         /// </remarks>
2178         /// <since_tizen> 4 </since_tizen>
2179         [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2180         [EditorBrowsable(EditorBrowsableState.Never)]
2181         public Extents PaddingEX
2182         {
2183             get
2184             {
2185                 Extents temp = new Extents(0, 0, 0, 0);
2186                 var pValue = GetProperty(View.Property.PADDING);
2187                 pValue.Get(temp);
2188                 pValue.Dispose();
2189                 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2190                 temp.Dispose();
2191                 return ret;
2192             }
2193             set
2194             {
2195                 var temp = new Tizen.NUI.PropertyValue(value);
2196                 SetProperty(View.Property.PADDING, temp);
2197                 temp.Dispose();
2198                 NotifyPropertyChanged();
2199                 layout?.RequestLayout();
2200             }
2201         }
2202
2203         /// <summary>
2204         /// The Color of View. This is an RGBA value.
2205         /// </summary>
2206         /// <remarks>
2207         /// <para>
2208         /// Animatable - This property can be animated using <c>Animation</c> class.
2209         /// </para>
2210         /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2211         /// </remarks>
2212         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2213         [EditorBrowsable(EditorBrowsableState.Never)]
2214         public Color Color
2215         {
2216             get
2217             {
2218                 Color temp = (Color)GetValue(ColorProperty);
2219                 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2220             }
2221             set
2222             {
2223                 SetValue(ColorProperty, value);
2224                 NotifyPropertyChanged();
2225             }
2226         }
2227
2228         /// <summary>
2229         /// Set the layout on this View. Replaces any existing Layout.
2230         /// </summary>
2231         /// <remarks>
2232         /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2233         /// </remarks>
2234         /// <since_tizen> 6 </since_tizen>
2235         public LayoutItem Layout
2236         {
2237             get
2238             {
2239                 return layout;
2240             }
2241             set
2242             {
2243                 // Do nothing if layout provided is already set on this View.
2244                 if (value == layout)
2245                 {
2246                     return;
2247                 }
2248
2249                 LayoutingDisabled = false;
2250                 layoutSet = true;
2251
2252                 // If new layout being set already has a owner then that owner receives a replacement default layout.
2253                 // First check if the layout to be set already has a owner.
2254                 if (value?.Owner != null)
2255                 {
2256                     // Previous owner of the layout gets a default layout as a replacement.
2257                     value.Owner.Layout = new AbsoluteLayout();
2258
2259                     // Copy Margin and Padding to replacement LayoutGroup.
2260                     if (value.Owner.Layout != null)
2261                     {
2262                         value.Owner.Layout.Margin = value.Margin;
2263                         value.Owner.Layout.Padding = value.Padding;
2264                     }
2265                 }
2266
2267                 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2268                 // View if no replacement. Previously margin and padding values would have been moved from
2269                 // the View to the layout.
2270                 if (layout != null) // Existing layout
2271                 {
2272                     if (value != null)
2273                     {
2274                         // Existing layout being replaced so copy over margin and padding values.
2275                         value.Margin = layout.Margin;
2276                         value.Padding = layout.Padding;
2277                     }
2278                     else
2279                     {
2280                         // Layout not being replaced so restore margin and padding to View.
2281                         SetValue(MarginProperty, layout.Margin);
2282                         SetValue(PaddingProperty, layout.Padding);
2283                         NotifyPropertyChanged();
2284                     }
2285                 }
2286                 else
2287                 {
2288                     // First Layout to be added to the View hence copy
2289
2290                     // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2291                     if (value != null)
2292                     {
2293                         Extents margin = Margin;
2294                         Extents padding = Padding;
2295                         if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2296                         {
2297                             // If View already has a margin set then store it in Layout instead.
2298                             value.Margin = margin;
2299                             SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2300                             NotifyPropertyChanged();
2301                         }
2302
2303                         if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2304                         {
2305                             // If View already has a padding set then store it in Layout instead.
2306                             value.Padding = padding;
2307
2308                             // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2309                             // Let the View keeps it's padding.  Still store Padding in Layout to reduce code paths.
2310                             if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2311                             {
2312                                 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2313                                 NotifyPropertyChanged();
2314                             }
2315                         }
2316                     }
2317                 }
2318
2319                 // Remove existing layout from it's parent layout group.
2320                 layout?.Unparent();
2321
2322                 value.SetPositionByLayout = !excludeLayouting;
2323
2324                 // Set layout to this view
2325                 SetLayout(value);
2326             }
2327         }
2328
2329         /// <summary>
2330         /// The weight of the View, used to share available space in a layout with siblings.
2331         /// </summary>
2332         /// <since_tizen> 6 </since_tizen>
2333         public float Weight
2334         {
2335             get
2336             {
2337                 return weight;
2338             }
2339             set
2340             {
2341                 weight = value;
2342                 layout?.RequestLayout();
2343             }
2344         }
2345
2346         /// <summary>
2347         ///  Whether to load the BackgroundImage synchronously.
2348         ///  If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2349         ///  Note: For Normal Quad images only.
2350         /// </summary>
2351         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2352         [EditorBrowsable(EditorBrowsableState.Never)]
2353         public bool BackgroundImageSynchronosLoading
2354         {
2355             get
2356             {
2357                 return backgroundImageSynchronosLoading;
2358             }
2359             set
2360             {
2361                 backgroundImageSynchronosLoading = value;
2362
2363                 string bgUrl = null;
2364                 var pValue = Background.Find(ImageVisualProperty.URL);
2365                 pValue?.Get(out bgUrl);
2366                 pValue?.Dispose();
2367
2368                 if (!string.IsNullOrEmpty(bgUrl))
2369                 {
2370                     PropertyMap bgMap = this.Background;
2371                     var temp = new PropertyValue(backgroundImageSynchronosLoading);
2372                     bgMap.Add("synchronousLoading", temp);
2373                     temp.Dispose();
2374                     Background = bgMap;
2375                 }
2376             }
2377         }
2378
2379         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2380         [EditorBrowsable(EditorBrowsableState.Never)]
2381         public Vector2 UpdateSizeHint
2382         {
2383             get
2384             {
2385                 return (Vector2)GetValue(UpdateSizeHintProperty);
2386             }
2387             set
2388             {
2389                 SetValue(UpdateSizeHintProperty, value);
2390                 NotifyPropertyChanged();
2391             }
2392         }
2393
2394         /// <summary>
2395         /// Enable/Disable ControlState propagation for children.
2396         /// It is false by default.
2397         /// If the View needs to share ControlState with descendants, please set it true.
2398         /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2399         /// </summary>
2400         [EditorBrowsable(EditorBrowsableState.Never)]
2401         public bool EnableControlStatePropagation
2402         {
2403             get => controlStatePropagation;
2404             set
2405             {
2406                 controlStatePropagation = value;
2407
2408                 foreach (View child in Children)
2409                 {
2410                     child.EnableControlStatePropagation = value;
2411                 }
2412             }
2413         }
2414
2415         /// <summary>
2416         /// By default, it is false in View, true in Control.
2417         /// Note that if the value is true, the View will be a touch receptor.
2418         /// </summary>
2419         [EditorBrowsable(EditorBrowsableState.Never)]
2420         public bool EnableControlState
2421         {
2422             get
2423             {
2424                 return (bool)GetValue(EnableControlStateProperty);
2425             }
2426             set
2427             {
2428                 SetValue(EnableControlStateProperty, value);
2429             }
2430         }
2431
2432         /// <summary>
2433         /// Whether the actor grab all touches even if touch leaves its boundary.
2434         /// </summary>
2435         /// <returns>true, if it grab all touch after start</returns>
2436         [EditorBrowsable(EditorBrowsableState.Never)]
2437         public bool GrabTouchAfterLeave
2438         {
2439             get
2440             {
2441                 bool temp = false;
2442                 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2443                 pValue.Get(out temp);
2444                 pValue.Dispose();
2445                 return temp;
2446             }
2447             set
2448             {
2449                 var temp = new Tizen.NUI.PropertyValue(value);
2450                 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2451                 temp.Dispose();
2452                 NotifyPropertyChanged();
2453             }
2454         }
2455
2456         /// <summary>
2457         /// Determines which blend equation will be used to render renderers of this actor.
2458         /// </summary>
2459         /// <returns>blend equation enum currently assigned</returns>
2460         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2461         [EditorBrowsable(EditorBrowsableState.Never)]
2462         public BlendEquationType BlendEquation
2463         {
2464             get
2465             {
2466                 int temp = 0;
2467                 var pValue = GetProperty(View.Property.BlendEquation);
2468                 pValue.Get(out temp);
2469                 pValue.Dispose();
2470                 return (BlendEquationType)temp;
2471             }
2472             set
2473             {
2474                 var temp = new Tizen.NUI.PropertyValue((int)value);
2475                 SetProperty(View.Property.BlendEquation, temp);
2476                 temp.Dispose();
2477                 NotifyPropertyChanged();
2478             }
2479         }
2480
2481         /// <summary>
2482         /// If the value is true, the View will change its style as the theme changes.
2483         /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2484         /// </summary>
2485         /// <since_tizen> 9 </since_tizen>
2486         public bool ThemeChangeSensitive
2487         {
2488             get => (bool)GetValue(ThemeChangeSensitiveProperty);
2489             set => SetValue(ThemeChangeSensitiveProperty, value);
2490         }
2491
2492         /// <summary>
2493         /// Create Style, it is abstract function and must be override.
2494         /// </summary>
2495         [EditorBrowsable(EditorBrowsableState.Never)]
2496         protected virtual ViewStyle CreateViewStyle()
2497         {
2498             return new ViewStyle();
2499         }
2500
2501         /// <summary>
2502         /// Called after the View's ControlStates changed.
2503         /// </summary>
2504         /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2505         [EditorBrowsable(EditorBrowsableState.Never)]
2506         protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2507         {
2508         }
2509
2510         /// <summary>
2511         /// </summary>
2512         [EditorBrowsable(EditorBrowsableState.Never)]
2513         protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2514         {
2515             UpdateStyle();
2516         }
2517
2518         /// <summary>
2519         /// Apply style instance to the view.
2520         /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2521         /// </summary>
2522         /// <since_tizen> 9 </since_tizen>
2523         public virtual void ApplyStyle(ViewStyle viewStyle)
2524         {
2525             if (viewStyle == null || this.viewStyle == viewStyle) return;
2526
2527             this.viewStyle = viewStyle;
2528
2529             if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2530             {
2531                 // Nothing to apply
2532                 return;
2533             }
2534
2535             BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2536
2537             if (bindablePropertyOfView == null)
2538             {
2539                 return;
2540             }
2541
2542             var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2543             viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2544
2545             foreach (var sourceProperty in dirtyStyleProperties)
2546             {
2547                 var sourceValue = viewStyle.GetValue(sourceProperty);
2548
2549                 if (sourceValue == null)
2550                 {
2551                     continue;
2552                 }
2553
2554                 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2555
2556                 if (destinationProperty != null)
2557                 {
2558                     SetValue(destinationProperty, sourceValue);
2559                 }
2560             }
2561         }
2562
2563         /// <summary>
2564         /// Get whether the View is culled or not.
2565         /// True means that the View is out of the view frustum.
2566         /// </summary>
2567         /// <remarks>
2568         /// Hidden-API (Inhouse-API).
2569         /// </remarks>
2570         [EditorBrowsable(EditorBrowsableState.Never)]
2571         public bool Culled
2572         {
2573             get
2574             {
2575                 bool temp = false;
2576                 var pValue = GetProperty(View.Property.Culled);
2577                 pValue.Get(out temp);
2578                 pValue.Dispose();
2579                 return temp;
2580             }
2581         }
2582
2583         /// <summary>
2584         /// Set or Get TransitionOptions for the page transition.
2585         /// This property is used to define how this view will be transitioned during Page switching.
2586         /// </summary>
2587         /// <since_tizen> 9 </since_tizen>
2588         public TransitionOptions TransitionOptions
2589         {
2590             set
2591             {
2592                 transitionOptions = value;
2593             }
2594             get
2595             {
2596                 return transitionOptions;
2597             }
2598         }
2599     }
2600 }