[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / FontDescription.cs
1 /*
2  * Copyright(c) 2019 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 FontDescription : Disposable
20     {
21
22         internal FontDescription(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
23         {
24         }
25
26         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FontDescription obj)
27         {
28             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
29         }
30
31         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
32         {
33             Interop.FontClient.delete_FontDescription(swigCPtr);
34         }
35
36         public FontDescription() : this(Interop.FontClient.new_FontDescription(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39         }
40
41         public string Path
42         {
43             set
44             {
45                 Interop.FontClient.FontDescription_path_set(swigCPtr, value);
46                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
47             }
48             get
49             {
50                 string ret = Interop.FontClient.FontDescription_path_get(swigCPtr);
51                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52                 return ret;
53             }
54         }
55
56         public string Family
57         {
58             set
59             {
60                 Interop.FontClient.FontDescription_family_set(swigCPtr, value);
61                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62             }
63             get
64             {
65                 string ret = Interop.FontClient.FontDescription_family_get(swigCPtr);
66                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67                 return ret;
68             }
69         }
70
71         public FontWidthType Width
72         {
73             set
74             {
75                 Interop.FontClient.FontDescription_width_set(swigCPtr, (int)value);
76                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77             }
78             get
79             {
80                 FontWidthType ret = (FontWidthType)Interop.FontClient.FontDescription_width_get(swigCPtr);
81                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82                 return ret;
83             }
84         }
85
86         public FontWeightType Weight
87         {
88             set
89             {
90                 Interop.FontClient.FontDescription_weight_set(swigCPtr, (int)value);
91                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92             }
93             get
94             {
95                 FontWeightType ret = (FontWeightType)Interop.FontClient.FontDescription_weight_get(swigCPtr);
96                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97                 return ret;
98             }
99         }
100
101         public FontSlantType Slant
102         {
103             set
104             {
105                 Interop.FontClient.FontDescription_slant_set(swigCPtr, (int)value);
106                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107             }
108             get
109             {
110                 FontSlantType ret = (FontSlantType)Interop.FontClient.FontDescription_slant_get(swigCPtr);
111                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112                 return ret;
113             }
114         }
115     }
116 }