2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
23 //Please do not use! this will be internal
25 /// Abstract Interface used by a slot to inform a signal it is disconnecting.<br />
26 /// This is used by the slot if wants to disconnect or is deleted.<br />
28 /// <since_tizen> 4 </since_tizen>
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class SlotObserver : global::System.IDisposable
32 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 /// <summary>swigCMemOwn.</summary>
34 /// <since_tizen> 4 </since_tizen>
35 protected bool swigCMemOwn;
37 internal SlotObserver(global::System.IntPtr cPtr, bool cMemoryOwn)
39 swigCMemOwn = cMemoryOwn;
40 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
43 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SlotObserver obj)
45 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48 //A Flag to check who called Dispose(). (By User or DisposeQueue)
49 private bool isDisposeQueued = false;
51 /// A Flat to check if it is already disposed.
53 /// <since_tizen> 4 </since_tizen>
54 protected bool disposed = false;
59 /// <since_tizen> 3 </since_tizen>
64 isDisposeQueued = true;
65 DisposeQueue.Instance.Add(this);
72 /// <since_tizen> 4 </since_tizen>
75 //Throw excpetion if Dispose() is called in separate thread.
76 if (!Window.IsInstalled())
78 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
83 Dispose(DisposeTypes.Implicit);
87 Dispose(DisposeTypes.Explicit);
88 System.GC.SuppressFinalize(this);
95 /// <since_tizen> 4 </since_tizen>
96 protected virtual void Dispose(DisposeTypes type)
103 if (type == DisposeTypes.Explicit)
106 //Release your own managed resources here.
107 //You should release all of your own disposable objects here.
111 //Release your own unmanaged resources here.
112 //You should not access any managed member here except static instance.
113 //because the execution order of Finalizes is non-deterministic.
115 if (swigCPtr.Handle != global::System.IntPtr.Zero)
120 NDalicPINVOKE.delete_SlotObserver(swigCPtr);
122 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
129 /// This method is called when the slot is disconnecting.
131 /// <param name="callback">The callback attached to the signal disconnected.</param>
132 /// <since_tizen> 4 </since_tizen>
133 public virtual void SlotDisconnected(SWIGTYPE_p_Dali__CallbackBase callback)
135 NDalicPINVOKE.SlotObserver_SlotDisconnected(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();