[NUI] Reduce code duplication - refactor dispose codes (#1010)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / GlyphInfo.cs
1 /*
2  * Copyright(c) 2017 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 GlyphInfo : Disposable
20     {
21         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
22         protected bool swigCMemOwn;
23
24         internal GlyphInfo(global::System.IntPtr cPtr, bool cMemoryOwn)
25         {
26             swigCMemOwn = cMemoryOwn;
27             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28         }
29
30         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GlyphInfo obj)
31         {
32             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33         }
34
35         protected override void Dispose(DisposeTypes type)
36         {
37             if (disposed)
38             {
39                 return;
40             }
41
42             //Release your own unmanaged resources here.
43             //You should not access any managed member here except static instance.
44             //because the execution order of Finalizes is non-deterministic.
45
46             if (swigCPtr.Handle != global::System.IntPtr.Zero)
47             {
48                 if (swigCMemOwn)
49                 {
50                     swigCMemOwn = false;
51                     Interop.GlytphInfo.delete_GlyphInfo(swigCPtr);
52                 }
53                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
54             }
55             base.Dispose(type);
56         }
57
58         public GlyphInfo() : this(Interop.GlytphInfo.new_GlyphInfo__SWIG_0(), true)
59         {
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61         }
62
63         public GlyphInfo(uint font, uint i) : this(Interop.GlytphInfo.new_GlyphInfo__SWIG_1(font, i), true)
64         {
65             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66         }
67
68         public uint FontId
69         {
70             set
71             {
72                 Interop.GlytphInfo.GlyphInfo_fontId_set(swigCPtr, value);
73                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             }
75             get
76             {
77                 uint ret = Interop.GlytphInfo.GlyphInfo_fontId_get(swigCPtr);
78                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79                 return ret;
80             }
81         }
82
83         public uint Index
84         {
85             set
86             {
87                 Interop.GlytphInfo.GlyphInfo_index_set(swigCPtr, value);
88                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89             }
90             get
91             {
92                 uint ret = Interop.GlytphInfo.GlyphInfo_index_get(swigCPtr);
93                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94                 return ret;
95             }
96         }
97
98         public float Width
99         {
100             set
101             {
102                 Interop.GlytphInfo.GlyphInfo_width_set(swigCPtr, value);
103                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104             }
105             get
106             {
107                 float ret = Interop.GlytphInfo.GlyphInfo_width_get(swigCPtr);
108                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109                 return ret;
110             }
111         }
112
113         public float Height
114         {
115             set
116             {
117                 Interop.GlytphInfo.GlyphInfo_height_set(swigCPtr, value);
118                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             }
120             get
121             {
122                 float ret = Interop.GlytphInfo.GlyphInfo_height_get(swigCPtr);
123                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124                 return ret;
125             }
126         }
127
128         public float XBearing
129         {
130             set
131             {
132                 Interop.GlytphInfo.GlyphInfo_xBearing_set(swigCPtr, value);
133                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134             }
135             get
136             {
137                 float ret = Interop.GlytphInfo.GlyphInfo_xBearing_get(swigCPtr);
138                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139                 return ret;
140             }
141         }
142
143         public float YBearing
144         {
145             set
146             {
147                 Interop.GlytphInfo.GlyphInfo_yBearing_set(swigCPtr, value);
148                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149             }
150             get
151             {
152                 float ret = Interop.GlytphInfo.GlyphInfo_yBearing_get(swigCPtr);
153                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154                 return ret;
155             }
156         }
157
158         public float Advance
159         {
160             set
161             {
162                 Interop.GlytphInfo.GlyphInfo_advance_set(swigCPtr, value);
163                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             }
165             get
166             {
167                 float ret = Interop.GlytphInfo.GlyphInfo_advance_get(swigCPtr);
168                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169                 return ret;
170             }
171         }
172
173         public float ScaleFactor
174         {
175             set
176             {
177                 Interop.GlytphInfo.GlyphInfo_scaleFactor_set(swigCPtr, value);
178                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             }
180             get
181             {
182                 float ret = Interop.GlytphInfo.GlyphInfo_scaleFactor_get(swigCPtr);
183                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184                 return ret;
185             }
186         }
187     }
188 }