[NUI] Remove duplicate getCPtr from Disposable/View subclasses (#3544)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Common / FontMetrics.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 namespace Tizen.NUI
18 {
19     internal class FontMetrics : Disposable
20     {
21         internal FontMetrics(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
22         {
23         }
24
25         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
26         {
27             Interop.FontClient.DeleteFontMetrics(swigCPtr);
28         }
29
30         public FontMetrics() : this(Interop.FontClient.NewFontMetrics(), true)
31         {
32             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
33         }
34
35         public FontMetrics(float ascenderPixels, float descenderPixels, float heightPixels, float underlinePositionPixels, float underlinePositionThickness) : this(Interop.FontClient.NewFontMetrics(ascenderPixels, descenderPixels, heightPixels, underlinePositionPixels, underlinePositionThickness), true)
36         {
37             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
38         }
39
40         public float Ascender
41         {
42             set
43             {
44                 Interop.FontClient.FontMetricsAscenderSet(SwigCPtr, value);
45                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46             }
47             get
48             {
49                 float ret = Interop.FontClient.FontMetricsAscenderGet(SwigCPtr);
50                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51                 return ret;
52             }
53         }
54
55         public float Descender
56         {
57             set
58             {
59                 Interop.FontClient.FontMetricsDescenderSet(SwigCPtr, value);
60                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61             }
62             get
63             {
64                 float ret = Interop.FontClient.FontMetricsDescenderGet(SwigCPtr);
65                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66                 return ret;
67             }
68         }
69
70         public float Height
71         {
72             set
73             {
74                 Interop.FontClient.FontMetricsHeightSet(SwigCPtr, value);
75                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76             }
77             get
78             {
79                 float ret = Interop.FontClient.FontMetricsHeightGet(SwigCPtr);
80                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81                 return ret;
82             }
83         }
84
85         public float UnderlinePosition
86         {
87             set
88             {
89                 Interop.FontClient.FontMetricsUnderlinePositionSet(SwigCPtr, value);
90                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91             }
92             get
93             {
94                 float ret = Interop.FontClient.FontMetricsUnderlinePositionGet(SwigCPtr);
95                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96                 return ret;
97             }
98         }
99
100         public float UnderlineThickness
101         {
102             set
103             {
104                 Interop.FontClient.FontMetricsUnderlineThicknessSet(SwigCPtr, value);
105                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106             }
107             get
108             {
109                 float ret = Interop.FontClient.FontMetricsUnderlineThicknessGet(SwigCPtr);
110                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111                 return ret;
112             }
113         }
114     }
115 }