merging dali-sharp class scope with nui
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ItemFactory.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 //#define DOT_NET_CORE
12 #if (DOT_NET_CORE)
13 using System.Reflection;
14 #endif
15
16 namespace Tizen.NUI
17 {
18     using Tizen.NUI.BaseComponents;
19     internal class ItemFactory : global::System.IDisposable
20     {
21         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
22         protected bool swigCMemOwn;
23
24         internal ItemFactory(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(ItemFactory obj)
31         {
32             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33         }
34
35         //A Flag to check who called Dispose(). (By User or DisposeQueue)
36         private bool isDisposeQueued = false;
37         //A Flat to check if it is already disposed.
38         protected bool disposed = false;
39
40
41         ~ItemFactory()
42         {
43             if (!isDisposeQueued)
44             {
45                 isDisposeQueued = true;
46                 DisposeQueue.Instance.Add(this);
47             }
48         }
49
50         public void Dispose()
51         {
52             //Throw excpetion if Dispose() is called in separate thread.
53             if (!Window.IsInstalled())
54             {
55                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
56             }
57
58             if (isDisposeQueued)
59             {
60                 Dispose(DisposeTypes.Implicit);
61             }
62             else
63             {
64                 Dispose(DisposeTypes.Explicit);
65                 System.GC.SuppressFinalize(this);
66             }
67         }
68
69         protected virtual void Dispose(DisposeTypes type)
70         {
71             if (disposed)
72             {
73                 return;
74             }
75
76             if (type == DisposeTypes.Explicit)
77             {
78                 //Called by User
79                 //Release your own managed resources here.
80                 //You should release all of your own disposable objects here.
81
82             }
83
84             //Release your own unmanaged resources here.
85             //You should not access any managed member here except static instance.
86             //because the execution order of Finalizes is non-deterministic.
87
88             if (swigCPtr.Handle != global::System.IntPtr.Zero)
89             {
90                 if (swigCMemOwn)
91                 {
92                     swigCMemOwn = false;
93                     NDalicPINVOKE.delete_ItemFactory(swigCPtr);
94                 }
95                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
96             }
97
98             disposed = true;
99         }
100
101         public virtual uint GetNumberOfItems()
102         {
103             uint ret = NDalicPINVOKE.ItemFactory_GetNumberOfItems(swigCPtr);
104             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105             return ret;
106         }
107
108         public virtual View NewItem(uint itemId)
109         {
110             View ret = new View(NDalicPINVOKE.ItemFactory_NewItem(swigCPtr, itemId), true);
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112             return ret;
113         }
114
115         public virtual void ItemReleased(uint itemId, View view)
116         {
117             if (SwigDerivedClassHasMethod("ItemReleased", swigMethodTypes2)) NDalicPINVOKE.ItemFactory_ItemReleasedSwigExplicitItemFactory(swigCPtr, itemId, View.getCPtr(view)); else NDalicPINVOKE.ItemFactory_ItemReleased(swigCPtr, itemId, View.getCPtr(view));
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119         }
120
121         public ItemFactory() : this(NDalicPINVOKE.new_ItemFactory(), true)
122         {
123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124             SwigDirectorConnect();
125         }
126
127         private void SwigDirectorConnect()
128         {
129             if (SwigDerivedClassHasMethod("GetNumberOfItems", swigMethodTypes0))
130                 swigDelegate0 = new SwigDelegateItemFactory_0(SwigDirectorGetNumberOfItems);
131             if (SwigDerivedClassHasMethod("NewItem", swigMethodTypes1))
132                 swigDelegate1 = new SwigDelegateItemFactory_1(SwigDirectorNewItem);
133             if (SwigDerivedClassHasMethod("ItemReleased", swigMethodTypes2))
134                 swigDelegate2 = new SwigDelegateItemFactory_2(SwigDirectorItemReleased);
135             NDalicPINVOKE.ItemFactory_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2);
136         }
137
138 #if (DOT_NET_CORE)
139         private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes)
140         {
141             global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes);
142             bool hasDerivedMethod = this.GetType().GetTypeInfo().IsSubclassOf(typeof(ItemFactory));
143 #if DEBUG_ON
144             Tizen.Log.Debug("NUI-APP", "hasDerivedMethod=" + hasDerivedMethod);
145 #endif
146             return hasDerivedMethod && (methodInfo != null);
147         }
148 #else
149         private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes)
150         {
151             global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);
152             bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ItemFactory));
153             return hasDerivedMethod;
154         }
155 #endif
156
157         private uint SwigDirectorGetNumberOfItems()
158         {
159             return GetNumberOfItems();
160         }
161
162         private global::System.IntPtr SwigDirectorNewItem(uint itemId)
163         {
164             return View.getCPtr(NewItem(itemId)).Handle;
165         }
166
167         private void SwigDirectorItemReleased(uint itemId, global::System.IntPtr actor)
168         {
169             ItemReleased(itemId, new View(actor, true));
170         }
171
172         public delegate uint SwigDelegateItemFactory_0();
173         public delegate global::System.IntPtr SwigDelegateItemFactory_1(uint itemId);
174         public delegate void SwigDelegateItemFactory_2(uint itemId, global::System.IntPtr actor);
175
176         private SwigDelegateItemFactory_0 swigDelegate0;
177         private SwigDelegateItemFactory_1 swigDelegate1;
178         private SwigDelegateItemFactory_2 swigDelegate2;
179
180         private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { };
181         private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(uint) };
182         private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] { typeof(uint), typeof(View) };
183     }
184
185 }