From: Jiyun Yang Date: Fri, 3 Jan 2020 08:52:16 +0000 (+0900) Subject: [NUI] Update Shadow property : add Clone method (#1271) X-Git-Tag: submit/tizen/20200114.005334~1^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d02d70c61b3af62ebcaf5b897768e53d0ccd18ae;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Update Shadow property : add Clone method (#1271) Signed-off-by: Jiyun Yang --- diff --git a/src/Tizen.NUI/src/public/Color.cs b/src/Tizen.NUI/src/public/Color.cs index 4314090..d7ad7b0 100755 --- a/src/Tizen.NUI/src/public/Color.cs +++ b/src/Tizen.NUI/src/public/Color.cs @@ -128,6 +128,10 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + internal Color(ColorChangedCallback cb, Color other) : this(cb, other.R, other.G, other.B, other.A) + { + } + internal delegate void ColorChangedCallback(float r, float g, float b, float a); private ColorChangedCallback callback = null; diff --git a/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs b/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs index 21edf54..5bf2d85 100644 --- a/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs +++ b/src/Tizen.NUI/src/public/ViewProperty/ImageShadow.cs @@ -38,6 +38,20 @@ namespace Tizen.NUI { } + /// + /// Deep copy method + /// + [EditorBrowsable(EditorBrowsableState.Never)] + override public object Clone() + { + return new ImageShadow() { + Offset = offset, + Scale = scale, + Url = url, + Border = border + }; + } + private void OnBorderChanged(int x, int y, int width, int height) { UpdateBorder(); diff --git a/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs b/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs index 44ee106..18b6fe7 100644 --- a/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs +++ b/src/Tizen.NUI/src/public/ViewProperty/Shadow.cs @@ -56,6 +56,20 @@ namespace Tizen.NUI return shadow; } + /// + /// Deep copy method + /// + [EditorBrowsable(EditorBrowsableState.Never)] + override public object Clone() + { + return new Shadow() { + Offset = offset, + Scale = scale, + Color = color, + BlurRadius = blurRadius + }; + } + private void OnColorChanged(float r, float g, float b, float a) { UpdateColor(); @@ -85,7 +99,7 @@ namespace Tizen.NUI } set { - color = value; + color = value == null? null : new Color(OnColorChanged, value); UpdateColor(); } } diff --git a/src/Tizen.NUI/src/public/ViewProperty/TransformablePropertyMap.cs b/src/Tizen.NUI/src/public/ViewProperty/TransformablePropertyMap.cs index d2d2927..b5e46d2 100644 --- a/src/Tizen.NUI/src/public/ViewProperty/TransformablePropertyMap.cs +++ b/src/Tizen.NUI/src/public/ViewProperty/TransformablePropertyMap.cs @@ -43,12 +43,12 @@ namespace Tizen.NUI /// /// The offset value that tansform should have in common /// - protected internal Vector2 offset = defaultOffset; + protected internal Vector2 offset; /// /// The size value in scale that tansform should have in common /// - protected internal Vector2 scale = noScale; + protected internal Vector2 scale; /// /// The output property map @@ -64,15 +64,29 @@ namespace Tizen.NUI /// Constructor /// [EditorBrowsable(EditorBrowsableState.Never)] - public TransformablePropertyMap() + public TransformablePropertyMap() : this(defaultOffset, noScale) + { + } + + /// + /// Copy Constructor + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public TransformablePropertyMap(TransformablePropertyMap other) : this(other.offset, other.scale) + { + } + + /// + /// Constructor + /// + protected internal TransformablePropertyMap(Vector2 offset, Vector2 scale) { - // Initialize maps propertyMap = new PropertyMap(); transformMap = new PropertyMap(); - - // Offet has default value, so need to update map transformMap[(int)VisualTransformPropertyType.OffsetPolicy] = new PropertyValue(defaultOffsetPolicy); - transformMap[(int)VisualTransformPropertyType.Offset] = PropertyValue.CreateWithGuard(offset); + + Offset = offset; + Scale = scale; propertyMap[Visual.Property.Transform] = new PropertyValue(transformMap); } @@ -154,6 +168,7 @@ namespace Tizen.NUI /// The value indicates percentage of the container size.
/// e.g. (0.5f, 1.0f) means 50% of the container's width and 100% of container's height. /// + [EditorBrowsable(EditorBrowsableState.Never)] public Vector2 Scale { get @@ -171,6 +186,12 @@ namespace Tizen.NUI abstract internal bool IsValid(); + /// + /// Deep copy method + /// + [EditorBrowsable(EditorBrowsableState.Never)] + abstract public object Clone(); + static internal PropertyValue ToPropertyValue(TransformablePropertyMap instance) { return (instance != null && instance.IsValid()) ? new PropertyValue(instance.propertyMap) : new PropertyValue();