[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / KeyInputFocusSignal.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 Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI
21 {
22     internal class KeyInputFocusSignal : Disposable
23     {
24
25         internal KeyInputFocusSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
26         {
27         }
28
29         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyInputFocusSignal obj)
30         {
31             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
32         }
33
34         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
35         {
36             Interop.KeyInputFocusManager.delete_KeyInputFocusSignal(swigCPtr);
37         }
38
39         public bool Empty()
40         {
41             bool ret = Interop.KeyInputFocusManager.KeyInputFocusSignal_Empty(swigCPtr);
42             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
43             return ret;
44         }
45
46         public uint GetConnectionCount()
47         {
48             uint ret = Interop.KeyInputFocusManager.KeyInputFocusSignal_GetConnectionCount(swigCPtr);
49             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50             return ret;
51         }
52
53         public void Connect(System.Delegate func)
54         {
55             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
56             {
57                 Interop.KeyInputFocusManager.KeyInputFocusSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
58                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
59             }
60         }
61
62         public void Disconnect(System.Delegate func)
63         {
64             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
65             {
66                 Interop.KeyInputFocusManager.KeyInputFocusSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
67                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68             }
69         }
70
71         public void Emit(View arg)
72         {
73             Interop.KeyInputFocusManager.KeyInputFocusSignal_Emit(swigCPtr, View.getCPtr(arg));
74             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
75         }
76
77         public KeyInputFocusSignal() : this(Interop.KeyInputFocusManager.new_KeyInputFocusSignal(), true)
78         {
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80         }
81     }
82 }