[NUI] Remove APIs which have been deprecated in API7
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / PropertyNotifySignal.cs
1 /*
2  * Copyright(c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     ///<summary>
24     /// Signal connection class for PropertyNotification
25     ///</summary>
26     internal class PropertyNotifySignal : Disposable
27     {
28         /// <summary>
29         /// The constructor.
30         /// </summary>
31         internal PropertyNotifySignal() : this(Interop.PropertyNotifySignal.NewPropertyNotifySignal(), true)
32         {
33             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
34         }
35
36         internal PropertyNotifySignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
37         {
38         }
39
40         /// <summary>
41         /// Queries whether there are any connected slots.
42         /// </summary>
43         /// <returns>True if there are any slots connected to the signal.</returns>
44         internal bool Empty()
45         {
46             bool ret = Interop.PropertyNotifySignal.Empty(SwigCPtr);
47             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
48             return ret;
49         }
50
51         /// <summary>
52         /// Queries the number of slots.
53         /// </summary>
54         /// <returns>The number of slots connected to this signal</returns>
55         internal uint GetConnectionCount()
56         {
57             uint ret = Interop.PropertyNotifySignal.GetConnectionCount(SwigCPtr);
58             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
59             return ret;
60         }
61
62         /// <summary>
63         /// Connects a function.
64         /// </summary>
65         /// <param name="func">The function to connect</param>
66         internal void Connect(System.Delegate func)
67         {
68             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
69             {
70                 Interop.PropertyNotifySignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
71                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72             }
73         }
74
75         /// <summary>
76         /// Disconnects a function.
77         /// </summary>
78         /// <param name="func">The function to disconnect.</param>
79         internal void Disconnect(System.Delegate func)
80         {
81             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
82             {
83                 Interop.PropertyNotifySignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
84                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85             }
86         }
87
88         /// <summary>
89         /// Emits a signal with 1 parameter.
90         /// </summary>
91         /// <param name="arg">The first value to pass to callbacks.</param>
92         internal void Emit(PropertyNotification arg)
93         {
94             Interop.PropertyNotifySignal.Emit(SwigCPtr, PropertyNotification.getCPtr(arg));
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96         }
97
98         /// This will not be public opened.
99         [EditorBrowsable(EditorBrowsableState.Never)]
100         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
101         {
102             Interop.PropertyNotifySignal.DeletePropertyNotifySignal(swigCPtr);
103         }
104     }
105 }