2 * Copyright(c) 2020 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.
19 using System.ComponentModel;
24 /// Signal connection class for PropertyNotification
26 internal class PropertyNotifySignal : Disposable
31 internal PropertyNotifySignal() : this(Interop.PropertyNotifySignal.NewPropertyNotifySignal(), true)
33 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36 internal PropertyNotifySignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
41 /// Queries whether there are any connected slots.
43 /// <returns>True if there are any slots connected to the signal.</returns>
46 bool ret = Interop.PropertyNotifySignal.Empty(SwigCPtr);
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52 /// Queries the number of slots.
54 /// <returns>The number of slots connected to this signal</returns>
55 internal uint GetConnectionCount()
57 uint ret = Interop.PropertyNotifySignal.GetConnectionCount(SwigCPtr);
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// Connects a function.
65 /// <param name="func">The function to connect</param>
66 internal void Connect(System.Delegate func)
68 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
70 Interop.PropertyNotifySignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 /// Disconnects a function.
78 /// <param name="func">The function to disconnect.</param>
79 internal void Disconnect(System.Delegate func)
81 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
83 Interop.PropertyNotifySignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 /// Emits a signal with 1 parameter.
91 /// <param name="arg">The first value to pass to callbacks.</param>
92 internal void Emit(PropertyNotification arg)
94 Interop.PropertyNotifySignal.Emit(SwigCPtr, PropertyNotification.getCPtr(arg));
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// This will not be public opened.
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
102 Interop.PropertyNotifySignal.DeletePropertyNotifySignal(swigCPtr);