[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / WidgetViewSignal.cs
1 /*
2  * Copyright(c) 2019 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     /// WidgetViewSignal
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     [Obsolete("Deprecated in API6, Will be removed in API9, " + 
28         "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
29     [EditorBrowsable(EditorBrowsableState.Never)]
30     public class WidgetViewSignal : Disposable
31     {
32
33         internal WidgetViewSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
34         {
35         }
36
37         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetViewSignal obj)
38         {
39             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
40         }
41
42         /// This will not be public opened.
43         [EditorBrowsable(EditorBrowsableState.Never)]
44         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
45         {
46             Interop.WidgetView.delete_WidgetViewSignal(swigCPtr);
47         }
48
49         /// <summary>
50         /// Queries whether there are any connected slots.
51         /// </summary>
52         /// <returns>True if there are any slots connected to the signal</returns>
53         /// <since_tizen> 3 </since_tizen>
54         [Obsolete("Deprecated in API6, Will be removed in API9, " + 
55             "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
56         [EditorBrowsable(EditorBrowsableState.Never)]
57         public bool Empty()
58         {
59             bool ret = Interop.WidgetView.WidgetViewSignal_Empty(swigCPtr);
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61             return ret;
62         }
63
64         /// <summary>
65         /// Queries the number of slots.
66         /// </summary>
67         /// <returns>The number of slots connected to this signal</returns>
68         /// <since_tizen> 3 </since_tizen>
69         [Obsolete("Deprecated in API6, Will be removed in API9, " + 
70             "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
71         [EditorBrowsable(EditorBrowsableState.Never)]
72         public uint GetConnectionCount()
73         {
74             uint ret = Interop.WidgetView.WidgetViewSignal_GetConnectionCount(swigCPtr);
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76             return ret;
77         }
78
79         /// <summary>
80         /// Connects a function.
81         /// </summary>
82         /// <param name="func">The function to connect</param>
83         /// <since_tizen> 3 </since_tizen>
84         [Obsolete("Deprecated in API6, Will be removed in API9, " + 
85             "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
86         [EditorBrowsable(EditorBrowsableState.Never)]
87         public void Connect(System.Delegate func)
88         {
89             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
90             {
91                 Interop.WidgetView.WidgetViewSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
92                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93             }
94         }
95
96         /// <summary>
97         /// Disconnects a function.
98         /// </summary>
99         /// <param name="func">The function to disconnect</param>
100         /// <since_tizen> 3 </since_tizen>
101         [Obsolete("Deprecated in API6, Will be removed in API9, " + 
102             "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
103         [EditorBrowsable(EditorBrowsableState.Never)]
104         public void Disconnect(System.Delegate func)
105         {
106             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
107             {
108                 Interop.WidgetView.WidgetViewSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
109                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110             }
111         }
112
113         /// <summary>
114         /// Connects a member function.
115         /// </summary>
116         /// <param name="arg">The member function to connect</param>
117         /// <since_tizen> 3 </since_tizen>
118         [Obsolete("Deprecated in API6, Will be removed in API9, " + 
119             "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
120         [EditorBrowsable(EditorBrowsableState.Never)]
121         public void Emit(WidgetView arg)
122         {
123             Interop.WidgetView.WidgetViewSignal_Emit(swigCPtr, WidgetView.getCPtr(arg));
124             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125         }
126
127         /// <summary>
128         /// The contructor.
129         /// </summary>
130         /// <since_tizen> 3 </since_tizen>
131         [Obsolete("Deprecated in API6, Will be removed in API9, " + 
132             "Please use WidgetView.WidgetAdded, WidgetDeleted events instead!")]
133         [EditorBrowsable(EditorBrowsableState.Never)]
134         public WidgetViewSignal() : this(Interop.WidgetView.new_WidgetViewSignal(), true)
135         {
136             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137         }
138     }
139 }