sync with devel/master branch
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ObjectRegistry.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 namespace Tizen.NUI
12 {
13
14     using System;
15     using System.Runtime.InteropServices;
16
17
18     internal class ObjectRegistry : BaseHandle
19     {
20         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
21
22         internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ObjectRegistry_SWIGUpcast(cPtr), cMemoryOwn)
23         {
24             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
25         }
26
27         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ObjectRegistry obj)
28         {
29             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
30         }
31
32         protected override void Dispose(DisposeTypes type)
33         {
34             if (disposed)
35             {
36                 return;
37             }
38
39             if (type == DisposeTypes.Explicit)
40             {
41                 //Called by User
42                 //Release your own managed resources here.
43                 //You should release all of your own disposable objects here.
44
45             }
46
47             //Release your own unmanaged resources here.
48             //You should not access any managed member here except static instance.
49             //because the execution order of Finalizes is non-deterministic.
50
51             if (swigCPtr.Handle != global::System.IntPtr.Zero)
52             {
53                 if (swigCMemOwn)
54                 {
55                     swigCMemOwn = false;
56                     NDalicPINVOKE.delete_ObjectRegistry(swigCPtr);
57                 }
58                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
59             }
60
61             base.Dispose(type);
62         }
63
64
65         public class ObjectCreatedEventArgs : EventArgs
66         {
67             private BaseHandle _baseHandle;
68
69             public BaseHandle BaseHandle
70             {
71                 get
72                 {
73                     return _baseHandle;
74                 }
75                 set
76                 {
77                     _baseHandle = value;
78                 }
79             }
80         }
81
82         public class ObjectDestroyedEventArgs : EventArgs
83         {
84             private RefObject _refObject;
85
86             public RefObject RefObject
87             {
88                 get
89                 {
90                     return _refObject;
91                 }
92                 set
93                 {
94                     _refObject = value;
95                 }
96             }
97         }
98
99
100         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
101         private delegate void ObjectCreatedEventCallbackDelegate(IntPtr baseHandle);
102         private DaliEventHandler<object, ObjectCreatedEventArgs> _objectRegistryObjectCreatedEventHandler;
103         private ObjectCreatedEventCallbackDelegate _objectRegistryObjectCreatedEventCallbackDelegate;
104
105         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
106         private delegate void ObjectDestroyedEventCallbackDelegate(IntPtr fefObject);
107         private DaliEventHandler<object, ObjectDestroyedEventArgs> _objectRegistryObjectDestroyedEventHandler;
108         private ObjectDestroyedEventCallbackDelegate _objectRegistryObjectDestroyedEventCallbackDelegate;
109
110         public event DaliEventHandler<object, ObjectCreatedEventArgs> ObjectCreated
111         {
112             add
113             {
114                 lock (this)
115                 {
116                     // Restricted to only one listener
117                     if (_objectRegistryObjectCreatedEventHandler == null)
118                     {
119                         _objectRegistryObjectCreatedEventHandler += value;
120
121                         _objectRegistryObjectCreatedEventCallbackDelegate = new ObjectCreatedEventCallbackDelegate(OnObjectCreated);
122                         this.ObjectCreatedSignal().Connect(_objectRegistryObjectCreatedEventCallbackDelegate);
123                     }
124                 }
125             }
126
127             remove
128             {
129                 lock (this)
130                 {
131                     if (_objectRegistryObjectCreatedEventHandler != null)
132                     {
133                         this.ObjectCreatedSignal().Disconnect(_objectRegistryObjectCreatedEventCallbackDelegate);
134                     }
135
136                     _objectRegistryObjectCreatedEventHandler -= value;
137                 }
138             }
139         }
140
141         // Callback for ObjectRegistry ObjectCreatedSignal
142         private void OnObjectCreated(IntPtr baseHandle)
143         {
144             ObjectCreatedEventArgs e = new ObjectCreatedEventArgs();
145
146             // Populate all members of "e" (ObjectCreatedEventArgs) with real data
147             //e.BaseHandle = BaseHandle.GetBaseHandleFromPtr(baseHandle); //GetBaseHandleFromPtr() is not present in BaseHandle.cs. Not sure what is the reason?
148
149             if (_objectRegistryObjectCreatedEventHandler != null)
150             {
151                 //here we send all data to user event handlers
152                 _objectRegistryObjectCreatedEventHandler(this, e);
153             }
154         }
155
156         public event DaliEventHandler<object, ObjectDestroyedEventArgs> ObjectDestroyed
157         {
158             add
159             {
160                 lock (this)
161                 {
162                     // Restricted to only one listener
163                     if (_objectRegistryObjectDestroyedEventHandler == null)
164                     {
165                         _objectRegistryObjectDestroyedEventHandler += value;
166
167                         _objectRegistryObjectDestroyedEventCallbackDelegate = new ObjectDestroyedEventCallbackDelegate(OnObjectDestroyed);
168                         this.ObjectDestroyedSignal().Connect(_objectRegistryObjectDestroyedEventCallbackDelegate);
169                     }
170                 }
171             }
172
173             remove
174             {
175                 lock (this)
176                 {
177                     if (_objectRegistryObjectDestroyedEventHandler != null)
178                     {
179                         this.ObjectDestroyedSignal().Disconnect(_objectRegistryObjectDestroyedEventCallbackDelegate);
180                     }
181
182                     _objectRegistryObjectDestroyedEventHandler -= value;
183                 }
184             }
185         }
186
187         // Callback for ObjectRegistry ObjectDestroyedSignal
188         private void OnObjectDestroyed(IntPtr refObject)
189         {
190             ObjectDestroyedEventArgs e = new ObjectDestroyedEventArgs();
191
192             // Populate all members of "e" (ObjectDestroyedEventArgs) with real data
193             e.RefObject = RefObject.GetRefObjectFromPtr(refObject);
194
195             if (_objectRegistryObjectDestroyedEventHandler != null)
196             {
197                 //here we send all data to user event handlers
198                 _objectRegistryObjectDestroyedEventHandler(this, e);
199             }
200         }
201
202
203         public ObjectRegistry() : this(NDalicPINVOKE.new_ObjectRegistry__SWIG_0(), true)
204         {
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206         }
207
208         public ObjectRegistry(ObjectRegistry handle) : this(NDalicPINVOKE.new_ObjectRegistry__SWIG_1(ObjectRegistry.getCPtr(handle)), true)
209         {
210             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211         }
212
213         public ObjectRegistry Assign(ObjectRegistry rhs)
214         {
215             ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.ObjectRegistry_Assign(swigCPtr, ObjectRegistry.getCPtr(rhs)), false);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220         public ObjectCreatedSignal ObjectCreatedSignal()
221         {
222             ObjectCreatedSignal ret = new ObjectCreatedSignal(NDalicPINVOKE.ObjectRegistry_ObjectCreatedSignal(swigCPtr), false);
223             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224             return ret;
225         }
226
227         public ObjectDestroyedSignal ObjectDestroyedSignal()
228         {
229             ObjectDestroyedSignal ret = new ObjectDestroyedSignal(NDalicPINVOKE.ObjectRegistry_ObjectDestroyedSignal(swigCPtr), false);
230             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231             return ret;
232         }
233
234     }
235
236 }