808d51431ef7beb813bc6b853f7460c79e72d2e0
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / TypeInfo.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 using System.ComponentModel;
18
19 namespace Tizen.NUI
20 {
21
22     /// <summary>
23     /// TypeInfo class for instantiation of registered types and introspection of their actions and signals.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class TypeInfo : BaseHandle
27     {
28
29         /// <summary>
30         /// Creates TypeInfo object.
31         /// </summary>
32         /// <since_tizen> 3 </since_tizen>
33         public TypeInfo() : this(Interop.TypeInfo.NewTypeInfo(), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         /// <summary>
39         /// Creates TypeInfo object.
40         /// </summary>
41         /// <param name="handle">This copy constructor is required for (smart) pointer semantics.</param>
42         /// <since_tizen> 3 </since_tizen>
43         public TypeInfo(TypeInfo handle) : this(Interop.TypeInfo.NewTypeInfo(TypeInfo.getCPtr(handle)), true, false)
44         {
45             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46         }
47
48         internal TypeInfo(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
49         {
50         }
51
52         internal TypeInfo(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
53         {
54         }
55
56         /// <summary>
57         /// Retrieves the type name for this type.
58         /// </summary>
59         /// <returns>The string name.</returns>
60         /// <since_tizen> 3 </since_tizen>
61         public string GetName()
62         {
63             string ret = Interop.TypeInfo.GetName(SwigCPtr);
64             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
65             return ret;
66         }
67
68         /// <summary>
69         /// Retrieves the type name for this type.
70         /// </summary>
71         /// <returns>The string name.</returns>
72         /// <since_tizen> 3 </since_tizen>
73         public string GetBaseName()
74         {
75             string ret = Interop.TypeInfo.GetBaseName(SwigCPtr);
76             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77             return ret;
78         }
79
80         /// <summary>
81         /// Creates an object from this type.
82         /// </summary>
83         /// <returns>The BaseHandle for the newly created object.</returns>
84         /// <since_tizen> 3 </since_tizen>
85         public BaseHandle CreateInstance()
86         {
87             BaseHandle ret = new BaseHandle(Interop.TypeInfo.CreateInstance(SwigCPtr), true);
88             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89             return ret;
90         }
91
92         /// <summary>
93         /// Retrieves the number of event side type registered properties for this type.<br />
94         /// This count does not include all properties.
95         /// </summary>
96         /// <returns>The count.</returns>
97         /// <since_tizen> 3 </since_tizen>
98         public uint GetPropertyCount()
99         {
100             uint ret = Interop.TypeInfo.GetPropertyCount(SwigCPtr);
101             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102             return ret;
103         }
104
105         /// <summary>
106         /// Given a property index, retrieve the property name associated with it.
107         /// </summary>
108         /// <param name="index">The property index.</param>
109         /// <returns>The name of the property at the given index.</returns>
110         /// <since_tizen> 3 </since_tizen>
111         public string GetPropertyName(int index)
112         {
113             string ret = Interop.TypeInfo.GetPropertyName(SwigCPtr, index);
114             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115             return ret;
116         }
117
118         /// This will not be public opened.
119         [EditorBrowsable(EditorBrowsableState.Never)]
120         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
121         {
122             Interop.TypeInfo.DeleteTypeInfo(swigCPtr);
123         }
124     }
125 }