[NUI] Fix build warning[CA1000]
[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
18 using System;
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         internal BackgroundExtraData()
28         {
29         }
30
31         internal BackgroundExtraData(BackgroundExtraData other)
32         {
33             BackgroundImageBorder = other.BackgroundImageBorder;
34             CornerRadius = other.CornerRadius;
35         }
36
37         private Rectangle backgroundImageBorder;
38
39         /// <summary></summary>
40         internal Rectangle BackgroundImageBorder
41         {
42             get => backgroundImageBorder;
43             set => backgroundImageBorder = new Rectangle(value);
44         }
45
46         /// <summary></summary>
47         internal float CornerRadius { get; set; }
48
49         /// <summary>
50         /// Whether the CornerRadius value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
51         /// </summary>
52         internal VisualTransformPolicyType CornerRadiusPolicy { get; set; } = VisualTransformPolicyType.Absolute;
53
54         internal bool Empty()
55         {
56             return CornerRadius == 0 && Rectangle.IsNullOrZero(BackgroundImageBorder);
57         }
58
59         protected virtual void Dispose(bool disposing)
60         {
61             if (disposing)
62             {
63                 // Dispose managed resources.
64                 backgroundImageBorder?.Dispose();
65             }
66             // Free native resources.
67         }
68
69         public void Dispose()
70         {
71             Dispose(true);
72             GC.SuppressFinalize(this);
73         }
74
75     }
76 }
77
78