Merge "Resource ready signal for Controls (for ImageLoading)" into devel/master
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / sharp / internal / ObjectRegistry.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.10
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 Dali {
12
13 using System;
14 using System.Runtime.InteropServices;
15
16
17 public class ObjectRegistry : BaseHandle {
18   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
19
20   internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ObjectRegistry_SWIGUpcast(cPtr), cMemoryOwn) {
21     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
22   }
23
24   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ObjectRegistry obj) {
25     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
26   }
27
28   ~ObjectRegistry() {
29     DisposeQueue.Instance.Add(this);
30   }
31
32   public override void Dispose() {
33     if (!Stage.IsInstalled()) {
34       DisposeQueue.Instance.Add(this);
35       return;
36     }
37
38     lock(this) {
39       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
40         if (swigCMemOwn) {
41           swigCMemOwn = false;
42           NDalicPINVOKE.delete_ObjectRegistry(swigCPtr);
43         }
44         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
45       }
46       global::System.GC.SuppressFinalize(this);
47       base.Dispose();
48     }
49   }
50
51
52
53
54 public class ObjectCreatedEventArgs : EventArgs
55 {
56    private BaseHandle _baseHandle;
57
58    public BaseHandle BaseHandle
59    {
60       get
61       {
62          return _baseHandle;
63       }
64       set
65       {
66          _baseHandle = value;
67       }
68    }
69 }
70
71 public class ObjectDestroyedEventArgs : EventArgs
72 {
73    private RefObject _refObject;
74
75    public RefObject RefObject
76    {
77       get
78       {
79          return _refObject;
80       }
81       set
82       {
83          _refObject = value;
84       }
85    }
86 }
87
88
89   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
90   private delegate void ObjectCreatedEventCallbackDelegate(IntPtr baseHandle);
91   private DaliEventHandler<object,ObjectCreatedEventArgs> _objectRegistryObjectCreatedEventHandler;
92   private ObjectCreatedEventCallbackDelegate _objectRegistryObjectCreatedEventCallbackDelegate;
93
94   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
95   private delegate void ObjectDestroyedEventCallbackDelegate(IntPtr fefObject);
96   private DaliEventHandler<object,ObjectDestroyedEventArgs> _objectRegistryObjectDestroyedEventHandler;
97   private ObjectDestroyedEventCallbackDelegate _objectRegistryObjectDestroyedEventCallbackDelegate;
98
99   public event DaliEventHandler<object,ObjectCreatedEventArgs> ObjectCreated
100   {
101      add
102      {
103         lock(this)
104         {
105            // Restricted to only one listener
106            if (_objectRegistryObjectCreatedEventHandler == null)
107            {
108               _objectRegistryObjectCreatedEventHandler += value;
109
110               _objectRegistryObjectCreatedEventCallbackDelegate = new ObjectCreatedEventCallbackDelegate(OnObjectCreated);
111               this.ObjectCreatedSignal().Connect(_objectRegistryObjectCreatedEventCallbackDelegate);
112            }
113         }
114      }
115
116      remove
117      {
118         lock(this)
119         {
120            if (_objectRegistryObjectCreatedEventHandler != null)
121            {
122               this.ObjectCreatedSignal().Disconnect(_objectRegistryObjectCreatedEventCallbackDelegate);
123            }
124
125            _objectRegistryObjectCreatedEventHandler -= value;
126         }
127      }
128   }
129
130   // Callback for ObjectRegistry ObjectCreatedSignal
131   private void OnObjectCreated(IntPtr baseHandle)
132   {
133      ObjectCreatedEventArgs e = new ObjectCreatedEventArgs();
134
135      // Populate all members of "e" (ObjectCreatedEventArgs) with real data
136      //e.BaseHandle = BaseHandle.GetBaseHandleFromPtr(baseHandle); //GetBaseHandleFromPtr() is not present in BaseHandle.cs. Not sure what is the reason?
137
138      if (_objectRegistryObjectCreatedEventHandler != null)
139      {
140         //here we send all data to user event handlers
141         _objectRegistryObjectCreatedEventHandler(this, e);
142      }
143   }
144
145   public event DaliEventHandler<object,ObjectDestroyedEventArgs> ObjectDestroyed
146   {
147      add
148      {
149         lock(this)
150         {
151            // Restricted to only one listener
152            if (_objectRegistryObjectDestroyedEventHandler == null)
153            {
154               _objectRegistryObjectDestroyedEventHandler += value;
155
156               _objectRegistryObjectDestroyedEventCallbackDelegate = new ObjectDestroyedEventCallbackDelegate(OnObjectDestroyed);
157               this.ObjectDestroyedSignal().Connect(_objectRegistryObjectDestroyedEventCallbackDelegate);
158            }
159         }
160      }
161
162      remove
163      {
164         lock(this)
165         {
166            if (_objectRegistryObjectDestroyedEventHandler != null)
167            {
168               this.ObjectDestroyedSignal().Disconnect(_objectRegistryObjectDestroyedEventCallbackDelegate);
169            }
170
171            _objectRegistryObjectDestroyedEventHandler -= value;
172         }
173      }
174   }
175
176   // Callback for ObjectRegistry ObjectDestroyedSignal
177   private void OnObjectDestroyed(IntPtr refObject)
178   {
179      ObjectDestroyedEventArgs e = new ObjectDestroyedEventArgs();
180
181      // Populate all members of "e" (ObjectDestroyedEventArgs) with real data
182      e.RefObject = RefObject.GetRefObjectFromPtr(refObject);
183
184      if (_objectRegistryObjectDestroyedEventHandler != null)
185      {
186         //here we send all data to user event handlers
187         _objectRegistryObjectDestroyedEventHandler(this, e);
188      }
189   }
190
191
192   public ObjectRegistry() : this(NDalicPINVOKE.new_ObjectRegistry__SWIG_0(), true) {
193     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194   }
195
196   public ObjectRegistry(ObjectRegistry handle) : this(NDalicPINVOKE.new_ObjectRegistry__SWIG_1(ObjectRegistry.getCPtr(handle)), true) {
197     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198   }
199
200   public ObjectRegistry Assign(ObjectRegistry rhs) {
201     ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.ObjectRegistry_Assign(swigCPtr, ObjectRegistry.getCPtr(rhs)), false);
202     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203     return ret;
204   }
205
206   public ObjectCreatedSignal ObjectCreatedSignal() {
207     ObjectCreatedSignal ret = new ObjectCreatedSignal(NDalicPINVOKE.ObjectRegistry_ObjectCreatedSignal(swigCPtr), false);
208     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209     return ret;
210   }
211
212   public ObjectDestroyedSignal ObjectDestroyedSignal() {
213     ObjectDestroyedSignal ret = new ObjectDestroyedSignal(NDalicPINVOKE.ObjectRegistry_ObjectDestroyedSignal(swigCPtr), false);
214     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215     return ret;
216   }
217
218 }
219
220 }