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