2 * Copyright (c) 2017 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.
21 /// WebViewLiteSignal.
23 internal class WebViewLiteSignal : global::System.IDisposable {
24 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29 protected bool swigCMemOwn;
31 internal WebViewLiteSignal(global::System.IntPtr cPtr, bool cMemoryOwn) {
32 swigCMemOwn = cMemoryOwn;
33 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebViewLiteSignal obj) {
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
40 //A Flag to check who called Dispose(). (By User or DisposeQueue)
41 private bool isDisposeQueued = false;
44 /// A Flat to check if it is already disposed.
46 protected bool disposed = false;
55 isDisposeQueued = true;
56 DisposeQueue.Instance.Add(this);
65 //Throw excpetion if Dispose() is called in separate thread.
66 if (!Window.IsInstalled())
68 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
73 Dispose(DisposeTypes.Implicit);
77 Dispose(DisposeTypes.Explicit);
78 System.GC.SuppressFinalize(this);
83 /// you can override it to clean-up your own resources.
85 /// <param name="type">DisposeTypes</param>
86 /// <since_tizen> 3 </since_tizen>
87 protected virtual void Dispose(DisposeTypes type)
94 if (type == DisposeTypes.Explicit)
97 //Release your own managed resources here.
98 //You should release all of your own disposable objects here.
102 //Release your own unmanaged resources here.
103 //You should not access any managed member here except static instance.
104 //because the execution order of Finalizes is non-deterministic.
106 if (swigCPtr.Handle != global::System.IntPtr.Zero)
111 NDalicPINVOKE.delete_WebViewLiteSignal(swigCPtr);
113 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
123 /// <returns>true if there is no signal attached</returns>
124 public bool Empty() {
125 bool ret = NDalicPINVOKE.WebViewLiteSignal_Empty(swigCPtr);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 /// GetConnectionCount
133 /// <returns>number of attached signals</returns>
134 public uint GetConnectionCount() {
135 uint ret = NDalicPINVOKE.WebViewLiteSignal_GetConnectionCount(swigCPtr);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 /// <param name="func"></param>
144 public void Connect(System.Delegate func) {
145 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
147 NDalicPINVOKE.WebViewLiteSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 /// signal disconnect
155 /// <param name="func"></param>
156 public void Disconnect(System.Delegate func) {
157 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
159 NDalicPINVOKE.WebViewLiteSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 public void Emit(WebViewLite arg) {
168 NDalicPINVOKE.WebViewLiteSignal_Emit(swigCPtr, WebViewLite.getCPtr(arg));
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 /// WebViewLiteSignal
175 public WebViewLiteSignal() : this(NDalicPINVOKE.new_WebViewLiteSignal(), true) {
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();