Sync upstream
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
index e7e72de..502a927 100755 (executable)
@@ -45,7 +45,6 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static bool layoutingDisabled{get; set;} = true;
 
-        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
         private LayoutItem _layout; // Exclusive layout assigned to this View.
 
         // List of transitions paired with the condition that uses the transition.
@@ -60,9 +59,13 @@ namespace Tizen.NUI.BaseComponents
         private string[] transitionNames;
         private Rectangle backgroundImageBorder;
 
-        private ImageShadow imageShadow;
+        private ViewSelector<ImageShadow> imageShadow;
 
-        private Shadow boxShadow;
+        private ViewSelector<Shadow> boxShadow;
+
+        internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
+
+        static View() {}
 
         private ViewStyle viewStyle;
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
@@ -119,13 +122,11 @@ namespace Tizen.NUI.BaseComponents
 
         internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
         {
-            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
             this.ViewStyle.CopyFrom(viewStyle);
         }
 
         internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
         {
-            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
             if (HasBody())
             {
                 PositionUsesPivotPoint = false;
@@ -300,46 +301,44 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Describes a shadow as an image for View.
+        /// Describes a shadow as an image for View.
         /// It is null by default.
         /// </summary>
         /// <remarks>
         /// The mutually exclusive with "BoxShadow".
-        /// If it is not null, the "BoxShadow" property will be ignored.
         /// </remarks>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ImageShadow ImageShadow
         {
             get
             {
-                return (ImageShadow)GetValue(ImageShadowProperty);
+                var value = (ImageShadow)GetValue(ImageShadowProperty);
+                return value == null ? null : new ImageShadow(value, OnImageShadowChanged);
             }
             set
             {
-                value.OnPropertyChanged = OnImageShadowChanged;
                 SetValue(ImageShadowProperty, value);
                 NotifyPropertyChanged();
             }
         }
 
         /// <summary>
-        /// Describes a box shaped shadow drawing for View.
+        /// Describes a box shaped shadow drawing for View.
         /// It is null by default.
         /// </summary>
         /// <remarks>
         /// The mutually exclusive with "ImageShadow".
-        /// If the "ImageShadow" is not null, this property will be ignored.
         /// </remarks>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Shadow BoxShadow
         {
             get
             {
-                return (Shadow)GetValue(BoxShadowProperty);
+                var value = (Shadow)GetValue(BoxShadowProperty);
+                return value == null ? null : new Shadow(value, OnBoxShadowChanged);
             }
             set
             {
-                value.OnPropertyChanged = OnBoxShadowChanged;
                 SetValue(BoxShadowProperty, value);
                 NotifyPropertyChanged();
             }
@@ -687,6 +686,7 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
+                sizeSetExplicitly = value;  // Store size set by API, will be used in place of NaturalSize if not set.
                 SetValue(Size2DProperty, value);
                 // Set Specification so when layouts measure this View it matches the value set here.
                 // All Views are currently Layouts.
@@ -715,11 +715,6 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Retrieves and sets the view's opacity.<br />
         /// </summary>
-        /// <remarks>
-        /// <para>
-        /// Animatable - This property can be animated using <c>Animation</c> class.
-        /// </para>
-        /// </remarks>
         /// <since_tizen> 3 </since_tizen>
         public float Opacity
         {
@@ -1255,6 +1250,9 @@ namespace Tizen.NUI.BaseComponents
         /// If the view is not visible, then the view and its children will not be rendered.
         /// 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.
         /// </para>
+        /// <para>
+        /// Animatable - This property can be animated using <c>Animation</c> class.
+        /// </para>
         /// </remarks>
         /// <since_tizen> 3 </since_tizen>
         public bool Visibility
@@ -2240,8 +2238,7 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual ViewStyle GetViewStyle()
         {
-            viewStyle = new ViewStyle();
-            return viewStyle;
+            return new ViewStyle();
         }
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.