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.
18 using Tizen.NUI.BaseComponents;
25 internal delegate IntPtr SwigDelegatePreFocusChangeSignal(IntPtr current, IntPtr proposed, View.FocusDirection direction);
27 internal class PreFocusChangeSignal : global::System.IDisposable
29 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 protected bool swigCMemOwn;
32 internal PreFocusChangeSignal(global::System.IntPtr cPtr, bool cMemoryOwn)
34 swigCMemOwn = cMemoryOwn;
35 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PreFocusChangeSignal obj)
40 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43 //A Flag to check who called Dispose(). (By User or DisposeQueue)
44 private bool isDisposeQueued = false;
45 //A Flat to check if it is already disposed.
46 protected bool disposed = false;
49 ~PreFocusChangeSignal()
53 isDisposeQueued = true;
54 DisposeQueue.Instance.Add(this);
60 //Throw excpetion if Dispose() is called in separate thread.
61 if (!Window.IsInstalled())
63 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
68 Dispose(DisposeTypes.Implicit);
72 Dispose(DisposeTypes.Explicit);
73 System.GC.SuppressFinalize(this);
77 protected virtual void Dispose(DisposeTypes type)
84 if (type == DisposeTypes.Explicit)
87 //Release your own managed resources here.
88 //You should release all of your own disposable objects here.
92 //Release your own unmanaged resources here.
93 //You should not access any managed member here except static instance.
94 //because the execution order of Finalizes is non-deterministic.
96 if (swigCPtr.Handle != global::System.IntPtr.Zero)
101 NDalicManualPINVOKE.delete_PreFocusChangeSignal(swigCPtr);
103 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
111 bool ret = NDalicManualPINVOKE.PreFocusChangeSignal_Empty(swigCPtr);
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 public uint GetConnectionCount()
118 uint ret = NDalicManualPINVOKE.PreFocusChangeSignal_GetConnectionCount(swigCPtr);
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 public void Connect(FocusManager.PreFocusChangeEventCallback func)
125 NDalicManualPINVOKE.PreFocusChangeSignal_Connect(swigCPtr, func);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 public void Disconnect(System.Delegate func)
131 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
133 NDalicManualPINVOKE.PreFocusChangeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
134 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138 public View Emit(View arg1, View arg2, View.FocusDirection arg3)
140 View ret = new View(NDalicManualPINVOKE.PreFocusChangeSignal_Emit(swigCPtr, View.getCPtr(arg1), View.getCPtr(arg2), (int)arg3), true);
141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145 public PreFocusChangeSignal() : this(NDalicManualPINVOKE.new_PreFocusChangeSignal(), true)
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();