[NUI] Change CornerRadius type to Vector4 from float (#2863)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / ViewProperty / BackgroundExtraData.cs
1 /*
2  * Copyright(c) 2020 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.ComponentModel;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
23     /// The class storing Background extra properties such as CornerRadius, ImageBorder.
24     /// </summary>
25     internal class BackgroundExtraData : IDisposable
26     {
27         private bool disposed = false;
28         internal BackgroundExtraData()
29         {
30         }
31
32         internal BackgroundExtraData(BackgroundExtraData other)
33         {
34             BackgroundImageBorder = other.BackgroundImageBorder;
35             CornerRadius = other.CornerRadius;
36         }
37
38         private Rectangle backgroundImageBorder;
39
40         /// <summary></summary>
41         internal Rectangle BackgroundImageBorder
42         {
43             get => backgroundImageBorder;
44             set => backgroundImageBorder = new Rectangle(value);
45         }
46
47         /// <summary></summary>
48         internal Vector4 CornerRadius { get; set; }
49
50         /// <summary>
51         /// Whether the CornerRadius value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
52         /// </summary>
53         internal VisualTransformPolicyType CornerRadiusPolicy { get; set; } = VisualTransformPolicyType.Absolute;
54
55         [EditorBrowsable(EditorBrowsableState.Never)]
56         protected virtual void Dispose(bool disposing)
57         {
58             if (disposed)
59             {
60                 return;
61             }
62             if (disposing)
63             {
64                 backgroundImageBorder?.Dispose();
65             }
66             disposed = true;
67         }
68
69         [EditorBrowsable(EditorBrowsableState.Never)]
70         public void Dispose()
71         {
72             Dispose(true);
73             global::System.GC.SuppressFinalize(this);
74         }
75     }
76 }
77
78