[NUI] Open NUI.ThemeManager and related APIs (#2865)
[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         // Accessibility
468         //
469
470         [EditorBrowsable(EditorBrowsableState.Never)]
471         protected bool IsHighlighted
472         {
473             get
474             {
475                 using (View view = Accessibility.Accessibility.Instance.GetCurrentlyHighlightedView())
476                 {
477                     return view == this;
478                 }
479             }
480         }
481
482         [EditorBrowsable(EditorBrowsableState.Never)]
483         protected static readonly string AccessibilityActivateAction = "activate";
484         [EditorBrowsable(EditorBrowsableState.Never)]
485         protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
486         [EditorBrowsable(EditorBrowsableState.Never)]
487         protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
488         [EditorBrowsable(EditorBrowsableState.Never)]
489         protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
490         [EditorBrowsable(EditorBrowsableState.Never)]
491         protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
492         [EditorBrowsable(EditorBrowsableState.Never)]
493         protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
494
495         [EditorBrowsable(EditorBrowsableState.Never)]
496         private static readonly string[] AccessibilityActions = {
497             AccessibilityActivateAction,
498             AccessibilityReadingSkippedAction,
499             AccessibilityReadingCancelledAction,
500             AccessibilityReadingStoppedAction,
501             AccessibilityReadingPausedAction,
502             AccessibilityReadingResumedAction,
503         };
504
505         [EditorBrowsable(EditorBrowsableState.Never)]
506         protected virtual string AccessibilityGetName()
507         {
508             return "";
509         }
510
511         [EditorBrowsable(EditorBrowsableState.Never)]
512         protected virtual string AccessibilityGetDescription()
513         {
514             return "";
515         }
516
517         [EditorBrowsable(EditorBrowsableState.Never)]
518         protected virtual bool AccessibilityDoAction(string name)
519         {
520             return false;
521         }
522
523         [EditorBrowsable(EditorBrowsableState.Never)]
524         protected virtual AccessibilityStates AccessibilityCalculateStates()
525         {
526             var states = new AccessibilityStates();
527             states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
528             states.Set(AccessibilityState.Focusable, this.Focusable);
529             states.Set(AccessibilityState.Focused, this.State == States.Focused);
530             states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
531             states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
532             states.Set(AccessibilityState.Sensitive, this.Sensitive);
533             states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
534             states.Set(AccessibilityState.Visible, true);
535             states.Set(AccessibilityState.Showing, this.Visibility);
536             states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
537             return states;
538         }
539
540         [EditorBrowsable(EditorBrowsableState.Never)]
541         protected virtual int AccessibilityGetActionCount()
542         {
543             return AccessibilityActions.Length;
544         }
545
546         [EditorBrowsable(EditorBrowsableState.Never)]
547         protected virtual string AccessibilityGetActionName(int index)
548         {
549             if (index >= 0 && index < AccessibilityActions.Length)
550                 return AccessibilityActions[index];
551             else
552                 return "";
553         }
554
555         [EditorBrowsable(EditorBrowsableState.Never)]
556         protected virtual bool AccessibilityShouldReportZeroChildren()
557         {
558             return false;
559         }
560
561         [EditorBrowsable(EditorBrowsableState.Never)]
562         protected virtual double AccessibilityGetMinimum()
563         {
564             return 0.0;
565         }
566
567         [EditorBrowsable(EditorBrowsableState.Never)]
568         protected virtual double AccessibilityGetCurrent()
569         {
570             return 0.0;
571         }
572
573         [EditorBrowsable(EditorBrowsableState.Never)]
574         protected virtual double AccessibilityGetMaximum()
575         {
576             return 0.0;
577         }
578
579         [EditorBrowsable(EditorBrowsableState.Never)]
580         protected virtual bool AccessibilitySetCurrent(double value)
581         {
582             return false;
583         }
584
585         [EditorBrowsable(EditorBrowsableState.Never)]
586         protected virtual double AccessibilityGetMinimumIncrement()
587         {
588             return 0.0;
589         }
590
591         [EditorBrowsable(EditorBrowsableState.Never)]
592         protected virtual bool AccessibilityIsScrollable()
593         {
594             return false;
595         }
596
597         [EditorBrowsable(EditorBrowsableState.Never)]
598         protected virtual string AccessibilityGetText(int startOffset, int endOffset)
599         {
600             return "";
601         }
602
603         [EditorBrowsable(EditorBrowsableState.Never)]
604         protected virtual int AccessibilityGetCharacterCount()
605         {
606             return 0;
607         }
608
609         [EditorBrowsable(EditorBrowsableState.Never)]
610         protected virtual int AccessibilityGetCaretOffset()
611         {
612             return 0;
613         }
614
615         [EditorBrowsable(EditorBrowsableState.Never)]
616         protected virtual bool AccessibilitySetCaretOffset(int offset)
617         {
618             return false;
619         }
620
621         [EditorBrowsable(EditorBrowsableState.Never)]
622         protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
623         {
624             return new AccessibilityRange();
625         }
626
627         [EditorBrowsable(EditorBrowsableState.Never)]
628         protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
629         {
630             return new AccessibilityRange();
631         }
632
633         [EditorBrowsable(EditorBrowsableState.Never)]
634         protected virtual bool AccessibilityRemoveSelection(int selectionNum)
635         {
636             return false;
637         }
638
639         [EditorBrowsable(EditorBrowsableState.Never)]
640         protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
641         {
642             return false;
643         }
644
645         [EditorBrowsable(EditorBrowsableState.Never)]
646         protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
647         {
648             return false;
649         }
650
651         [EditorBrowsable(EditorBrowsableState.Never)]
652         protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
653         {
654             return false;
655         }
656
657         /// <summary>
658         /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
659         /// It is absolute by default.
660         /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
661         /// </summary>
662         /// <since_tizen> 9 </since_tizen>
663         public VisualTransformPolicyType CornerRadiusPolicy
664         {
665             get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
666             set => SetValue(CornerRadiusPolicyProperty, value);
667         }
668
669         /// <summary>
670         /// The current state of the view.
671         /// </summary>
672         /// <since_tizen> 3 </since_tizen>
673         public States State
674         {
675             get
676             {
677                 return (States)GetValue(StateProperty);
678             }
679             set
680             {
681                 SetValue(StateProperty, value);
682                 NotifyPropertyChanged();
683             }
684         }
685
686         /// <summary>
687         /// The current sub state of the view.
688         /// </summary>
689         /// <since_tizen> 3 </since_tizen>
690         public States SubState
691         {
692             get
693             {
694                 return (States)GetValue(SubStateProperty);
695             }
696             set
697             {
698                 SetValue(SubStateProperty, value);
699                 NotifyPropertyChanged();
700             }
701         }
702
703         /// <summary>
704         /// Displays a tooltip
705         /// </summary>
706         /// <since_tizen> 3 </since_tizen>
707         public Tizen.NUI.PropertyMap Tooltip
708         {
709             get
710             {
711                 return (PropertyMap)GetValue(TooltipProperty);
712             }
713             set
714             {
715                 SetValue(TooltipProperty, value);
716                 NotifyPropertyChanged();
717             }
718         }
719
720         /// <summary>
721         /// Displays a tooltip as a text.
722         /// </summary>
723         /// <since_tizen> 3 </since_tizen>
724         public string TooltipText
725         {
726             get
727             {
728                 using (var propertyValue = GetProperty(Property.TOOLTIP))
729                 {
730                     if (propertyValue != null && propertyValue.Get(out string retrivedValue))
731                     {
732                         return retrivedValue;
733                     }
734                     NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
735                     return "error to get TooltipText";
736                 }
737             }
738             set
739             {
740                 var temp = new Tizen.NUI.PropertyValue(value);
741                 SetProperty(View.Property.TOOLTIP, temp);
742                 temp.Dispose();
743                 NotifyPropertyChanged();
744             }
745         }
746
747         /// <summary>
748         /// The Child property of FlexContainer.<br />
749         /// The proportion of the free space in the container, the flex item will receive.<br />
750         /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
751         /// </summary>
752         /// <since_tizen> 3 </since_tizen>
753         [Obsolete("Deprecated in API8, will be removed in API10.")]
754         public float Flex
755         {
756             get
757             {
758                 return (float)GetValue(FlexProperty);
759             }
760             set
761             {
762                 SetValue(FlexProperty, value);
763                 NotifyPropertyChanged();
764             }
765         }
766
767         /// <summary>
768         /// The Child property of FlexContainer.<br />
769         /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
770         /// </summary>
771         /// <since_tizen> 3 </since_tizen>
772         [Obsolete("Deprecated in API8, will be removed in API10.")]
773         public int AlignSelf
774         {
775             get
776             {
777                 return (int)GetValue(AlignSelfProperty);
778             }
779             set
780             {
781                 SetValue(AlignSelfProperty, value);
782                 NotifyPropertyChanged();
783             }
784         }
785
786         /// <summary>
787         /// The Child property of FlexContainer.<br />
788         /// The space around the flex item.<br />
789         /// </summary>
790         /// <remarks>
791         /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
792         /// </remarks>
793         /// <since_tizen> 3 </since_tizen>
794         [Obsolete("Deprecated in API8, will be removed in API10.")]
795         public Vector4 FlexMargin
796         {
797             get
798             {
799                 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
800                 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
801             }
802             set
803             {
804                 SetValue(FlexMarginProperty, value);
805                 NotifyPropertyChanged();
806             }
807         }
808
809         /// <summary>
810         /// The top-left cell this child occupies, if not set, the first available cell is used.
811         /// </summary>
812         /// <remarks>
813         /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
814         /// </remarks>
815         /// <since_tizen> 3 </since_tizen>
816         public Vector2 CellIndex
817         {
818             get
819             {
820                 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
821                 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
822             }
823             set
824             {
825                 SetValue(CellIndexProperty, value);
826                 NotifyPropertyChanged();
827             }
828         }
829
830         /// <summary>
831         /// The number of rows this child occupies, if not set, the default value is 1.
832         /// </summary>
833         /// <since_tizen> 3 </since_tizen>
834         public float RowSpan
835         {
836             get
837             {
838                 return (float)GetValue(RowSpanProperty);
839             }
840             set
841             {
842                 SetValue(RowSpanProperty, value);
843                 NotifyPropertyChanged();
844             }
845         }
846
847         /// <summary>
848         /// The number of columns this child occupies, if not set, the default value is 1.
849         /// </summary>
850         /// <since_tizen> 3 </since_tizen>
851         public float ColumnSpan
852         {
853             get
854             {
855                 return (float)GetValue(ColumnSpanProperty);
856             }
857             set
858             {
859                 SetValue(ColumnSpanProperty, value);
860                 NotifyPropertyChanged();
861             }
862         }
863
864         /// <summary>
865         /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
866         /// </summary>
867         /// <since_tizen> 3 </since_tizen>
868         public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
869         {
870             get
871             {
872                 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
873             }
874             set
875             {
876                 SetValue(CellHorizontalAlignmentProperty, value);
877                 NotifyPropertyChanged();
878             }
879         }
880
881         /// <summary>
882         /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
883         /// </summary>
884         /// <since_tizen> 3 </since_tizen>
885         public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
886         {
887             get
888             {
889                 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
890             }
891             set
892             {
893                 SetValue(CellVerticalAlignmentProperty, value);
894                 NotifyPropertyChanged();
895             }
896         }
897
898         /// <summary>
899         /// The left focusable view.<br />
900         /// This will return null if not set.<br />
901         /// This will also return null if the specified left focusable view is not on a window.<br />
902         /// </summary>
903         /// <since_tizen> 3 </since_tizen>
904         public View LeftFocusableView
905         {
906             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
907             get
908             {
909                 return (View)GetValue(LeftFocusableViewProperty);
910             }
911             set
912             {
913                 SetValue(LeftFocusableViewProperty, value);
914                 NotifyPropertyChanged();
915             }
916         }
917
918         /// <summary>
919         /// The right focusable view.<br />
920         /// This will return null if not set.<br />
921         /// This will also return null if the specified right focusable view is not on a window.<br />
922         /// </summary>
923         /// <since_tizen> 3 </since_tizen>
924         public View RightFocusableView
925         {
926             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
927             get
928             {
929                 return (View)GetValue(RightFocusableViewProperty);
930             }
931             set
932             {
933                 SetValue(RightFocusableViewProperty, value);
934                 NotifyPropertyChanged();
935             }
936         }
937
938         /// <summary>
939         /// The up focusable view.<br />
940         /// This will return null if not set.<br />
941         /// This will also return null if the specified up focusable view is not on a window.<br />
942         /// </summary>
943         /// <since_tizen> 3 </since_tizen>
944         public View UpFocusableView
945         {
946             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
947             get
948             {
949                 return (View)GetValue(UpFocusableViewProperty);
950             }
951             set
952             {
953                 SetValue(UpFocusableViewProperty, value);
954                 NotifyPropertyChanged();
955             }
956         }
957
958         /// <summary>
959         /// The down focusable view.<br />
960         /// This will return null if not set.<br />
961         /// This will also return null if the specified down focusable view is not on a window.<br />
962         /// </summary>
963         /// <since_tizen> 3 </since_tizen>
964         public View DownFocusableView
965         {
966             // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
967             get
968             {
969                 return (View)GetValue(DownFocusableViewProperty);
970             }
971             set
972             {
973                 SetValue(DownFocusableViewProperty, value);
974                 NotifyPropertyChanged();
975             }
976         }
977
978         /// <summary>
979         /// Whether the view should be focusable by keyboard navigation.
980         /// </summary>
981         /// <since_tizen> 3 </since_tizen>
982         public bool Focusable
983         {
984             set
985             {
986                 SetValue(FocusableProperty, value);
987                 NotifyPropertyChanged();
988             }
989             get
990             {
991                 return (bool)GetValue(FocusableProperty);
992             }
993         }
994
995         /// <summary>
996         ///  Retrieves the position of the view.<br />
997         ///  The coordinates are relative to the view's parent.<br />
998         /// </summary>
999         /// <since_tizen> 3 </since_tizen>
1000         public Position CurrentPosition
1001         {
1002             get
1003             {
1004                 return GetCurrentPosition();
1005             }
1006         }
1007
1008         /// <summary>
1009         /// Sets the size of a view for the width and the height.<br />
1010         /// Geometry can be scaled to fit within this area.<br />
1011         /// This does not interfere with the view's scale factor.<br />
1012         /// The views default depth is the minimum of width and height.<br />
1013         /// </summary>
1014         /// <remarks>
1015         /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1016         /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1017         /// </remarks>
1018         /// <since_tizen> 3 </since_tizen>
1019         public Size2D Size2D
1020         {
1021             get
1022             {
1023                 Size2D temp = (Size2D)GetValue(Size2DProperty);
1024                 int width = temp.Width;
1025                 int height = temp.Height;
1026
1027                 if (this.Layout == null)
1028                 {
1029                     if (width < 0) { width = 0; }
1030                     if (height < 0) { height = 0; }
1031                 }
1032
1033                 return new Size2D(OnSize2DChanged, width, height);
1034             }
1035             set
1036             {
1037                 SetValue(Size2DProperty, value);
1038
1039                 NotifyPropertyChanged();
1040             }
1041         }
1042
1043         /// <summary>
1044         ///  Retrieves the size of the view.<br />
1045         ///  The coordinates are relative to the view's parent.<br />
1046         /// </summary>
1047         /// <since_tizen> 3 </since_tizen>
1048         public Size2D CurrentSize
1049         {
1050             get
1051             {
1052                 return GetCurrentSize();
1053             }
1054         }
1055
1056         /// <summary>
1057         /// Retrieves and sets the view's opacity.<br />
1058         /// </summary>
1059         /// <since_tizen> 3 </since_tizen>
1060         public float Opacity
1061         {
1062             get
1063             {
1064                 return (float)GetValue(OpacityProperty);
1065             }
1066             set
1067             {
1068                 SetValue(OpacityProperty, value);
1069                 NotifyPropertyChanged();
1070             }
1071         }
1072
1073         /// <summary>
1074         /// Sets the position of the view for X and Y.<br />
1075         /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1076         /// If the position inheritance is disabled, sets the world position.<br />
1077         /// </summary>
1078         /// <remarks>
1079         /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1080         /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1081         /// </remarks>
1082         /// <since_tizen> 3 </since_tizen>
1083         public Position2D Position2D
1084         {
1085             get
1086             {
1087                 Position2D temp = (Position2D)GetValue(Position2DProperty);
1088                 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1089             }
1090             set
1091             {
1092                 SetValue(Position2DProperty, value);
1093                 NotifyPropertyChanged();
1094             }
1095         }
1096
1097         /// <summary>
1098         /// Retrieves the screen position of the view.<br />
1099         /// </summary>
1100         /// <since_tizen> 3 </since_tizen>
1101         public Vector2 ScreenPosition
1102         {
1103             get
1104             {
1105                 Vector2 temp = new Vector2(0.0f, 0.0f);
1106                 var pValue = GetProperty(View.Property.ScreenPosition);
1107                 pValue.Get(temp);
1108                 pValue.Dispose();
1109                 return temp;
1110             }
1111         }
1112
1113         /// <summary>
1114         /// Determines whether the pivot point should be used to determine the position of the view.
1115         /// This is false by default.
1116         /// </summary>
1117         /// <remarks>If false, then the top-left of the view is used for the position.
1118         /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1119         /// </remarks>
1120         /// <since_tizen> 3 </since_tizen>
1121         public bool PositionUsesPivotPoint
1122         {
1123             get
1124             {
1125                 return (bool)GetValue(PositionUsesPivotPointProperty);
1126             }
1127             set
1128             {
1129                 SetValue(PositionUsesPivotPointProperty, value);
1130                 NotifyPropertyChanged();
1131             }
1132         }
1133
1134         /// <summary>
1135         /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1136         /// </summary>
1137         /// <since_tizen> 3 </since_tizen>
1138         [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1139             "Like: " +
1140             "View view = new View(); " +
1141             "view.PivotPoint = PivotPoint.Center; " +
1142             "view.PositionUsesPivotPoint = true;" +
1143             " Deprecated in API5: Will be removed in API8")]
1144         [EditorBrowsable(EditorBrowsableState.Never)]
1145         public bool PositionUsesAnchorPoint
1146         {
1147             get
1148             {
1149                 bool temp = false;
1150                 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1151                 pValue.Get(out temp);
1152                 pValue.Dispose();
1153                 return temp;
1154             }
1155             set
1156             {
1157                 var temp = new Tizen.NUI.PropertyValue(value);
1158                 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1159                 temp.Dispose();
1160                 NotifyPropertyChanged();
1161             }
1162         }
1163
1164         /// <summary>
1165         /// Queries whether the view is connected to the stage.<br />
1166         /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1167         /// </summary>
1168         /// <since_tizen> 3 </since_tizen>
1169         public bool IsOnWindow
1170         {
1171             get
1172             {
1173                 return OnWindow();
1174             }
1175         }
1176
1177         /// <summary>
1178         /// Gets the depth in the hierarchy for the view.
1179         /// </summary>
1180         /// <since_tizen> 3 </since_tizen>
1181         public int HierarchyDepth
1182         {
1183             get
1184             {
1185                 return GetHierarchyDepth();
1186             }
1187         }
1188
1189         /// <summary>
1190         /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1191         /// </summary>
1192         /// <remarks>
1193         /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1194         /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1195         /// The values set by this property will likely change.
1196         /// </remarks>
1197         /// <since_tizen> 3 </since_tizen>
1198         public int SiblingOrder
1199         {
1200             get
1201             {
1202                 return (int)GetValue(SiblingOrderProperty);
1203             }
1204             set
1205             {
1206                 SetValue(SiblingOrderProperty, value);
1207
1208                 LayoutGroup layout = Layout as LayoutGroup;
1209                 layout?.ChangeLayoutSiblingOrder(value);
1210
1211                 NotifyPropertyChanged();
1212             }
1213         }
1214
1215         /// <summary>
1216         /// Returns the natural size of the view.
1217         /// </summary>
1218         /// <remarks>
1219         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1220         /// </remarks>
1221         /// <since_tizen> 5 </since_tizen>
1222         public Vector3 NaturalSize
1223         {
1224             get
1225             {
1226                 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1227                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1228                 return ret;
1229             }
1230         }
1231
1232         /// <summary>
1233         /// Returns the natural size (Size2D) of the view.
1234         /// </summary>
1235         /// <remarks>
1236         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1237         /// </remarks>
1238         /// <since_tizen> 4 </since_tizen>
1239         public Size2D NaturalSize2D
1240         {
1241             get
1242             {
1243                 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1244                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1245
1246                 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1247                 temp.Dispose();
1248                 return sz;
1249             }
1250         }
1251
1252         /// <summary>
1253         /// Gets or sets the origin of a view within its parent's area.<br />
1254         /// 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 />
1255         /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1256         /// A view's position is the distance between this origin and the view's anchor-point.<br />
1257         /// </summary>
1258         /// <pre>The view has been initialized.</pre>
1259         /// <since_tizen> 3 </since_tizen>
1260         public Position ParentOrigin
1261         {
1262             get
1263             {
1264                 Position tmp = (Position)GetValue(ParentOriginProperty);
1265                 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1266             }
1267             set
1268             {
1269                 SetValue(ParentOriginProperty, value);
1270                 NotifyPropertyChanged();
1271             }
1272         }
1273
1274         /// <summary>
1275         /// Gets or sets the anchor-point of a view.<br />
1276         /// 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 />
1277         /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1278         /// A view position is the distance between its parent-origin and this anchor-point.<br />
1279         /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1280         /// <pre>The view has been initialized.</pre>
1281         /// </summary>
1282         /// <remarks>
1283         /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1284         /// </remarks>
1285         /// <since_tizen> 3 </since_tizen>
1286         public Position PivotPoint
1287         {
1288             get
1289             {
1290                 Position tmp = (Position)GetValue(PivotPointProperty);
1291                 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1292             }
1293             set
1294             {
1295                 SetValue(PivotPointProperty, value);
1296                 NotifyPropertyChanged();
1297             }
1298         }
1299
1300         /// <summary>
1301         /// Gets or sets the size width of the view.
1302         /// </summary>
1303         /// <remarks>
1304         /// <para>
1305         /// Animatable - This property can be animated using <c>Animation</c> class.
1306         /// </para>
1307         /// </remarks>
1308         /// <since_tizen> 3 </since_tizen>
1309         public float SizeWidth
1310         {
1311             get
1312             {
1313                 return (float)GetValue(SizeWidthProperty);
1314             }
1315             set
1316             {
1317                 SetValue(SizeWidthProperty, value);
1318                 NotifyPropertyChanged();
1319             }
1320         }
1321
1322         /// <summary>
1323         /// Gets or sets the size height of the view.
1324         /// </summary>
1325         /// <remarks>
1326         /// <para>
1327         /// Animatable - This property can be animated using <c>Animation</c> class.
1328         /// </para>
1329         /// </remarks>
1330         /// <since_tizen> 3 </since_tizen>
1331         public float SizeHeight
1332         {
1333             get
1334             {
1335                 return (float)GetValue(SizeHeightProperty);
1336             }
1337             set
1338             {
1339                 SetValue(SizeHeightProperty, value);
1340                 NotifyPropertyChanged();
1341             }
1342         }
1343
1344         /// <summary>
1345         /// Gets or sets the position of the view.<br />
1346         /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1347         /// If the position inheritance is disabled, sets the world position.<br />
1348         /// </summary>
1349         /// <remarks>
1350         /// <para>
1351         /// Animatable - This property can be animated using <c>Animation</c> class.
1352         /// </para>
1353         /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1354         /// </remarks>
1355         /// <since_tizen> 3 </since_tizen>
1356         public Position Position
1357         {
1358             get
1359             {
1360                 Position tmp = (Position)GetValue(PositionProperty);
1361                 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1362             }
1363             set
1364             {
1365                 SetValue(PositionProperty, value);
1366                 NotifyPropertyChanged();
1367             }
1368         }
1369
1370         /// <summary>
1371         /// Gets or sets the position X of the view.
1372         /// </summary>
1373         /// <remarks>
1374         /// <para>
1375         /// Animatable - This property can be animated using <c>Animation</c> class.
1376         /// </para>
1377         /// </remarks>
1378         /// <since_tizen> 3 </since_tizen>
1379         public float PositionX
1380         {
1381             get
1382             {
1383                 return (float)GetValue(PositionXProperty);
1384             }
1385             set
1386             {
1387                 SetValue(PositionXProperty, value);
1388                 NotifyPropertyChanged();
1389             }
1390         }
1391
1392         /// <summary>
1393         /// Gets or sets the position Y of the view.
1394         /// </summary>
1395         /// <remarks>
1396         /// <para>
1397         /// Animatable - This property can be animated using <c>Animation</c> class.
1398         /// </para>
1399         /// </remarks>
1400         /// <since_tizen> 3 </since_tizen>
1401         public float PositionY
1402         {
1403             get
1404             {
1405                 return (float)GetValue(PositionYProperty);
1406             }
1407             set
1408             {
1409                 SetValue(PositionYProperty, value);
1410                 NotifyPropertyChanged();
1411             }
1412         }
1413
1414         /// <summary>
1415         /// Gets or sets the position Z of the view.
1416         /// </summary>
1417         /// <remarks>
1418         /// <para>
1419         /// Animatable - This property can be animated using <c>Animation</c> class.
1420         /// </para>
1421         /// </remarks>
1422         /// <since_tizen> 3 </since_tizen>
1423         public float PositionZ
1424         {
1425             get
1426             {
1427                 return (float)GetValue(PositionZProperty);
1428             }
1429             set
1430             {
1431                 SetValue(PositionZProperty, value);
1432                 NotifyPropertyChanged();
1433             }
1434         }
1435
1436         /// <summary>
1437         /// Gets or sets the world position of the view.
1438         /// </summary>
1439         /// <since_tizen> 3 </since_tizen>
1440         public Vector3 WorldPosition
1441         {
1442             get
1443             {
1444                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1445                 var pValue = GetProperty(View.Property.WorldPosition);
1446                 pValue.Get(temp);
1447                 pValue.Dispose();
1448                 return temp;
1449             }
1450         }
1451
1452         /// <summary>
1453         /// Gets or sets the orientation of the view.<br />
1454         /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1455         /// </summary>
1456         /// <remarks>
1457         /// <para>
1458         /// This is an asynchronous method.
1459         /// </para>
1460         /// <para>
1461         /// Animatable - This property can be animated using <c>Animation</c> class.
1462         /// </para>
1463         /// </remarks>
1464         /// <since_tizen> 3 </since_tizen>
1465         public Rotation Orientation
1466         {
1467             get
1468             {
1469                 return (Rotation)GetValue(OrientationProperty);
1470             }
1471             set
1472             {
1473                 SetValue(OrientationProperty, value);
1474                 NotifyPropertyChanged();
1475             }
1476         }
1477
1478         /// <summary>
1479         /// Gets or sets the world orientation of the view.<br />
1480         /// </summary>
1481         /// <since_tizen> 3 </since_tizen>
1482         public Rotation WorldOrientation
1483         {
1484             get
1485             {
1486                 Rotation temp = new Rotation();
1487                 var pValue = GetProperty(View.Property.WorldOrientation);
1488                 pValue.Get(temp);
1489                 pValue.Dispose();
1490                 return temp;
1491             }
1492         }
1493
1494         /// <summary>
1495         /// Gets or sets the scale factor applied to the view.<br />
1496         /// </summary>
1497         /// <remarks>
1498         /// <para>
1499         /// Animatable - This property can be animated using <c>Animation</c> class.
1500         /// </para>
1501         /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1502         /// </remarks>
1503         /// <since_tizen> 3 </since_tizen>
1504         public Vector3 Scale
1505         {
1506             get
1507             {
1508                 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1509                 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1510             }
1511             set
1512             {
1513                 SetValue(ScaleProperty, value);
1514                 NotifyPropertyChanged();
1515             }
1516         }
1517
1518         /// <summary>
1519         /// Gets or sets the scale X factor applied to the view.
1520         /// </summary>
1521         /// <remarks>
1522         /// <para>
1523         /// Animatable - This property can be animated using <c>Animation</c> class.
1524         /// </para>
1525         /// </remarks>
1526         /// <since_tizen> 3 </since_tizen>
1527         public float ScaleX
1528         {
1529             get
1530             {
1531                 return (float)GetValue(ScaleXProperty);
1532             }
1533             set
1534             {
1535                 SetValue(ScaleXProperty, value);
1536                 NotifyPropertyChanged();
1537             }
1538         }
1539
1540         /// <summary>
1541         /// Gets or sets the scale Y factor applied to the view.
1542         /// </summary>
1543         /// <remarks>
1544         /// <para>
1545         /// Animatable - This property can be animated using <c>Animation</c> class.
1546         /// </para>
1547         /// </remarks>
1548         /// <since_tizen> 3 </since_tizen>
1549         public float ScaleY
1550         {
1551             get
1552             {
1553                 return (float)GetValue(ScaleYProperty);
1554             }
1555             set
1556             {
1557                 SetValue(ScaleYProperty, value);
1558                 NotifyPropertyChanged();
1559             }
1560         }
1561
1562         /// <summary>
1563         /// Gets or sets the scale Z factor applied to the view.
1564         /// </summary>
1565         /// <remarks>
1566         /// <para>
1567         /// Animatable - This property can be animated using <c>Animation</c> class.
1568         /// </para>
1569         /// </remarks>
1570         /// <since_tizen> 3 </since_tizen>
1571         public float ScaleZ
1572         {
1573             get
1574             {
1575                 return (float)GetValue(ScaleZProperty);
1576             }
1577             set
1578             {
1579                 SetValue(ScaleZProperty, value);
1580                 NotifyPropertyChanged();
1581             }
1582         }
1583
1584         /// <summary>
1585         /// Gets the world scale of the view.
1586         /// </summary>
1587         /// <since_tizen> 3 </since_tizen>
1588         public Vector3 WorldScale
1589         {
1590             get
1591             {
1592                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1593                 var pValue = GetProperty(View.Property.WorldScale);
1594                 pValue.Get(temp);
1595                 pValue.Dispose();
1596                 return temp;
1597             }
1598         }
1599
1600         /// <summary>
1601         /// Retrieves the visibility flag of the view.
1602         /// </summary>
1603         /// <remarks>
1604         /// <para>
1605         /// If the view is not visible, then the view and its children will not be rendered.
1606         /// 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.
1607         /// </para>
1608         /// <para>
1609         /// Animatable - This property can be animated using <c>Animation</c> class.
1610         /// </para>
1611         /// </remarks>
1612         /// <since_tizen> 3 </since_tizen>
1613         public bool Visibility
1614         {
1615             get
1616             {
1617                 bool temp = false;
1618                 var pValue = GetProperty(View.Property.VISIBLE);
1619                 pValue.Get(out temp);
1620                 pValue.Dispose();
1621                 return temp;
1622             }
1623         }
1624
1625         /// <summary>
1626         /// Gets the view's world color.
1627         /// </summary>
1628         /// <since_tizen> 3 </since_tizen>
1629         public Vector4 WorldColor
1630         {
1631             get
1632             {
1633                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1634                 var pValue = GetProperty(View.Property.WorldColor);
1635                 pValue.Get(temp);
1636                 pValue.Dispose();
1637                 return temp;
1638             }
1639         }
1640
1641         /// <summary>
1642         /// Gets or sets the view's name.
1643         /// </summary>
1644         /// <since_tizen> 3 </since_tizen>
1645         public string Name
1646         {
1647             get
1648             {
1649                 return (string)GetValue(NameProperty);
1650             }
1651             set
1652             {
1653                 SetValue(NameProperty, value);
1654                 NotifyPropertyChanged();
1655             }
1656         }
1657
1658         /// <summary>
1659         /// Get the number of children held by the view.
1660         /// </summary>
1661         /// <since_tizen> 3 </since_tizen>
1662         public new uint ChildCount
1663         {
1664             get
1665             {
1666                 return Convert.ToUInt32(Children.Count);
1667             }
1668         }
1669
1670         /// <summary>
1671         /// Gets the view's ID.
1672         /// Read-only
1673         /// </summary>
1674         /// <since_tizen> 3 </since_tizen>
1675         public uint ID
1676         {
1677             get
1678             {
1679                 return GetId();
1680             }
1681         }
1682
1683         /// <summary>
1684         /// Gets or sets the status of whether the view should emit touch or hover signals.
1685         /// </summary>
1686         /// <since_tizen> 3 </since_tizen>
1687         public bool Sensitive
1688         {
1689             get
1690             {
1691                 return (bool)GetValue(SensitiveProperty);
1692             }
1693             set
1694             {
1695                 SetValue(SensitiveProperty, value);
1696                 NotifyPropertyChanged();
1697             }
1698         }
1699
1700         /// <summary>
1701         /// 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.
1702         /// </summary>
1703         /// <since_tizen> 3 </since_tizen>
1704         public bool LeaveRequired
1705         {
1706             get
1707             {
1708                 return (bool)GetValue(LeaveRequiredProperty);
1709             }
1710             set
1711             {
1712                 SetValue(LeaveRequiredProperty, value);
1713                 NotifyPropertyChanged();
1714             }
1715         }
1716
1717         /// <summary>
1718         /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1719         /// </summary>
1720         /// <since_tizen> 3 </since_tizen>
1721         public bool InheritOrientation
1722         {
1723             get
1724             {
1725                 return (bool)GetValue(InheritOrientationProperty);
1726             }
1727             set
1728             {
1729                 SetValue(InheritOrientationProperty, value);
1730                 NotifyPropertyChanged();
1731             }
1732         }
1733
1734         /// <summary>
1735         /// Gets or sets the status of whether a child view inherits it's parent's scale.
1736         /// </summary>
1737         /// <since_tizen> 3 </since_tizen>
1738         public bool InheritScale
1739         {
1740             get
1741             {
1742                 return (bool)GetValue(InheritScaleProperty);
1743             }
1744             set
1745             {
1746                 SetValue(InheritScaleProperty, value);
1747                 NotifyPropertyChanged();
1748             }
1749         }
1750
1751         /// <summary>
1752         /// Gets or sets the status of how the view and its children should be drawn.<br />
1753         /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1754         /// 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 />
1755         /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1756         /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1757         /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1758         /// </summary>
1759         /// <since_tizen> 3 </since_tizen>
1760         public DrawModeType DrawMode
1761         {
1762             get
1763             {
1764                 return (DrawModeType)GetValue(DrawModeProperty);
1765             }
1766             set
1767             {
1768                 SetValue(DrawModeProperty, value);
1769                 NotifyPropertyChanged();
1770             }
1771         }
1772
1773         /// <summary>
1774         /// Gets or sets the relative to parent size factor of the view.<br />
1775         /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1776         /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1777         /// </summary>
1778         /// <remarks>
1779         /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1780         /// </remarks>
1781         /// <since_tizen> 3 </since_tizen>
1782         public Vector3 SizeModeFactor
1783         {
1784             get
1785             {
1786                 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1787                 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1788             }
1789             set
1790             {
1791                 SetValue(SizeModeFactorProperty, value);
1792                 NotifyPropertyChanged();
1793             }
1794         }
1795
1796         /// <summary>
1797         /// Gets or sets the width resize policy to be used.
1798         /// </summary>
1799         /// <since_tizen> 3 </since_tizen>
1800         public ResizePolicyType WidthResizePolicy
1801         {
1802             get
1803             {
1804                 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1805             }
1806             set
1807             {
1808                 SetValue(WidthResizePolicyProperty, value);
1809                 NotifyPropertyChanged();
1810             }
1811         }
1812
1813         /// <summary>
1814         /// Gets or sets the height resize policy to be used.
1815         /// </summary>
1816         /// <since_tizen> 3 </since_tizen>
1817         public ResizePolicyType HeightResizePolicy
1818         {
1819             get
1820             {
1821                 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1822             }
1823             set
1824             {
1825                 SetValue(HeightResizePolicyProperty, value);
1826                 NotifyPropertyChanged();
1827             }
1828         }
1829
1830         /// <summary>
1831         /// Gets or sets the policy to use when setting size with size negotiation.<br />
1832         /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1833         /// </summary>
1834         /// <since_tizen> 3 </since_tizen>
1835         public SizeScalePolicyType SizeScalePolicy
1836         {
1837             get
1838             {
1839                 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1840             }
1841             set
1842             {
1843                 SetValue(SizeScalePolicyProperty, value);
1844                 NotifyPropertyChanged();
1845             }
1846         }
1847
1848         /// <summary>
1849         ///  Gets or sets the status of whether the width size is dependent on the height size.
1850         /// </summary>
1851         /// <since_tizen> 3 </since_tizen>
1852         public bool WidthForHeight
1853         {
1854             get
1855             {
1856                 return (bool)GetValue(WidthForHeightProperty);
1857             }
1858             set
1859             {
1860                 SetValue(WidthForHeightProperty, value);
1861                 NotifyPropertyChanged();
1862             }
1863         }
1864
1865         /// <summary>
1866         /// Gets or sets the status of whether the height size is dependent on the width size.
1867         /// </summary>
1868         /// <since_tizen> 3 </since_tizen>
1869         public bool HeightForWidth
1870         {
1871             get
1872             {
1873                 return (bool)GetValue(HeightForWidthProperty);
1874             }
1875             set
1876             {
1877                 SetValue(HeightForWidthProperty, value);
1878                 NotifyPropertyChanged();
1879             }
1880         }
1881
1882         /// <summary>
1883         /// Gets or sets the padding for use in layout.
1884         /// </summary>
1885         /// <remarks>
1886         /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1887         /// </remarks>
1888         /// <since_tizen> 5 </since_tizen>
1889         public Extents Padding
1890         {
1891             get
1892             {
1893                 // If View has a Layout then padding in stored in the base Layout class
1894                 if (Layout != null)
1895                 {
1896                     return Layout.Padding;
1897                 }
1898                 else
1899                 {
1900                     Extents temp = (Extents)GetValue(PaddingProperty);
1901                     return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1902                 }
1903                 // Two return points to prevent creating a zeroed Extent native object before assignment
1904             }
1905             set
1906             {
1907                 Extents padding = value;
1908                 if (Layout != null)
1909                 {
1910                     // Layout set so store Padding in LayoutItem instead of in View.
1911                     // If View stores the Padding value then Legacy Size Negotiation will overwrite
1912                     // the position and sizes measure in the Layouting.
1913                     Layout.Padding = value;
1914                     // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1915                     // Let the View keeps it's padding.  Still store Padding in Layout to reduce code paths.
1916                     if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1917                     {
1918                         padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1919                     }
1920                 }
1921
1922                 SetValue(PaddingProperty, padding);
1923                 NotifyPropertyChanged();
1924             }
1925         }
1926
1927         /// <summary>
1928         /// Gets or sets the minimum size the view can be assigned in size negotiation.
1929         /// </summary>
1930         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1931         /// <remarks>
1932         /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1933         /// </remarks>
1934         /// <since_tizen> 3 </since_tizen>
1935         public Size2D MinimumSize
1936         {
1937             get
1938             {
1939                 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1940                 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1941             }
1942             set
1943             {
1944                 if (value == null)
1945                 {
1946                     throw new ArgumentNullException(nameof(value));
1947                 }
1948                 if (layout != null)
1949                 {
1950                     // Note: it only works if minimum size is >= than natural size.
1951                     // To force the size it should be done through the width&height spec or Size2D.
1952                     layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1953                     layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1954                     layout.RequestLayout();
1955                 }
1956                 SetValue(MinimumSizeProperty, value);
1957                 NotifyPropertyChanged();
1958             }
1959         }
1960
1961         /// <summary>
1962         /// Gets or sets the maximum size the view can be assigned in size negotiation.
1963         /// </summary>
1964         /// <remarks>
1965         /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1966         /// </remarks>
1967         /// <since_tizen> 3 </since_tizen>
1968         public Size2D MaximumSize
1969         {
1970             get
1971             {
1972                 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1973                 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1974             }
1975             set
1976             {
1977                 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1978                 // MATCH_PARENT spec + parent container size can be used to limit
1979                 if (layout != null)
1980                 {
1981                     layout.RequestLayout();
1982                 }
1983                 SetValue(MaximumSizeProperty, value);
1984                 NotifyPropertyChanged();
1985             }
1986         }
1987
1988         /// <summary>
1989         /// Gets or sets whether a child view inherits it's parent's position.<br />
1990         /// Default is to inherit.<br />
1991         /// 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 />
1992         /// </summary>
1993         /// <since_tizen> 3 </since_tizen>
1994         public bool InheritPosition
1995         {
1996             get
1997             {
1998                 return (bool)GetValue(InheritPositionProperty);
1999             }
2000             set
2001             {
2002                 SetValue(InheritPositionProperty, value);
2003                 NotifyPropertyChanged();
2004             }
2005         }
2006
2007         /// <summary>
2008         /// Gets or sets the clipping behavior (mode) of it's children.
2009         /// </summary>
2010         /// <since_tizen> 3 </since_tizen>
2011         public ClippingModeType ClippingMode
2012         {
2013             get
2014             {
2015                 return (ClippingModeType)GetValue(ClippingModeProperty);
2016             }
2017             set
2018             {
2019                 SetValue(ClippingModeProperty, value);
2020                 NotifyPropertyChanged();
2021             }
2022         }
2023
2024         /// <summary>
2025         /// Gets the number of renderers held by the view.
2026         /// </summary>
2027         /// <since_tizen> 3 </since_tizen>
2028         public uint RendererCount
2029         {
2030             get
2031             {
2032                 return GetRendererCount();
2033             }
2034         }
2035
2036         /// <summary>
2037         /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2038         /// </summary>
2039         /// <remarks>
2040         /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2041         /// </remarks>
2042         /// <since_tizen> 3 </since_tizen>
2043         [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2044             "Like: " +
2045             "View view = new View(); " +
2046             "view.PivotPoint = PivotPoint.Center; " +
2047             "view.PositionUsesPivotPoint = true;")]
2048         [EditorBrowsable(EditorBrowsableState.Never)]
2049         public Position AnchorPoint
2050         {
2051             get
2052             {
2053                 Position temp = new Position(0.0f, 0.0f, 0.0f);
2054                 var pValue = GetProperty(View.Property.AnchorPoint);
2055                 pValue.Get(temp);
2056                 pValue.Dispose();
2057                 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2058                 temp.Dispose();
2059                 return ret;
2060             }
2061             set
2062             {
2063                 var temp = new Tizen.NUI.PropertyValue(value);
2064                 SetProperty(View.Property.AnchorPoint, temp);
2065                 temp.Dispose();
2066                 NotifyPropertyChanged();
2067             }
2068         }
2069
2070         /// <summary>
2071         /// Sets the size of a view for the width, the height and the depth.<br />
2072         /// Geometry can be scaled to fit within this area.<br />
2073         /// This does not interfere with the view's scale factor.<br />
2074         /// The views default depth is the minimum of width and height.<br />
2075         /// </summary>
2076         /// <remarks>
2077         /// <para>
2078         /// Animatable - This property can be animated using <c>Animation</c> class.
2079         /// </para>
2080         /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2081         /// </remarks>
2082         /// <since_tizen> 5 </since_tizen>
2083         public Size Size
2084         {
2085             get
2086             {
2087                 Size tmp = (Size)GetValue(SizeProperty);
2088                 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2089             }
2090             set
2091             {
2092                 SetValue(SizeProperty, value);
2093                 NotifyPropertyChanged();
2094             }
2095         }
2096
2097         /// <summary>
2098         /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2099         /// </summary>
2100         /// <since_tizen> 3 </since_tizen>
2101         [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2102             "Like: " +
2103             "Container parent =  view.GetParent(); " +
2104             "View view = parent as View;")]
2105         [EditorBrowsable(EditorBrowsableState.Never)]
2106         public new View Parent
2107         {
2108             get
2109             {
2110                 View ret;
2111                 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2112                 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2113                 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2114
2115                 if (basehandle is Layer layer)
2116                 {
2117                     ret = new View(Layer.getCPtr(layer).Handle, false);
2118                     NUILog.Error("This Parent property is deprecated, should do not be used");
2119                 }
2120                 else
2121                 {
2122                     ret = basehandle as View;
2123                 }
2124
2125                 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2126                 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2127
2128                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2129                 return ret;
2130             }
2131         }
2132
2133         /// <summary>
2134         /// Gets/Sets whether inherit parent's the layout Direction.
2135         /// </summary>
2136         /// <since_tizen> 4 </since_tizen>
2137         public bool InheritLayoutDirection
2138         {
2139             get
2140             {
2141                 return (bool)GetValue(InheritLayoutDirectionProperty);
2142             }
2143             set
2144             {
2145                 SetValue(InheritLayoutDirectionProperty, value);
2146                 NotifyPropertyChanged();
2147             }
2148         }
2149
2150         /// <summary>
2151         /// Gets/Sets the layout Direction.
2152         /// </summary>
2153         /// <since_tizen> 4 </since_tizen>
2154         public ViewLayoutDirectionType LayoutDirection
2155         {
2156             get
2157             {
2158                 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2159             }
2160             set
2161             {
2162                 SetValue(LayoutDirectionProperty, value);
2163                 NotifyPropertyChanged();
2164                 layout?.RequestLayout();
2165             }
2166         }
2167
2168         /// <summary>
2169         /// Gets or sets the Margin for use in layout.
2170         /// </summary>
2171         /// <remarks>
2172         /// Margin property is supported by Layout algorithms and containers.
2173         /// Please Set Layout if you want to use Margin property.
2174         /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2175         /// </remarks>
2176         /// <since_tizen> 4 </since_tizen>
2177         public Extents Margin
2178         {
2179             get
2180             {
2181                 // If View has a Layout then margin is stored in Layout.
2182                 if (Layout != null)
2183                 {
2184                     return Layout.Margin;
2185                 }
2186                 else
2187                 {
2188                     // If Layout not set then return margin stored in View.
2189                     Extents temp = (Extents)GetValue(MarginProperty);
2190                     return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2191                 }
2192                 // Two return points to prevent creating a zeroed Extent native object before assignment
2193             }
2194             set
2195             {
2196                 if (Layout != null)
2197                 {
2198                     // Layout set so store Margin in LayoutItem instead of View.
2199                     // If View stores the Margin too then the Legacy Size Negotiation will
2200                     // overwrite the position and size values measured in the Layouting.
2201                     Layout.Margin = value;
2202                     SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2203                     layout?.RequestLayout();
2204                 }
2205                 else
2206                 {
2207                     SetValue(MarginProperty, value);
2208                 }
2209                 NotifyPropertyChanged();
2210                 layout?.RequestLayout();
2211             }
2212         }
2213
2214         ///<summary>
2215         /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2216         ///</summary>
2217         /// <since_tizen> 6 </since_tizen>
2218         public int WidthSpecification
2219         {
2220             get
2221             {
2222                 return widthPolicy;
2223             }
2224             set
2225             {
2226                 if (value == widthPolicy)
2227                     return;
2228
2229                 widthPolicy = value;
2230                 if (widthPolicy >= 0)
2231                 {
2232                     if (heightPolicy >= 0) // Policy an exact value
2233                     {
2234                         // Create Size2D only both _widthPolicy and _heightPolicy are set.
2235                         Size2D = new Size2D(widthPolicy, heightPolicy);
2236                     }
2237                 }
2238                 layout?.RequestLayout();
2239             }
2240         }
2241
2242         ///<summary>
2243         /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2244         ///</summary>
2245         /// <since_tizen> 6 </since_tizen>
2246         public int HeightSpecification
2247         {
2248             get
2249             {
2250                 return heightPolicy;
2251             }
2252             set
2253             {
2254                 if (value == heightPolicy)
2255                     return;
2256
2257                 heightPolicy = value;
2258                 if (heightPolicy >= 0)
2259                 {
2260                     if (widthPolicy >= 0) // Policy an exact value
2261                     {
2262                         // Create Size2D only both _widthPolicy and _heightPolicy are set.
2263                         Size2D = new Size2D(widthPolicy, heightPolicy);
2264                     }
2265                 }
2266                 layout?.RequestLayout();
2267             }
2268         }
2269
2270         ///<summary>
2271         /// Gets the List of transitions for this View.
2272         ///</summary>
2273         /// <since_tizen> 6 </since_tizen>
2274         public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2275         {
2276             get
2277             {
2278                 if (layoutTransitions == null)
2279                 {
2280                     layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2281                 }
2282                 return layoutTransitions;
2283             }
2284         }
2285
2286         ///<summary>
2287         /// Set a layout transitions for this View.
2288         ///</summary>
2289         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2290         /// <remarks>
2291         /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2292         /// </remarks>
2293         /// <since_tizen> 6 </since_tizen>
2294         public LayoutTransition LayoutTransition
2295         {
2296             get
2297             {
2298                 return layoutTransition;
2299             }
2300             set
2301             {
2302                 if (value == null)
2303                 {
2304                     throw new global::System.ArgumentNullException(nameof(value));
2305                 }
2306                 if (layoutTransitions == null)
2307                 {
2308                     layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2309                 }
2310
2311                 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2312
2313                 AttachTransitionsToChildren(value);
2314
2315                 layoutTransition = value;
2316             }
2317         }
2318
2319         /// <summary>
2320         /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2321         /// </summary>
2322         /// <remarks>
2323         /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2324         /// </remarks>
2325         /// <since_tizen> 4 </since_tizen>
2326         [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2327         [EditorBrowsable(EditorBrowsableState.Never)]
2328         public Extents PaddingEX
2329         {
2330             get
2331             {
2332                 Extents temp = new Extents(0, 0, 0, 0);
2333                 var pValue = GetProperty(View.Property.PADDING);
2334                 pValue.Get(temp);
2335                 pValue.Dispose();
2336                 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2337                 temp.Dispose();
2338                 return ret;
2339             }
2340             set
2341             {
2342                 var temp = new Tizen.NUI.PropertyValue(value);
2343                 SetProperty(View.Property.PADDING, temp);
2344                 temp.Dispose();
2345                 NotifyPropertyChanged();
2346                 layout?.RequestLayout();
2347             }
2348         }
2349
2350         /// <summary>
2351         /// The Color of View. This is an RGBA value.
2352         /// </summary>
2353         /// <remarks>
2354         /// <para>
2355         /// Animatable - This property can be animated using <c>Animation</c> class.
2356         /// </para>
2357         /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2358         /// </remarks>
2359         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2360         [EditorBrowsable(EditorBrowsableState.Never)]
2361         public Color Color
2362         {
2363             get
2364             {
2365                 Color temp = (Color)GetValue(ColorProperty);
2366                 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2367             }
2368             set
2369             {
2370                 SetValue(ColorProperty, value);
2371                 NotifyPropertyChanged();
2372             }
2373         }
2374
2375         /// <summary>
2376         /// Set the layout on this View. Replaces any existing Layout.
2377         /// </summary>
2378         /// <remarks>
2379         /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2380         /// </remarks>
2381         /// <since_tizen> 6 </since_tizen>
2382         public LayoutItem Layout
2383         {
2384             get
2385             {
2386                 return layout;
2387             }
2388             set
2389             {
2390                 // Do nothing if layout provided is already set on this View.
2391                 if (value == layout)
2392                 {
2393                     return;
2394                 }
2395
2396                 LayoutingDisabled = false;
2397                 layoutSet = true;
2398
2399                 // If new layout being set already has a owner then that owner receives a replacement default layout.
2400                 // First check if the layout to be set already has a owner.
2401                 if (value?.Owner != null)
2402                 {
2403                     // Previous owner of the layout gets a default layout as a replacement.
2404                     value.Owner.Layout = new AbsoluteLayout();
2405
2406                     // Copy Margin and Padding to replacement LayoutGroup.
2407                     if (value.Owner.Layout != null)
2408                     {
2409                         value.Owner.Layout.Margin = value.Margin;
2410                         value.Owner.Layout.Padding = value.Padding;
2411                     }
2412                 }
2413
2414                 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2415                 // View if no replacement. Previously margin and padding values would have been moved from
2416                 // the View to the layout.
2417                 if (layout != null) // Existing layout
2418                 {
2419                     if (value != null)
2420                     {
2421                         // Existing layout being replaced so copy over margin and padding values.
2422                         value.Margin = layout.Margin;
2423                         value.Padding = layout.Padding;
2424                     }
2425                     else
2426                     {
2427                         // Layout not being replaced so restore margin and padding to View.
2428                         SetValue(MarginProperty, layout.Margin);
2429                         SetValue(PaddingProperty, layout.Padding);
2430                         NotifyPropertyChanged();
2431                     }
2432                 }
2433                 else
2434                 {
2435                     // First Layout to be added to the View hence copy
2436
2437                     // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2438                     if (value != null)
2439                     {
2440                         Extents margin = Margin;
2441                         Extents padding = Padding;
2442                         if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2443                         {
2444                             // If View already has a margin set then store it in Layout instead.
2445                             value.Margin = margin;
2446                             SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2447                             NotifyPropertyChanged();
2448                         }
2449
2450                         if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2451                         {
2452                             // If View already has a padding set then store it in Layout instead.
2453                             value.Padding = padding;
2454
2455                             // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2456                             // Let the View keeps it's padding.  Still store Padding in Layout to reduce code paths.
2457                             if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2458                             {
2459                                 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2460                                 NotifyPropertyChanged();
2461                             }
2462                         }
2463                     }
2464                 }
2465
2466                 // Remove existing layout from it's parent layout group.
2467                 layout?.Unparent();
2468
2469                 value.SetPositionByLayout = !excludeLayouting;
2470
2471                 // Set layout to this view
2472                 SetLayout(value);
2473             }
2474         }
2475
2476         /// <summary>
2477         /// The weight of the View, used to share available space in a layout with siblings.
2478         /// </summary>
2479         /// <since_tizen> 6 </since_tizen>
2480         public float Weight
2481         {
2482             get
2483             {
2484                 return weight;
2485             }
2486             set
2487             {
2488                 weight = value;
2489                 layout?.RequestLayout();
2490             }
2491         }
2492
2493         /// <summary>
2494         ///  Whether to load the BackgroundImage synchronously.
2495         ///  If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2496         ///  Note: For Normal Quad images only.
2497         /// </summary>
2498         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2499         [EditorBrowsable(EditorBrowsableState.Never)]
2500         public bool BackgroundImageSynchronosLoading
2501         {
2502             get
2503             {
2504                 return backgroundImageSynchronosLoading;
2505             }
2506             set
2507             {
2508                 backgroundImageSynchronosLoading = value;
2509
2510                 string bgUrl = null;
2511                 var pValue = Background.Find(ImageVisualProperty.URL);
2512                 pValue?.Get(out bgUrl);
2513                 pValue?.Dispose();
2514
2515                 if (!string.IsNullOrEmpty(bgUrl))
2516                 {
2517                     PropertyMap bgMap = this.Background;
2518                     var temp = new PropertyValue(backgroundImageSynchronosLoading);
2519                     bgMap.Add("synchronousLoading", temp);
2520                     temp.Dispose();
2521                     Background = bgMap;
2522                 }
2523             }
2524         }
2525
2526         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2527         [EditorBrowsable(EditorBrowsableState.Never)]
2528         public Vector2 UpdateSizeHint
2529         {
2530             get
2531             {
2532                 return (Vector2)GetValue(UpdateSizeHintProperty);
2533             }
2534             set
2535             {
2536                 SetValue(UpdateSizeHintProperty, value);
2537                 NotifyPropertyChanged();
2538             }
2539         }
2540
2541         /// <summary>
2542         /// Enable/Disable ControlState propagation for children.
2543         /// It is false by default.
2544         /// If the View needs to share ControlState with descendants, please set it true.
2545         /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2546         /// </summary>
2547         [EditorBrowsable(EditorBrowsableState.Never)]
2548         public bool EnableControlStatePropagation
2549         {
2550             get => controlStatePropagation;
2551             set
2552             {
2553                 controlStatePropagation = value;
2554
2555                 foreach (View child in Children)
2556                 {
2557                     child.EnableControlStatePropagation = value;
2558                 }
2559             }
2560         }
2561
2562         /// <summary>
2563         /// By default, it is false in View, true in Control.
2564         /// Note that if the value is true, the View will be a touch receptor.
2565         /// </summary>
2566         [EditorBrowsable(EditorBrowsableState.Never)]
2567         public bool EnableControlState
2568         {
2569             get
2570             {
2571                 return (bool)GetValue(EnableControlStateProperty);
2572             }
2573             set
2574             {
2575                 SetValue(EnableControlStateProperty, value);
2576             }
2577         }
2578
2579         /// <summary>
2580         /// Whether the actor grab all touches even if touch leaves its boundary.
2581         /// </summary>
2582         /// <returns>true, if it grab all touch after start</returns>
2583         [EditorBrowsable(EditorBrowsableState.Never)]
2584         public bool GrabTouchAfterLeave
2585         {
2586             get
2587             {
2588                 bool temp = false;
2589                 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2590                 pValue.Get(out temp);
2591                 pValue.Dispose();
2592                 return temp;
2593             }
2594             set
2595             {
2596                 var temp = new Tizen.NUI.PropertyValue(value);
2597                 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2598                 temp.Dispose();
2599                 NotifyPropertyChanged();
2600             }
2601         }
2602
2603         /// <summary>
2604         /// Determines which blend equation will be used to render renderers of this actor.
2605         /// </summary>
2606         /// <returns>blend equation enum currently assigned</returns>
2607         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2608         [EditorBrowsable(EditorBrowsableState.Never)]
2609         public BlendEquationType BlendEquation
2610         {
2611             get
2612             {
2613                 int temp = 0;
2614                 var pValue = GetProperty(View.Property.BlendEquation);
2615                 pValue.Get(out temp);
2616                 pValue.Dispose();
2617                 return (BlendEquationType)temp;
2618             }
2619             set
2620             {
2621                 var temp = new Tizen.NUI.PropertyValue((int)value);
2622                 SetProperty(View.Property.BlendEquation, temp);
2623                 temp.Dispose();
2624                 NotifyPropertyChanged();
2625             }
2626         }
2627
2628         /// <summary>
2629         /// If the value is true, the View will change its style as the theme changes.
2630         /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2631         /// </summary>
2632         /// <since_tizen> 9 </since_tizen>
2633         public bool ThemeChangeSensitive
2634         {
2635             get => (bool)GetValue(ThemeChangeSensitiveProperty);
2636             set => SetValue(ThemeChangeSensitiveProperty, value);
2637         }
2638
2639         /// <summary>
2640         /// Create Style, it is abstract function and must be override.
2641         /// </summary>
2642         [EditorBrowsable(EditorBrowsableState.Never)]
2643         protected virtual ViewStyle CreateViewStyle()
2644         {
2645             return new ViewStyle();
2646         }
2647
2648         /// <summary>
2649         /// Called after the View's ControlStates changed.
2650         /// </summary>
2651         /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2652         [EditorBrowsable(EditorBrowsableState.Never)]
2653         protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2654         {
2655         }
2656
2657         /// <summary>
2658         /// </summary>
2659         [EditorBrowsable(EditorBrowsableState.Never)]
2660         protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2661         {
2662             UpdateStyle();
2663         }
2664
2665         private bool IsViewPropertyDirty(BindableProperty styleProperty)
2666         {
2667             if (dirtyPropertySet.Count == 0)
2668             {
2669                 return false;
2670             }
2671
2672             return dirtyPropertySet.Contains(styleProperty.PropertyName);
2673         }
2674
2675         /// <summary>
2676         /// Apply style instance to the view.
2677         /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2678         /// </summary>
2679         /// <since_tizen> 9 </since_tizen>
2680         public virtual void ApplyStyle(ViewStyle viewStyle)
2681         {
2682             if (viewStyle == null || this.viewStyle == viewStyle) return;
2683
2684             this.viewStyle = viewStyle;
2685
2686             if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2687             {
2688                 // Nothing to apply
2689                 return;
2690             }
2691
2692             if (dirtyPropertySet == null)
2693             {
2694                 dirtyPropertySet = new HashSet<string>();
2695             }
2696
2697             BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2698
2699             if (bindablePropertyOfView == null)
2700             {
2701                 return;
2702             }
2703
2704             var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2705             viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2706
2707             foreach (var sourceProperty in dirtyStyleProperties)
2708             {
2709                 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2710                 {
2711                     // Skip applying theme style for a property set by user.
2712                     continue;
2713                 }
2714
2715                 var sourceValue = viewStyle.GetValue(sourceProperty);
2716
2717                 if (sourceValue == null)
2718                 {
2719                     continue;
2720                 }
2721
2722                 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2723
2724                 if (destinationProperty != null)
2725                 {
2726                     SetValue(destinationProperty, sourceValue);
2727                 }
2728             }
2729         }
2730
2731         /// <summary>
2732         /// Get whether the View is culled or not.
2733         /// True means that the View is out of the view frustum.
2734         /// </summary>
2735         /// <remarks>
2736         /// Hidden-API (Inhouse-API).
2737         /// </remarks>
2738         [EditorBrowsable(EditorBrowsableState.Never)]
2739         public bool Culled
2740         {
2741             get
2742             {
2743                 bool temp = false;
2744                 var pValue = GetProperty(View.Property.Culled);
2745                 pValue.Get(out temp);
2746                 pValue.Dispose();
2747                 return temp;
2748             }
2749         }
2750
2751         /// <summary>
2752         /// Set or Get TransitionOptions for the page transition.
2753         /// </summary>
2754         /// <remarks>
2755         /// Hidden-API (Inhouse-API).
2756         /// </remarks>
2757         [EditorBrowsable(EditorBrowsableState.Never)]
2758         public TransitionOptions TransitionOptions
2759         {
2760             set
2761             {
2762                 transitionOptions = value;
2763             }
2764             get
2765             {
2766                 return transitionOptions;
2767             }
2768         }
2769     }
2770 }