From 4b35f3206e91da1679c600687ba9c753498db73f Mon Sep 17 00:00:00 2001 From: "xb.teng" Date: Mon, 16 Oct 2017 21:18:07 +0800 Subject: [PATCH] [4.0] Update LanguageChangedSignal and KeyboardResizedSignal for ImfManager Change-Id: I09088a477e803dcc8549329efcfb57bf6bef139e --- .../src/internal/KeyboardResizedSignalType.cs | 188 +++++++++++++++++++++ .../src/internal/LanguageChangedSignalType.cs | 187 ++++++++++++++++++++ src/Tizen.NUI/src/internal/ManualPINVOKE.cs | 42 +++++ src/Tizen.NUI/src/public/ImfManager.cs | 64 +++++-- 4 files changed, 467 insertions(+), 14 deletions(-) create mode 100755 src/Tizen.NUI/src/internal/KeyboardResizedSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/LanguageChangedSignalType.cs diff --git a/src/Tizen.NUI/src/internal/KeyboardResizedSignalType.cs b/src/Tizen.NUI/src/internal/KeyboardResizedSignalType.cs new file mode 100755 index 0000000..77b2b37 --- /dev/null +++ b/src/Tizen.NUI/src/internal/KeyboardResizedSignalType.cs @@ -0,0 +1,188 @@ +/* + * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Tizen.NUI +{ + /// + /// Please do not use! this will be deprecated + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class KeyboardResizedSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal KeyboardResizedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardResizedSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + /// + /// A Flat to check if it is already disposed. + /// + /// 3 + protected bool disposed = false; + + /// + /// Dispose + /// + ~KeyboardResizedSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// Dispose + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + /// + /// Dispose + /// + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_KeyboardResizedSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + /// + /// Queries whether there are any connected slots. + /// + /// True if there are any slots connected to the signal + public bool Empty() + { + bool ret = NDalicManualPINVOKE.KeyboardResizedSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Queries the number of slots. + /// + /// The number of slots connected to this signal + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.KeyboardResizedSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Connects a function. + /// + /// The function to connect + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.KeyboardResizedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Disconnects a function. + /// + /// The function to disconnect + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.KeyboardResizedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Connects a member function. + /// + /// The member function to connect + public void Emit(int arg) + { + NDalicManualPINVOKE.KeyboardResizedSignalType_Emit(swigCPtr, arg); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The contructor. + /// + public KeyboardResizedSignalType() : this(NDalicManualPINVOKE.new_KeyboardResizedSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/LanguageChangedSignalType.cs b/src/Tizen.NUI/src/internal/LanguageChangedSignalType.cs new file mode 100755 index 0000000..37d9961 --- /dev/null +++ b/src/Tizen.NUI/src/internal/LanguageChangedSignalType.cs @@ -0,0 +1,187 @@ +/* + * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Tizen.NUI +{ + /// + /// Please do not use! this will be deprecated + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class LanguageChangedSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal LanguageChangedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LanguageChangedSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + /// + /// A Flat to check if it is already disposed. + /// + /// 3 + protected bool disposed = false; + + /// + /// Dispose + /// + ~LanguageChangedSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// Dispose + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + /// + /// Dispose + /// + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_LanguageChangedSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + /// + /// Queries whether there are any connected slots. + /// + /// True if there are any slots connected to the signal + public bool Empty() + { + bool ret = NDalicManualPINVOKE.LanguageChangedSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Queries the number of slots. + /// + /// The number of slots connected to this signal + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.LanguageChangedSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Connects a member function. + /// + /// The member function to connect + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.LanguageChangedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Disconnects a function. + /// + /// The function to disconnect + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.LanguageChangedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Emits the signal. + /// + public void Emit(int arg) + { + NDalicManualPINVOKE.LanguageChangedSignalType_Emit(swigCPtr, arg); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The contructor. + /// + public LanguageChangedSignalType() : this(NDalicManualPINVOKE.new_LanguageChangedSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index aff59c8..b590137 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -577,6 +577,48 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyboardTypeSignalType")] public static extern void delete_KeyboardTypeSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LanguageChangedSignalType_Empty")] + public static extern bool LanguageChangedSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LanguageChangedSignalType_GetConnectionCount")] + public static extern uint LanguageChangedSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LanguageChangedSignalType_Connect")] + public static extern void LanguageChangedSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LanguageChangedSignalType_Disconnect")] + public static extern void LanguageChangedSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LanguageChangedSignalType_Emit")] + public static extern void LanguageChangedSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LanguageChangedSignalType")] + public static extern global::System.IntPtr new_LanguageChangedSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_LanguageChangedSignalType")] + public static extern void delete_LanguageChangedSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardResizedSignalType_Empty")] + public static extern bool KeyboardResizedSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardResizedSignalType_GetConnectionCount")] + public static extern uint KeyboardResizedSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardResizedSignalType_Connect")] + public static extern void KeyboardResizedSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardResizedSignalType_Disconnect")] + public static extern void KeyboardResizedSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardResizedSignalType_Emit")] + public static extern void KeyboardResizedSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyboardResizedSignalType")] + public static extern global::System.IntPtr new_KeyboardResizedSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyboardResizedSignalType")] + public static extern void delete_KeyboardResizedSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + //////////////////////InputMethodOptions [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_InputMethodOptions")] diff --git a/src/Tizen.NUI/src/public/ImfManager.cs b/src/Tizen.NUI/src/public/ImfManager.cs index 79cbe73..40b908b 100755 --- a/src/Tizen.NUI/src/public/ImfManager.cs +++ b/src/Tizen.NUI/src/public/ImfManager.cs @@ -1486,15 +1486,30 @@ namespace Tizen.NUI } } - private delegate void ResizedEventCallbackType(); + /// + /// ImfManager resized event. + /// + public class ResizedEventArgs : EventArgs + { + /// + /// resized. + /// + public int Resized + { + get; + set; + } + } + + private delegate void ResizedEventCallbackType(int resized); private ResizedEventCallbackType _resizedEventCallback; - private event EventHandler _resizedEventHandler; + private event EventHandler _resizedEventHandler; /// /// ImfManager resized. /// /// 4 - public event EventHandler Resized + public event EventHandler Resized { add { @@ -1517,11 +1532,14 @@ namespace Tizen.NUI } } - private void OnResized() + private void OnResized(int resized) { + ResizedEventArgs e = new ResizedEventArgs(); + e.Resized = resized; + if (_resizedEventHandler != null) { - _resizedEventHandler(this, null); + _resizedEventHandler(this, e); } } @@ -1530,9 +1548,9 @@ namespace Tizen.NUI /// //Please do not use! this will be internal [EditorBrowsable(EditorBrowsableState.Never)] - public ImfVoidSignalType ResizedSignal() + public KeyboardResizedSignalType ResizedSignal() { - ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false); + KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1602,15 +1620,30 @@ namespace Tizen.NUI } } - private delegate void LanguageChangedEventCallbackType(); + /// + /// ImfManager language changed event args. + /// + public class LanguageChangedEventArgs : EventArgs + { + /// + /// language changed. + /// + public int LanguageChanged + { + get; + set; + } + } + + private delegate void LanguageChangedEventCallbackType(int languageChanged); private LanguageChangedEventCallbackType _languageChangedEventCallback; - private event EventHandler _languageChangedEventHandler; + private event EventHandler _languageChangedEventHandler; /// /// ImfManager language changed. /// /// 4 - public event EventHandler LanguageChanged + public event EventHandler LanguageChanged { add { @@ -1633,11 +1666,14 @@ namespace Tizen.NUI } } - private void OnLanguageChanged() + private void OnLanguageChanged(int languageChanged) { + LanguageChangedEventArgs e = new LanguageChangedEventArgs(); + e.LanguageChanged = languageChanged; + if (_languageChangedEventHandler != null) { - _languageChangedEventHandler(this, null); + _languageChangedEventHandler(this, e); } } @@ -1646,9 +1682,9 @@ namespace Tizen.NUI /// //Please do not use! this will be internal [EditorBrowsable(EditorBrowsableState.Never)] - public ImfVoidSignalType LanguageChangedSignal() + public LanguageChangedSignalType LanguageChangedSignal() { - ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false); + LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } -- 2.7.4