From 55a6d13d908833fc066db01fde276d5c9621356c Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Wed, 31 Jan 2018 14:58:58 +0900 Subject: [PATCH] [NUI] NUI Integration - nui_1.2.83 version (#98) * [NUI] change some comments of Timer and Window APIs Change-Id: I46c9f3e7c100ec87ce52b1acf846d1c3f8573ce3 Signed-off-by: dongsug.song Signed-off-by: huiyu,eun Conflicts: src/Tizen.NUI/src/public/Window.cs * [NUI] fix animation finished callback null reference crash Change-Id: Ice6383394ec99d5752cde31df445c9d5c7b41d7a Signed-off-by: dongsug.song * [NUI] depense code for TriggerEvent::Triggered callback null-reference issue Change-Id: I89dc2920dccec2243fb5562ee8b61caacc4b73b7 Signed-off-by: huiyu,eun Conflicts: src/Tizen.NUI/src/internal/Application.cs * [NUI] add depense code for TriggerEvent callback null reference issue Change-Id: If2576f22ba10cf23cc0724df4ccf2513a68c30e1 Signed-off-by: dongsug.song Signed-off-by: huiyu,eun Conflicts: src/Tizen.NUI/src/internal/Application.cs src/Tizen.NUI/src/public/Timer.cs * [NUI] Fix TriggerEvent::Triggered callback null-reference issue Change-Id: I715503d59efd11dc20d798013714dc669537df96 * [NUI] Revert "temporary fix! fix wrong value of screen position in object dump" Signed-off-by: huiyu,eun Conflicts: src/Tizen.NUI/src/public/Layer.cs This reverts commit 9bd231dcee34a49087688f8af0bc0d269562ecfa. Change-Id: I466c7a4a929afe6a89a8fbe8d46fc54e46a0a70e Conflicts: src/Tizen.NUI/src/public/NUIApplication.cs * [NUI] depense code for crash of GetProperty()'s null parameter Change-Id: I236da0a3a42e1d38cb7201e596f99b42e348a271 Signed-off-by: dongsug.song * [NUI] Update Widget / NUIWidgetApplication Update Widget/ NUIWidgetAppliation. Change-Id: I4a123453830e641cfb4452f56a9924408d11b17c * [NUI] Remove some unused APIs. Change-Id: Ida75bc6e95408752b2f6a706a557a6a1221ee8e7 Signed-off-by: Feng Jin * [NUI] add EnableShiftSelection in TextField,TextEditor Change-Id: I7efc425f43c62f535fc3af31dfcd8e1aa0d1dcbc Signed-off-by: dongsug.song * [NUI] add Reload() to reload image forcely Conflicts: src/Tizen.NUI/src/internal/ManualPINVOKE.cs Change-Id: I66b31730146927f035717f24e8f144742ca0e555 Signed-off-by: dongsug.song * [NUI] Add ImageLoading and PixelBuffer for TextureSet Change-Id: I20aff0bab6faebf325a32e91359dba835bdba7e7 Signed-off-by: huiyu,eun Conflicts: src/Tizen.NUI/src/internal/NDalicPINVOKE.cs * [NUI] Update attribute and comments of PixelData Change-Id: If61c84887ba06394f653fc271e97d9fe091d6a90 * [NUI] Add protect codes in Dispose() Change-Id: I965de0e538e0b07a83a757e9c860fc11991f4903 * NUI release 1.2.81 (#27) * [4.0] Fix auto tct widgetImpl dispose crash Signed-off-by: huiyu,eun * [NUI] DALi version 1.2.81 Signed-off-by: huiyu,eun Conflicts: packaging/version.txt src/Tizen.NUI/src/internal/VersionCheck.cs * [NUI] Support for animated GIF (#34) * [NUI] Added playback (i.e. Play, Pause, Stop) support for the animated GIF Signed-off-by: huiyu,eun * [NUI] Loop count support for animated GIF Signed-off-by: huiyu,eun * [NUI] Modify property index Signed-off-by: huiyu,eun * [NUI] Fix SiblingOrder return value (#37) If parentChildren count is empty, return 0 Signed-off-by: huiyu,eun Signed-off-by: huiyu,eun Conflicts: src/Tizen.NUI/src/public/BaseComponents/View.cs * [NUI] Fix svace issue (#41) * [NUI] Fix svace issue Value widget, which was created by as-operator, so can be null, is dereferenced in method call widget.GetIntPtr() Value value, which is result of method invocation with possible null return value, is dereferenced in method call value.Get() Signed-off-by: huiyu,eun * [NUI] Modify unassigned local variable 'str' Signed-off-by: huiyu,eun * [NUI] Nui release 1.2.82 (#45) * [NUI] Added RefObjectPtr null check condition in Registry copy from gerrit : https://review.tizen.org/gerrit/#/c/167442/1 Signed-off-by: huiyu,eun * [NUI] C# binding for VERTICAL_LINE_ALIGNMENT property Signed-off-by: huiyu,eun * [NUI] NUI release 1.2.82 Signed-off-by: huiyu,eun Conflicts: packaging/version.txt * [NUI] Add SetProperty for VerticalLineAlignment (#48) Signed-off-by: huiyu,eun * [NUI] Add protected codes to avoid the crash when the IntPtr of key is 0 (#72) Signed-off-by: dongsug.song * [NUI]fix memory leak problem caused by wrong increased ref-cnt (#75) Signed-off-by: dongsug.song * [NUI] Apply SiblingOrder Change-Id: I8a44269bd4bb6a23db33bad05763e3e4e250c8b4 Signed-off-by: huiyu,eun * [NUI] fix memory leak problem Conflicts: src/Tizen.NUI/src/public/BaseComponents/View.cs Change-Id: Ifbc9703e19bab871dc62bb9ac71159c5450d8bfd Signed-off-by: dongsug.song * [NUI] NUI_1.2.83 version release (#77) * [NUI] remove this.Reset in Animation Dispose * [NUI] NUI_1.2.83 Version Signed-off-by: huiyu,eun Conflicts: packaging/version.txt src/Tizen.NUI/src/public/Animation.cs * [NUI] Add EditorBrowable keyowrd This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. Signed-off-by: huiyu,eun --- packaging/version.txt | 2 +- src/Tizen.NUI/src/internal/AnimationSignal.cs | 13 + src/Tizen.NUI/src/internal/AppSignalType.cs | 142 ----- src/Tizen.NUI/src/internal/Application.cs | 16 +- src/Tizen.NUI/src/internal/CreateWidgetFunction.cs | 40 ++ src/Tizen.NUI/src/internal/DisposeQueue.cs | 5 + src/Tizen.NUI/src/internal/FrameBuffer.cs | 8 +- src/Tizen.NUI/src/internal/ManualPINVOKE.cs | 327 +++-------- src/Tizen.NUI/src/internal/NDalic.cs | 3 +- src/Tizen.NUI/src/internal/NDalicPINVOKE.cs | 116 +++- src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs | 127 +++-- src/Tizen.NUI/src/internal/Object.cs | 10 + src/Tizen.NUI/src/internal/Registry.cs | 32 +- .../src/internal/SWIGTYPE_p_Dali__Widget__Impl.cs | 40 ++ src/Tizen.NUI/src/internal/TimerSignalType.cs | 13 + src/Tizen.NUI/src/internal/VersionCheck.cs | 6 +- src/Tizen.NUI/src/internal/ViewWrapperImpl.cs | 7 +- src/Tizen.NUI/src/internal/WidgetApplication.cs | 457 ++------------- .../WidgetApplicationLowBatterySignalType.cs | 188 ------- .../WidgetApplicationLowMemorySignalType.cs | 146 ----- .../src/internal/WidgetCreateSignalType.cs | 144 ----- src/Tizen.NUI/src/internal/WidgetImpl.cs | 406 +++++++++++++ src/Tizen.NUI/src/internal/WidgetImplPtr.cs | 39 ++ .../src/internal/WidgetPauseSignalType.cs | 144 ----- .../src/internal/WidgetResizeSignalType.cs | 143 ----- .../src/internal/WidgetResumeSignalType.cs | 144 ----- .../src/internal/WidgetTerminateSignalType.cs | 143 ----- .../src/internal/WidgetUpdateSignalType.cs | 144 ----- src/Tizen.NUI/src/public/Animation.cs | 54 +- .../src/public/BaseComponents/ImageView.cs | 50 +- .../src/public/BaseComponents/Scrollable.cs | 6 +- .../src/public/BaseComponents/TableView.cs | 21 +- .../src/public/BaseComponents/TextEditor.cs | 30 +- .../src/public/BaseComponents/TextField.cs | 40 +- .../src/public/BaseComponents/TextLabel.cs | 23 + .../src/public/BaseComponents/VideoView.cs | 2 +- src/Tizen.NUI/src/public/BaseComponents/View.cs | 422 +++++++++----- src/Tizen.NUI/src/public/BaseHandle.cs | 3 +- src/Tizen.NUI/src/public/FocusManager.cs | 94 +--- src/Tizen.NUI/src/public/ImageLoading.cs | 329 +++++++++++ src/Tizen.NUI/src/public/ImfManager.cs | 59 -- src/Tizen.NUI/src/public/Layer.cs | 103 +++- src/Tizen.NUI/src/public/NUIApplication.cs | 10 - src/Tizen.NUI/src/public/NUIConstants.cs | 36 +- src/Tizen.NUI/src/public/NUIWidgetApplication.cs | 39 +- src/Tizen.NUI/src/public/PixelBuffer.cs | 311 ++++++++++ src/Tizen.NUI/src/public/PixelData.cs | 34 +- src/Tizen.NUI/src/public/Property.cs | 2 +- src/Tizen.NUI/src/public/Renderer.cs | 20 +- src/Tizen.NUI/src/public/StyleManager.cs | 45 -- src/Tizen.NUI/src/public/TTSPlayer.cs | 46 -- src/Tizen.NUI/src/public/TextureSet.cs | 14 +- src/Tizen.NUI/src/public/Timer.cs | 49 +- src/Tizen.NUI/src/public/Touch.cs | 7 +- src/Tizen.NUI/src/public/UIComponents/Button.cs | 12 +- src/Tizen.NUI/src/public/UIComponents/Popup.cs | 34 +- .../src/public/UIComponents/ProgressBar.cs | 2 +- src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs | 16 +- .../src/public/UIComponents/ScrollView.cs | 2 +- src/Tizen.NUI/src/public/UIComponents/Slider.cs | 24 +- src/Tizen.NUI/src/public/VisualFactory.cs | 41 -- src/Tizen.NUI/src/public/VisualMaps.cs | 24 +- src/Tizen.NUI/src/public/Widget.cs | 625 +++------------------ src/Tizen.NUI/src/public/Window.cs | 99 +--- .../examples/imageview-doaction-test.cs | 89 +++ .../examples/ref-cnt-error-memory-leak.cs | 288 ++++++++++ .../NUITestSample/examples/text-test.cs | 4 + 67 files changed, 2801 insertions(+), 3313 deletions(-) delete mode 100755 src/Tizen.NUI/src/internal/AppSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/CreateWidgetFunction.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Widget__Impl.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetApplicationLowBatterySignalType.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetApplicationLowMemorySignalType.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetCreateSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/WidgetImpl.cs create mode 100755 src/Tizen.NUI/src/internal/WidgetImplPtr.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetPauseSignalType.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetResizeSignalType.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetResumeSignalType.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetTerminateSignalType.cs delete mode 100755 src/Tizen.NUI/src/internal/WidgetUpdateSignalType.cs mode change 100755 => 100644 src/Tizen.NUI/src/public/BaseComponents/View.cs create mode 100755 src/Tizen.NUI/src/public/ImageLoading.cs create mode 100755 src/Tizen.NUI/src/public/PixelBuffer.cs create mode 100755 test/NUITestSample/NUITestSample/examples/imageview-doaction-test.cs create mode 100755 test/NUITestSample/NUITestSample/examples/ref-cnt-error-memory-leak.cs diff --git a/packaging/version.txt b/packaging/version.txt index e16ae7e..94fc546 100755 --- a/packaging/version.txt +++ b/packaging/version.txt @@ -7,4 +7,4 @@ NUGET_VERSION=5.0.0-preview1-99999 INTERNAL_NUGET_VERSION=5.0.0.999 # RPM Version Suffix -RPM_VERSION_SUFFIX=nui66 +RPM_VERSION_SUFFIX=nui83 diff --git a/src/Tizen.NUI/src/internal/AnimationSignal.cs b/src/Tizen.NUI/src/internal/AnimationSignal.cs index 13d6f60..67eb06d 100755 --- a/src/Tizen.NUI/src/internal/AnimationSignal.cs +++ b/src/Tizen.NUI/src/internal/AnimationSignal.cs @@ -123,6 +123,19 @@ namespace Tizen.NUI } } + + public void Connect(System.IntPtr callback) + { + NDalicPINVOKE.AnimationSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + public void Disconnect(System.IntPtr callback) + { + NDalicPINVOKE.AnimationSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Disconnect(System.Delegate func) { System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); diff --git a/src/Tizen.NUI/src/internal/AppSignalType.cs b/src/Tizen.NUI/src/internal/AppSignalType.cs deleted file mode 100755 index 81ffac7..0000000 --- a/src/Tizen.NUI/src/internal/AppSignalType.cs +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class AppSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal AppSignalType(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(AppSignalType 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. - protected bool disposed = false; - - ~AppSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_AppSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.AppSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.AppSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.AppSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.AppSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(WidgetApplication arg) - { - NDalicManualPINVOKE.AppSignalType_Emit(swigCPtr, WidgetApplication.getCPtr(arg)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public AppSignalType() : this(NDalicManualPINVOKE.new_AppSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } -} diff --git a/src/Tizen.NUI/src/internal/Application.cs b/src/Tizen.NUI/src/internal/Application.cs index fa69d30..5684c4e 100755 --- a/src/Tizen.NUI/src/internal/Application.cs +++ b/src/Tizen.NUI/src/internal/Application.cs @@ -517,11 +517,10 @@ namespace Tizen.NUI { // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread. DisposeQueue.Instance.Initialize(); - NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs(); + NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs(); // Populate all members of "e" (NUIApplicationInitEventArgs) with real data e.Application = Application.GetApplicationFromPtr(data); - if (_applicationInitEventHandler != null) { //here we send all data to user event handlers @@ -1073,8 +1072,6 @@ namespace Tizen.NUI public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode) { - NUILog.Debug(" NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode) is called! "); - Application ret = New(args, stylesheet, (Application.WindowMode)windowMode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -1104,8 +1101,6 @@ namespace Tizen.NUI */ public static Application New() { - NUILog.Debug("New() is called!"); - Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_0(), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1113,8 +1108,6 @@ namespace Tizen.NUI public static Application New(int argc) { - NUILog.Debug("New(int argc) is called!"); - Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_1(argc), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1122,8 +1115,6 @@ namespace Tizen.NUI public static Application New(int argc, string stylesheet) { - NUILog.Debug("New(int argc, string stylesheet) is called!"); - Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_2(argc, stylesheet), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1131,8 +1122,6 @@ namespace Tizen.NUI public static Application New(int argc, string stylesheet, Application.WindowMode windowMode) { - NUILog.Debug("New(int argc, string stylesheet, Application.WindowMode windowMode) is called!"); - Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1140,7 +1129,6 @@ namespace Tizen.NUI public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode) { - NUILog.Debug("New(string[] args) is called!"); int argc = args.Length; string argvStr = string.Join(" ", args); @@ -1158,8 +1146,6 @@ namespace Tizen.NUI public Application() : this(NDalicPINVOKE.new_Application__SWIG_0(), true) { - NUILog.Debug("Application() is called!"); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/src/Tizen.NUI/src/internal/CreateWidgetFunction.cs b/src/Tizen.NUI/src/internal/CreateWidgetFunction.cs new file mode 100755 index 0000000..29d2cfb --- /dev/null +++ b/src/Tizen.NUI/src/internal/CreateWidgetFunction.cs @@ -0,0 +1,40 @@ +/* + * 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. + * + */ +namespace Tizen.NUI +{ + + internal class CreateWidgetFunction + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal CreateWidgetFunction(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected CreateWidgetFunction() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CreateWidgetFunction obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/DisposeQueue.cs b/src/Tizen.NUI/src/internal/DisposeQueue.cs index 7c06194..dc75e9c 100755 --- a/src/Tizen.NUI/src/internal/DisposeQueue.cs +++ b/src/Tizen.NUI/src/internal/DisposeQueue.cs @@ -34,10 +34,15 @@ namespace Tizen.NUI get { return _disposableQueue; } } + private bool _isCalled = false; public void Initialize() { + if(_isCalled == false) + { _disposeQueueProcessDisposablesDelegate = new EventThreadCallback.CallbackDelegate(ProcessDisposables); _eventThreadCallback = new EventThreadCallback(_disposeQueueProcessDisposablesDelegate); + _isCalled = true; + } } public void Add(IDisposable disposable) diff --git a/src/Tizen.NUI/src/internal/FrameBuffer.cs b/src/Tizen.NUI/src/internal/FrameBuffer.cs index 4b5abc1..085bdb1 100755 --- a/src/Tizen.NUI/src/internal/FrameBuffer.cs +++ b/src/Tizen.NUI/src/internal/FrameBuffer.cs @@ -15,6 +15,8 @@ * */ +using System.Runtime.InteropServices; + namespace Tizen.NUI { @@ -97,8 +99,12 @@ namespace Tizen.NUI public Texture GetColorTexture() { + //to fix memory leak issue, match the handle count with native side. global::System.IntPtr cPtr = NDalicPINVOKE.FrameBuffer_GetColorTexture(swigCPtr); - Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Texture ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Texture; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index d801688..71945bd 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -720,6 +720,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextLabel_Property_TEXT_DIRECTION_get")] public static extern int TextLabel_Property_TEXT_DIRECTION_get(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get")] + public static extern int TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_MODE_get")] public static extern int HIDDENINPUT_PROPERTY_MODE_get(); @@ -1122,17 +1125,18 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_SWIGUpcast")] public static extern global::System.IntPtr Widget_SWIGUpcast(global::System.IntPtr jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_SWIGUpcast")] - public static extern global::System.IntPtr WidgetApplication_SWIGUpcast(global::System.IntPtr jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_SWIGUpcast")] + public static extern global::System.IntPtr WidgetImpl_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_New__SWIG_0")] + public static extern global::System.IntPtr Widget_New__SWIG_0(); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_New")] - public static extern global::System.IntPtr Widget_New(string jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_New__SWIG_1")] + public static extern global::System.IntPtr Widget_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Widget__SWIG_0")] - public static extern global::System.IntPtr new_Widget__SWIG_0(); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Widget__SWIG_1")] - public static extern global::System.IntPtr new_Widget__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Widget")] + public static extern global::System.IntPtr new_Widget(); [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_Assign")] public static extern global::System.IntPtr Widget_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -1140,263 +1144,87 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Widget")] public static extern void delete_Widget(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_CreateSignal")] - public static extern global::System.IntPtr Widget_CreateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_TerminateSignal")] - public static extern global::System.IntPtr Widget_TerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_PauseSignal")] - public static extern global::System.IntPtr Widget_PauseSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_ResumeSignal")] - public static extern global::System.IntPtr Widget_ResumeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_ResizeSignal")] - public static extern global::System.IntPtr Widget_ResizeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_UpdateSignal")] - public static extern global::System.IntPtr Widget_UpdateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_New")] - public static extern global::System.IntPtr WidgetApplication_New(int jarg1, string jarg2, string jarg3); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetApplication__SWIG_0")] - public static extern global::System.IntPtr new_WidgetApplication__SWIG_0(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetApplication__SWIG_1")] - public static extern global::System.IntPtr new_WidgetApplication__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_Assign")] - public static extern global::System.IntPtr WidgetApplication_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetApplication")] - public static extern void delete_WidgetApplication(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_MainLoop")] - public static extern void WidgetApplication_MainLoop(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_Quit")] - public static extern void WidgetApplication_Quit(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_GetResourcePath")] - public static extern string WidgetApplication_GetResourcePath(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_GetRegion")] - public static extern string WidgetApplication_GetRegion(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_GetLanguage")] - public static extern string WidgetApplication_GetLanguage(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_InitSignal")] - public static extern global::System.IntPtr WidgetApplication_InitSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_TerminateSignal")] - public static extern global::System.IntPtr WidgetApplication_TerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LanguageChangedSignal")] - public static extern global::System.IntPtr WidgetApplication_LanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_RegionChangedSignal")] - public static extern global::System.IntPtr WidgetApplication_RegionChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowBatterySignal")] - public static extern global::System.IntPtr WidgetApplication_LowBatterySignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowMemorySignal")] - public static extern global::System.IntPtr WidgetApplication_LowMemorySignal(global::System.Runtime.InteropServices.HandleRef jarg1); - - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetCreateSignalType_Empty")] - public static extern bool WidgetCreateSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetCreateSignalType_GetConnectionCount")] - public static extern uint WidgetCreateSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetCreateSignalType_Connect")] - public static extern void WidgetCreateSignalType_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_WidgetCreateSignalType_Disconnect")] - public static extern void WidgetCreateSignalType_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_WidgetCreateSignalType_Emit")] - public static extern void WidgetCreateSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetCreateSignalType")] - public static extern global::System.IntPtr new_WidgetCreateSignalType(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetCreateSignalType")] - public static extern void delete_WidgetCreateSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetTerminateSignalType_Empty")] - public static extern bool WidgetTerminateSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetTerminateSignalType_GetConnectionCount")] - public static extern uint WidgetTerminateSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetTerminateSignalType_Connect")] - public static extern void WidgetTerminateSignalType_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_WidgetTerminateSignalType_Disconnect")] - public static extern void WidgetTerminateSignalType_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_WidgetImpl_New")] + public static extern global::System.IntPtr WidgetImpl_New(); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetTerminateSignalType_Emit")] - public static extern void WidgetTerminateSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnCreate")] + public static extern void WidgetImpl_OnCreate(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetTerminateSignalType")] - public static extern global::System.IntPtr new_WidgetTerminateSignalType(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnCreateSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_OnCreateSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetTerminateSignalType")] - public static extern void delete_WidgetTerminateSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnTerminate")] + public static extern void WidgetImpl_OnTerminate(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetPauseSignalType_Empty")] - public static extern bool WidgetPauseSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnTerminateSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_OnTerminateSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetPauseSignalType_GetConnectionCount")] - public static extern uint WidgetPauseSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnPause")] + public static extern void WidgetImpl_OnPause(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetPauseSignalType_Connect")] - public static extern void WidgetPauseSignalType_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_WidgetImpl_OnPauseSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_OnPauseSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetPauseSignalType_Disconnect")] - public static extern void WidgetPauseSignalType_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_WidgetImpl_OnResume")] + public static extern void WidgetImpl_OnResume(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetPauseSignalType_Emit")] - public static extern void WidgetPauseSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnResumeSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_OnResumeSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetPauseSignalType")] - public static extern global::System.IntPtr new_WidgetPauseSignalType(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnResize")] + public static extern void WidgetImpl_OnResize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetPauseSignalType")] - public static extern void delete_WidgetPauseSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnResizeSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_OnResizeSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResumeSignalType_Empty")] - public static extern bool WidgetResumeSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnUpdate")] + public static extern void WidgetImpl_OnUpdate(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResumeSignalType_GetConnectionCount")] - public static extern uint WidgetResumeSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_OnUpdateSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_OnUpdateSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResumeSignalType_Connect")] - public static extern void WidgetResumeSignalType_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_WidgetImpl_SignalConnected")] + public static extern void WidgetImpl_SignalConnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResumeSignalType_Disconnect")] - public static extern void WidgetResumeSignalType_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_WidgetImpl_SignalConnectedSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_SignalConnectedSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResumeSignalType_Emit")] - public static extern void WidgetResumeSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_SignalDisconnected")] + public static extern void WidgetImpl_SignalDisconnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetResumeSignalType")] - public static extern global::System.IntPtr new_WidgetResumeSignalType(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_SignalDisconnectedSwigExplicitWidgetImpl")] + public static extern void WidgetImpl_SignalDisconnectedSwigExplicitWidgetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetResumeSignalType")] - public static extern void delete_WidgetResumeSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_SetContentInfo")] + public static extern void WidgetImpl_SetContentInfo(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResizeSignalType_Empty")] - public static extern bool WidgetResizeSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_SetImpl")] + public static extern void WidgetImpl_SetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResizeSignalType_GetConnectionCount")] - public static extern uint WidgetResizeSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetImpl_director_connect")] + public static extern void WidgetImpl_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, WidgetImpl.SwigDelegateWidgetImpl_0 delegate0, WidgetImpl.SwigDelegateWidgetImpl_1 delegate1, WidgetImpl.SwigDelegateWidgetImpl_2 delegate2, WidgetImpl.SwigDelegateWidgetImpl_3 delegate3, WidgetImpl.SwigDelegateWidgetImpl_4 delegate4, WidgetImpl.SwigDelegateWidgetImpl_5 delegate5, WidgetImpl.SwigDelegateWidgetImpl_6 delegate6, WidgetImpl.SwigDelegateWidgetImpl_7 delegate7); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResizeSignalType_Connect")] - public static extern void WidgetResizeSignalType_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_Widget_GetImplementation__SWIG_0")] + public static extern global::System.IntPtr Widget_GetImplementation__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetResizeSignalType_Disconnect")] - public static extern void WidgetResizeSignalType_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_WidgetResizeSignalType_Emit")] - public static extern void WidgetResizeSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetResizeSignalType")] - public static extern global::System.IntPtr new_WidgetResizeSignalType(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetResizeSignalType")] - public static extern void delete_WidgetResizeSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetUpdateSignalType_Empty")] - public static extern bool WidgetUpdateSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetUpdateSignalType_GetConnectionCount")] - public static extern uint WidgetUpdateSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetUpdateSignalType_Connect")] - public static extern void WidgetUpdateSignalType_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_WidgetUpdateSignalType_Disconnect")] - public static extern void WidgetUpdateSignalType_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_WidgetUpdateSignalType_Emit")] - public static extern void WidgetUpdateSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetUpdateSignalType")] - public static extern global::System.IntPtr new_WidgetUpdateSignalType(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetUpdateSignalType")] - public static extern void delete_WidgetUpdateSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_Empty")] - public static extern bool AppSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_GetConnectionCount")] - public static extern uint AppSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_Connect")] - public static extern void AppSignalType_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_AppSignalType_Disconnect")] - public static extern void AppSignalType_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_AppSignalType_Emit")] - public static extern void AppSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AppSignalType")] - public static extern global::System.IntPtr new_AppSignalType(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AppSignalType")] - public static extern void delete_AppSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowBatterySignalType_Empty")] - public static extern bool WidgetApplication_LowBatterySignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowBatterySignalType_GetConnectionCount")] - public static extern uint WidgetApplication_LowBatterySignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowBatterySignalType_Connect")] - public static extern void WidgetApplication_LowBatterySignalType_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_WidgetApplication_LowBatterySignalType_Disconnect")] - public static extern void WidgetApplication_LowBatterySignalType_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_WidgetApplication_LowBatterySignalType_Emit")] - public static extern void WidgetApplication_LowBatterySignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_new_LowBatterySignalType")] - public static extern global::System.IntPtr WidgetApplication_new_LowBatterySignalType(); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_delete_LowBatterySignalType")] - public static extern void WidgetApplication_delete_LowBatterySignalType(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowMemorySignalType_Empty")] - public static extern bool WidgetApplication_LowMemorySignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowMemorySignalType_GetConnectionCount")] - public static extern uint WidgetApplication_LowMemorySignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowMemorySignalType_Connect")] - public static extern void WidgetApplication_LowMemorySignalType_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_WidgetApplication_LowMemorySignalType_Disconnect")] - public static extern void WidgetApplication_LowMemorySignalType_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_WidgetApplication_New")] + public static extern global::System.IntPtr WidgetApplication_New(int jarg1, string jarg2, string jarg3); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LowMemorySignalType_Emit")] - public static extern void WidgetApplication_LowMemorySignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetApplication__SWIG_0")] + public static extern global::System.IntPtr new_WidgetApplication__SWIG_0(); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_new_LowMemorySignalType")] - public static extern global::System.IntPtr WidgetApplication_new_LowMemorySignalType(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetApplication__SWIG_1")] + public static extern global::System.IntPtr new_WidgetApplication__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_delete_LowMemorySignalType")] - public static extern void WidgetApplication_delete_LowMemorySignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_Assign")] + public static extern global::System.IntPtr WidgetApplication_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetApplication")] + public static extern void delete_WidgetApplication(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_RegisterWidgetCreatingFunction")] + public static extern void WidgetApplication_RegisterWidgetCreatingFunction(global::System.Runtime.InteropServices.HandleRef jarg1, ref string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + // End widget [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Actor_Property_INHERIT_LAYOUT_DIRECTION_get")] public static extern int Actor_Property_INHERIT_LAYOUT_DIRECTION_get(); @@ -1895,5 +1723,24 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FontClient_AddCustomFontDirectory")] public static extern bool FontClient_AddCustomFontDirectory(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_TextField_Property_ENABLE_SHIFT_SELECTION_get")] + public static extern int TextField_Property_ENABLE_SHIFT_SELECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_TextEditor_Property_ENABLE_SHIFT_SELECTION_get")] + public static extern int TextEditor_Property_ENABLE_SHIFT_SELECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_RELOAD_get")] + public static extern int ImageView_IMAGE_VISUAL_ACTION_RELOAD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_PLAY_get")] + public static extern int ImageView_IMAGE_VISUAL_ACTION_PLAY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_PAUSE_get")] + public static extern int ImageView_IMAGE_VISUAL_ACTION_PAUSE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_STOP_get")] + public static extern int ImageView_IMAGE_VISUAL_ACTION_STOP_get(); + } } diff --git a/src/Tizen.NUI/src/internal/NDalic.cs b/src/Tizen.NUI/src/internal/NDalic.cs index 25e5c57..40607d6 100755 --- a/src/Tizen.NUI/src/internal/NDalic.cs +++ b/src/Tizen.NUI/src/internal/NDalic.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2018 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. @@ -884,6 +884,7 @@ namespace Tizen.NUI internal static readonly int IMAGE_VISUAL_BATCH_SIZE = NDalicPINVOKE.IMAGE_VISUAL_BATCH_SIZE_get(); internal static readonly int IMAGE_VISUAL_CACHE_SIZE = NDalicPINVOKE.IMAGE_VISUAL_CACHE_SIZE_get(); internal static readonly int IMAGE_VISUAL_FRAME_DELAY = NDalicPINVOKE.IMAGE_VISUAL_FRAME_DELAY_get(); + internal static readonly int IMAGE_VISUAL_LOOP_COUNT = NDalicPINVOKE.IMAGE_VISUAL_LOOP_COUNT_get(); internal static readonly int IMAGE_VISUAL_MASK_CONTENT_SCALE = NDalicPINVOKE.IMAGE_VISUAL_MASK_CONTENT_SCALE_get(); internal static readonly int IMAGE_VISUAL_CROP_TO_MASK = NDalicPINVOKE.IMAGE_VISUAL_CROP_TO_MASK_get(); internal static readonly int IMAGE_VISUAL_RELEASE_POLICY = NDalicPINVOKE.IMAGE_VISUAL_RELEASE_POLICY_get(); diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs index f549a4c..319265e 100755 --- a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2018 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. @@ -6625,6 +6625,9 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_FRAME_DELAY_get")] public static extern int IMAGE_VISUAL_FRAME_DELAY_get(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_LOOP_COUNT_get")] + public static extern int IMAGE_VISUAL_LOOP_COUNT_get(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_MASK_CONTENT_SCALE_get")] public static extern int IMAGE_VISUAL_MASK_CONTENT_SCALE_get(); @@ -11400,7 +11403,116 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_delete_Extents")] public static extern void delete_Extents(global::System.Runtime.InteropServices.HandleRef jarg1); - } + //for PixelBuffer and ImageLoading + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_PixelBuffer_SWIGUpcast")] + public static extern global::System.IntPtr PixelBuffer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_New")] + public static extern global::System.IntPtr PixelBuffer_New(uint jarg1, uint jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PixelBuffer__SWIG_0")] + public static extern global::System.IntPtr new_PixelBuffer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PixelBuffer")] + public static extern void delete_PixelBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PixelBuffer__SWIG_1")] + public static extern global::System.IntPtr new_PixelBuffer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_Assign")] + public static extern global::System.IntPtr PixelBuffer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_Convert")] + public static extern global::System.IntPtr PixelBuffer_Convert(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_CreatePixelData")] + public static extern global::System.IntPtr PixelBuffer_CreatePixelData(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_GetBuffer")] + public static extern global::System.IntPtr PixelBuffer_GetBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_GetWidth")] + public static extern uint PixelBuffer_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_GetHeight")] + public static extern uint PixelBuffer_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_GetPixelFormat")] + public static extern int PixelBuffer_GetPixelFormat(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_ApplyMask__SWIG_0")] + public static extern void PixelBuffer_ApplyMask__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_ApplyMask__SWIG_1")] + public static extern void PixelBuffer_ApplyMask__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_ApplyMask__SWIG_2")] + public static extern void PixelBuffer_ApplyMask__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_ApplyGaussianBlur")] + public static extern void PixelBuffer_ApplyGaussianBlur(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_Crop")] + public static extern void PixelBuffer_Crop(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2, ushort jarg3, ushort jarg4, ushort jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelBuffer_Resize")] + public static extern void PixelBuffer_Resize(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2, ushort jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PixelBuffer__SWIG_2")] + public static extern global::System.IntPtr new_PixelBuffer__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageFromFile__SWIG_0")] + public static extern global::System.IntPtr LoadImageFromFile__SWIG_0(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageFromFile__SWIG_1")] + public static extern global::System.IntPtr LoadImageFromFile__SWIG_1(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageFromFile__SWIG_2")] + public static extern global::System.IntPtr LoadImageFromFile__SWIG_2(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageFromFile__SWIG_3")] + public static extern global::System.IntPtr LoadImageFromFile__SWIG_3(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageFromFile__SWIG_4")] + public static extern global::System.IntPtr LoadImageFromFile__SWIG_4(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetClosestImageSize__SWIG_0")] + public static extern global::System.IntPtr GetClosestImageSize__SWIG_0(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetClosestImageSize__SWIG_1")] + public static extern global::System.IntPtr GetClosestImageSize__SWIG_1(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetClosestImageSize__SWIG_2")] + public static extern global::System.IntPtr GetClosestImageSize__SWIG_2(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetClosestImageSize__SWIG_3")] + public static extern global::System.IntPtr GetClosestImageSize__SWIG_3(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetClosestImageSize__SWIG_4")] + public static extern global::System.IntPtr GetClosestImageSize__SWIG_4(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DownloadImageSynchronously__SWIG_0")] + public static extern global::System.IntPtr DownloadImageSynchronously__SWIG_0(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DownloadImageSynchronously__SWIG_1")] + public static extern global::System.IntPtr DownloadImageSynchronously__SWIG_1(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DownloadImageSynchronously__SWIG_2")] + public static extern global::System.IntPtr DownloadImageSynchronously__SWIG_2(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DownloadImageSynchronously__SWIG_3")] + public static extern global::System.IntPtr DownloadImageSynchronously__SWIG_3(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DownloadImageSynchronously__SWIG_4")] + public static extern global::System.IntPtr DownloadImageSynchronously__SWIG_4(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetMaxTextureSize")] + public static extern void SetMaxTextureSize(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetMaxTextureSize")] + public static extern uint GetMaxTextureSize(); + + } } diff --git a/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs b/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs index 0f8ff84..55c7193 100755 --- a/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs +++ b/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs @@ -30,6 +30,7 @@ namespace Tizen.NUI /// protected WidgetApplication _application; private string _stylesheet = ""; + Dictionary _widgetInfo; /// /// Dictionary to contain each type of event callback. @@ -41,8 +42,6 @@ namespace Tizen.NUI /// public NUIWidgetCoreBackend() { - //Tizen.Log.Fatal("NUI", "### NUIWidgetCoreBackend called"); - //_application = WidgetApplication.NewWidgetApplication(); } /// @@ -51,7 +50,6 @@ namespace Tizen.NUI public NUIWidgetCoreBackend(string stylesheet) { _stylesheet = stylesheet; - //_application = WidgetApplication.NewWidgetApplication(stylesheet); } /// @@ -83,7 +81,6 @@ namespace Tizen.NUI /// public void Dispose() { - Tizen.Log.Fatal("NUI", "### NUIWidgetCoreBackend Dispose called"); if (_application != null) { _application.Dispose(); @@ -95,106 +92,142 @@ namespace Tizen.NUI /// public void Exit() { - Tizen.Log.Fatal("NUI", "### NUIWidgetCoreBackend Exit called"); if (_application != null) { _application.Quit(); } } + public void RegisterWidgetInfo(Dictionary widgetInfo) + { + _widgetInfo = widgetInfo; + } + /// /// Run Application. /// /// Arguments from commandline. public void Run(string[] args) { + TizenSynchronizationContext.Initialize(); + args[0] = Tizen.Applications.Application.Current.ApplicationInfo.ExecutablePath; _application = WidgetApplication.NewWidgetApplication(args, _stylesheet); + _application.RegisterWidgetInfo(_widgetInfo); - TizenSynchronizationContext.Initialize(); _application.BatteryLow += OnBatteryLow; _application.LanguageChanged += OnLanguageChanged; _application.MemoryLow += OnMemoryLow; _application.RegionChanged += OnRegionChanged; ; - - _application.Init += OnInit; - _application.Terminate += OnTerminate; + _application.Initialized += OnInitialized; + _application.Terminating += OnTerminated; _application.MainLoop(); } - private void OnInit(object sender, WidgetApplication.WidgetApplicationEventArgs e) + /// + /// The Initialized event callback function. + /// + /// The application instance. + /// The event argument for Initialized. + private void OnInitialized(object source, NUIApplicationInitEventArgs e) { - Log.Fatal("NUI", "NUIWidgetApplication OnPreCreated Called"); var preCreateHandler = Handlers[EventType.PreCreated] as Action; preCreateHandler?.Invoke(); - Log.Fatal("NUI", "NUIWidgetApplication OnCreate Called"); var createHandler = Handlers[EventType.Created] as Action; createHandler?.Invoke(); - + _application.RegisterWidgetCreatingFunction(); } - private void OnTerminate(object sender, WidgetApplication.WidgetApplicationEventArgs e) + /// + /// The Terminated event callback function. + /// + /// The application instance. + /// The event argument for Terminated. + private void OnTerminated(object source, NUIApplicationTerminatingEventArgs e) { - Log.Fatal("NUI", "NUIWidgetApplication OnTerminated Called"); var handler = Handlers[EventType.Terminated] as Action; handler?.Invoke(); } /// - /// Region changed event callback function. + /// The Region changed event callback function. /// - /// Application instance - /// Event argument for RegionChanged - private void OnRegionChanged(object sender, WidgetApplication.WidgetApplicationEventArgs e) + /// The application instance. + /// The event argument for RegionChanged. + private void OnRegionChanged(object source, NUIApplicationRegionChangedEventArgs e) { - Log.Fatal("NUI", "NUIWidgetApplication OnRegionChanged Called"); var handler = Handlers[EventType.RegionFormatChanged] as Action; - // Need to make new signal return in native to return right value. - handler?.Invoke(new RegionFormatChangedEventArgs("")); + handler?.Invoke(new RegionFormatChangedEventArgs(e.Application.GetRegion())); } /// - /// Memory Low event callback function. + /// The Language changed event callback function. /// - /// Application instance - /// Event argument for MemoryLow - private void OnMemoryLow(object sender, WidgetApplication.WidgetApplicationEventArgs e) + /// The application instance. + /// The event argument for LanguageChanged. + private void OnLanguageChanged(object source, NUIApplicationLanguageChangedEventArgs e) { - Log.Fatal("NUI", "NUIWidgetApplication OnMemoryLow Called"); - var handler = Handlers[EventType.LowMemory] as Action; - // Need to make new signal return in native to return right value. - handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.None)); + var handler = Handlers[EventType.LocaleChanged] as Action; + handler?.Invoke(new LocaleChangedEventArgs(e.Application.GetLanguage())); } /// - /// Language changed event callback function. + /// The Memory Low event callback function. /// - /// Application instance - /// Event argument for LanguageChanged - private void OnLanguageChanged(object sender, WidgetApplication.WidgetApplicationEventArgs e) + /// The application instance. + /// The event argument for MemoryLow. + private void OnMemoryLow(object source, NUIApplicationMemoryLowEventArgs e) { + var handler = Handlers[EventType.LowMemory] as Action; - Log.Fatal("NUI", "NUIWidgetApplication OnLanguageChanged Called"); - var handler = Handlers[EventType.LocaleChanged] as Action; - // Need to make new signal return in native to return right value. - handler?.Invoke(new LocaleChangedEventArgs("")); - + switch (e.MemoryStatus) + { + case Application.MemoryStatus.Normal: + { + handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.None)); + break; + } + case Application.MemoryStatus.Low: + { + handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.SoftWarning)); + break; + } + case Application.MemoryStatus.CriticallyLow: + { + handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.HardWarning)); + break; + } + } } /// - /// Battery low event callback function. + /// The Battery Low event callback function. /// - /// Application instance - /// Event argument for BatteryLow - private void OnBatteryLow(object sender, WidgetApplication.WidgetApplicationEventArgs e) + /// The application instance. + /// The event argument for BatteryLow. + private void OnBatteryLow(object source, NUIApplicationBatteryLowEventArgs e) { - Log.Fatal("NUI", "NUIWidgetApplication OnBatteryLow Called"); var handler = Handlers[EventType.LowBattery] as Action; - // Need to make new signal return in native to return right value. - handler?.Invoke(new LowBatteryEventArgs(LowBatteryStatus.None)); - + switch (e.BatteryStatus) + { + case Application.BatteryStatus.Normal: + { + handler?.Invoke(new LowBatteryEventArgs(LowBatteryStatus.None)); + break; + } + case Application.BatteryStatus.CriticallyLow: + { + handler?.Invoke(new LowBatteryEventArgs(LowBatteryStatus.CriticalLow)); + break; + } + case Application.BatteryStatus.PowerOff: + { + handler?.Invoke(new LowBatteryEventArgs(LowBatteryStatus.PowerOff)); + break; + } + } } internal WidgetApplication WidgetApplicationHandle diff --git a/src/Tizen.NUI/src/internal/Object.cs b/src/Tizen.NUI/src/internal/Object.cs index b197472..2d64e4c 100755 --- a/src/Tizen.NUI/src/internal/Object.cs +++ b/src/Tizen.NUI/src/internal/Object.cs @@ -27,6 +27,11 @@ namespace Tizen.NUI { public static PropertyValue GetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index) { + if(handle.Handle == System.IntPtr.Zero) + { + throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!"); + } + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Handle_GetProperty(handle, index), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -34,6 +39,11 @@ namespace Tizen.NUI public static void SetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index, PropertyValue propertyValue) { + if (handle.Handle == System.IntPtr.Zero) + { + throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!"); + } + NDalicPINVOKE.Handle_SetProperty(handle, index, PropertyValue.getCPtr(propertyValue)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/src/Tizen.NUI/src/internal/Registry.cs b/src/Tizen.NUI/src/internal/Registry.cs index aea7cbe..fc254b8 100755 --- a/src/Tizen.NUI/src/internal/Registry.cs +++ b/src/Tizen.NUI/src/internal/Registry.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2018 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. @@ -55,16 +55,12 @@ namespace Tizen.NUI /// The instance of BaseHandle (C# base class). internal static void Register(BaseHandle baseHandle) { - if(savedApplicationThread?.ManagedThreadId != Thread.CurrentThread.ManagedThreadId) - { - throw new global::System.ApplicationException("NUI object is attempt to be created in another thread. It should be created in main thread only!"); - } // We store a pointer to the RefObject for the control RefObject refObj = baseHandle.GetObjectPtr(); IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); - NUILog.Debug("Storing ref object cptr in control map Hex: {0:X}" + refCptr); + //NUILog.Debug("Storing ref object cptr in control map Hex: {0:X}" + refCptr); if (!Instance._controlMap.ContainsKey(refCptr)) { @@ -96,16 +92,32 @@ namespace Tizen.NUI RefObject refObj = baseHandle.GetObjectPtr(); IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); - // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) - return GetManagedBaseHandleFromRefObject(refObjectPtr); + if (refObjectPtr != null) + { + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + return GetManagedBaseHandleFromRefObject(refObjectPtr); + } + else + { + NUILog.Error("NUI Registry RefObjectPtr is NULL!"); + return null; + } } internal static BaseHandle GetManagedBaseHandleFromNativePtr(IntPtr cPtr) { IntPtr refObjectPtr = NDalicPINVOKE.GetRefObjectPtr(cPtr); - // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) - return GetManagedBaseHandleFromRefObject(refObjectPtr); + if (refObjectPtr != null) + { + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + return GetManagedBaseHandleFromRefObject(refObjectPtr); + } + else + { + NUILog.Error("NUI Registry RefObjectPtr is NULL!"); + return null; + } } internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr) diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Widget__Impl.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Widget__Impl.cs new file mode 100755 index 0000000..bd4e5fd --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Widget__Impl.cs @@ -0,0 +1,40 @@ +/* + * 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. + * + */ +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Widget__Impl + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Widget__Impl(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Widget__Impl() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Widget__Impl obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/TimerSignalType.cs b/src/Tizen.NUI/src/internal/TimerSignalType.cs index fda4dd7..aae2fa5 100755 --- a/src/Tizen.NUI/src/internal/TimerSignalType.cs +++ b/src/Tizen.NUI/src/internal/TimerSignalType.cs @@ -133,6 +133,19 @@ namespace Tizen.NUI } } + public void Connect(System.IntPtr callback) + { + NDalicPINVOKE.TimerSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Disconnect(System.IntPtr callback) + { + NDalicPINVOKE.TimerSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool Emit() { bool ret = NDalicPINVOKE.TimerSignalType_Emit(swigCPtr); diff --git a/src/Tizen.NUI/src/internal/VersionCheck.cs b/src/Tizen.NUI/src/internal/VersionCheck.cs index c0ca109..899f087 100755 --- a/src/Tizen.NUI/src/internal/VersionCheck.cs +++ b/src/Tizen.NUI/src/internal/VersionCheck.cs @@ -24,10 +24,10 @@ namespace Tizen.NUI { public const int daliVer1 = 1; public const int daliVer2 = 2; - public const int daliVer3 = 66; - public const int nuiVer1 = 0; + public const int daliVer3 = 83; + public const int nuiVer1 = 1; public const int nuiVer2 = 2; - public const int nuiVer3 = 66; + public const int nuiVer3 = 83; public const string nuiRelease = ""; diff --git a/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs b/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs index c1cb572..3c009a6 100755 --- a/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs +++ b/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs @@ -14,6 +14,7 @@ * limitations under the License. * */ +using System.Runtime.InteropServices; using Tizen.NUI.BaseComponents; namespace Tizen.NUI { @@ -251,8 +252,12 @@ namespace Tizen.NUI public VisualBase GetVisual(int index) { + //to fix memory leak issue, match the handle count with native side. System.IntPtr cPtr = NDalicManualPINVOKE.ViewWrapperImpl_GetVisual(swigCPtr, index); - VisualBase ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as VisualBase; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + VisualBase ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as VisualBase; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/internal/WidgetApplication.cs b/src/Tizen.NUI/src/internal/WidgetApplication.cs index ecebcf8..02022dd 100755 --- a/src/Tizen.NUI/src/internal/WidgetApplication.cs +++ b/src/Tizen.NUI/src/internal/WidgetApplication.cs @@ -15,18 +15,19 @@ * */ using System; -using System.Runtime.InteropServices; +using System.Collections.Generic; namespace Tizen.NUI { - /// - /// Widget application - /// - internal class WidgetApplication : BaseHandle + internal class WidgetApplication : Application { private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private static WidgetApplication _instance; //singleton + private Dictionary _widgetInfo; + private List _widgetList = new List(); + private delegate System.IntPtr CreateWidgetFunctionDelegate(ref string widgetName); - internal WidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetApplication_SWIGUpcast(cPtr), cMemoryOwn) + internal WidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } @@ -36,17 +37,14 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - /// - /// To make Window instance be disposed. - /// protected override void Dispose(DisposeTypes type) { - if(disposed) + if (disposed) { return; } - if(type == DisposeTypes.Explicit) + if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. @@ -56,32 +54,6 @@ namespace Tizen.NUI //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 (_initCallback != null) - { - this.InitSignal().Disconnect(_initCallback); - } - if (_terminateCallback != null) - { - this.TerminateSignal().Disconnect(_terminateCallback); - } - if (_languageChangedCallback != null) - { - this.LanguageChangedSignal().Disconnect(_languageChangedCallback);; - } - if (_regionChangedCallback != null) - { - this.RegionChangedSignal().Disconnect(_regionChangedCallback); - } - if (_batteryLowCallback != null) - { - this.BatteryLowSignal().Disconnect(_batteryLowCallback); - } - if (_memoryLowCallback != null) - { - this.MemoryLowSignal().Disconnect(_memoryLowCallback); - } - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -91,18 +63,10 @@ namespace Tizen.NUI } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - base.Dispose(type); } - internal static WidgetApplication GetWidgetApplicationFromPtr(global::System.IntPtr cPtr) - { - WidgetApplication ret = new WidgetApplication(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static WidgetApplication Instance + public new static WidgetApplication Instance { get { @@ -114,7 +78,6 @@ namespace Tizen.NUI { WidgetApplication ret = New(args, stylesheet); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - _instance = ret; return ret; } @@ -124,420 +87,82 @@ namespace Tizen.NUI int argc = args.Length; string argvStr = string.Join(" ", args); - WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_New(argc, argvStr, stylesheet), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal WidgetApplication(WidgetApplication widgetApplication) : this(NDalicManualPINVOKE.new_WidgetApplication__SWIG_1(WidgetApplication.getCPtr(widgetApplication)), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal WidgetApplication Assign(WidgetApplication widgetApplication) - { - WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_Assign(swigCPtr, WidgetApplication.getCPtr(widgetApplication)), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + IntPtr widgetIntPtr = NDalicManualPINVOKE.WidgetApplication_New(argc, argvStr, stylesheet); - /// - /// This starts the application. - /// - public void MainLoop() - { - NDalicManualPINVOKE.WidgetApplication_MainLoop(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - { - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - /// - /// This quits the application. - /// Tizen applications should use Lower to improve re-start performance unless they need to Quit completely. - /// - public void Quit() - { - NDalicManualPINVOKE.WidgetApplication_Quit(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// - /// Get path application resources are stored at. - /// - /// The full path of the resources - public static string GetResourcePath() - { - string ret = NDalicManualPINVOKE.WidgetApplication_GetResourcePath(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Get region information from device. - /// - /// Region information - public string GetRegion() - { - string ret = NDalicManualPINVOKE.WidgetApplication_GetRegion(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + WidgetApplication ret = new WidgetApplication(widgetIntPtr, false); - /// - /// Get language from device. - /// - /// Language information - public string GetLanguage() - { - string ret = NDalicManualPINVOKE.WidgetApplication_GetLanguage(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Event arguments that passed via widget app event signal. - /// - /// 4 - public class WidgetApplicationEventArgs : EventArgs - { - /// - /// Widget application. - /// - /// 4 - public WidgetApplication WidgetApplication - { - get; - set; - } - } - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void InitCallbackType(IntPtr widgetApplication); - private InitCallbackType _initCallback; - private DaliEventHandler _initEventHandler; - - /// - /// Init event. - /// - public event DaliEventHandler Init - { - add - { - if (_initEventHandler == null) - { - _initCallback = new InitCallbackType( OnInit); - InitSignal().Connect(_initCallback); - } - - _initEventHandler += value; - } - - remove - { - _initEventHandler -= value; - - if (_initEventHandler == null && InitSignal().Empty() == false) - { - InitSignal().Disconnect(_initCallback); - } - } - } - private void OnInit(IntPtr widgetApplication) - { - WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); - if (widgetApplication != null) - { - e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); - } - - if (_initEventHandler != null) - { - _initEventHandler(this, e); - } - } - - internal AppSignalType InitSignal() - { - AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_InitSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void TerminateCallbackType(IntPtr widgetApplication); - private TerminateCallbackType _terminateCallback; - private DaliEventHandler _terminateEventHandler; - - /// - /// Terminate event. - /// - public event DaliEventHandler Terminate - { - add - { - if (_terminateEventHandler == null) - { - _terminateCallback = new TerminateCallbackType( OnTerminate); - TerminateSignal().Connect(_terminateCallback); - } - - _terminateEventHandler += value; - } - - remove - { - _terminateEventHandler -= value; - - if (_terminateEventHandler == null && TerminateSignal().Empty() == false) - { - TerminateSignal().Disconnect(_terminateCallback); - } - } - } - - private void OnTerminate(IntPtr widgetApplication) - { - WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); - - if (widgetApplication != null) - { - e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); - } - - if (_terminateEventHandler != null) - { - _terminateEventHandler(this, e); - } - } - - internal AppSignalType TerminateSignal() + internal WidgetApplication(WidgetApplication widgetApplication) : this(NDalicManualPINVOKE.new_WidgetApplication__SWIG_1(WidgetApplication.getCPtr(widgetApplication)), true) { - AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_TerminateSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void LanguageChangedCallbackType(IntPtr widgetApplication); - private LanguageChangedCallbackType _languageChangedCallback; - private DaliEventHandler _languageChangedEventHandler; - - /// - /// LanguageChanged event. - /// - public event DaliEventHandler LanguageChanged - { - add - { - if (_languageChangedEventHandler == null) - { - _languageChangedCallback = new LanguageChangedCallbackType( OnLanguageChanged); - LanguageChangedSignal().Connect(_languageChangedCallback); - } - - _languageChangedEventHandler += value; - } - - remove - { - _languageChangedEventHandler -= value; - - if (_languageChangedEventHandler == null && LanguageChangedSignal().Empty() == false) - { - LanguageChangedSignal().Disconnect(_languageChangedCallback); - } - } } - private void OnLanguageChanged(IntPtr widgetApplication) - { - WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); - - if (widgetApplication != null) - { - e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); - } - - if (_languageChangedEventHandler != null) - { - _languageChangedEventHandler(this, e); - } - } - - internal AppSignalType LanguageChangedSignal() + internal WidgetApplication Assign(WidgetApplication widgetApplication) { - AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_LanguageChangedSignal(swigCPtr), false); + WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_Assign(swigCPtr, WidgetApplication.getCPtr(widgetApplication)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void RegionChangedCallbackType(IntPtr widgetApplication); - private RegionChangedCallbackType _regionChangedCallback; - private DaliEventHandler _regionChangedEventHandler; - - /// - /// RegionChanged event. - /// - public event DaliEventHandler RegionChanged + public void RegisterWidgetCreatingFunction() { - add - { - if (_regionChangedEventHandler == null) - { - _regionChangedCallback = new RegionChangedCallbackType( OnRegionChanged ); - RegionChangedSignal().Connect(_regionChangedCallback); - } - - _regionChangedEventHandler += value; - } - - remove + foreach (KeyValuePair widgetInfo in _widgetInfo) { - _regionChangedEventHandler -= value; - - if (_regionChangedEventHandler == null && RegionChangedSignal().Empty() == false) - { - RegionChangedSignal().Disconnect(_regionChangedCallback); - } + string widgetName = widgetInfo.Value; + RegisterWidgetCreatingFunction(ref widgetName); } } - private void OnRegionChanged(IntPtr widgetApplication) + internal void RegisterWidgetCreatingFunction(ref string widgetName) { - WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + CreateWidgetFunctionDelegate newDelegate = new CreateWidgetFunctionDelegate(WidgetCreateFunction); - if (widgetApplication != null) - { - e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); - } + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(newDelegate); + CreateWidgetFunction createWidgetFunction = new CreateWidgetFunction(ip, true); - if (_regionChangedEventHandler != null) - { - _regionChangedEventHandler(this, e); - } - } - - internal AppSignalType RegionChangedSignal() - { - AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_RegionChangedSignal(swigCPtr), false); + NDalicManualPINVOKE.WidgetApplication_RegisterWidgetCreatingFunction(swigCPtr, ref widgetName, CreateWidgetFunction.getCPtr(createWidgetFunction)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void BatteryLowCallbackType(IntPtr widgetApplication); - private BatteryLowCallbackType _batteryLowCallback; - private DaliEventHandler _batteryLowEventHandler; - - /// - /// BatteryLow event. - /// - public event DaliEventHandler BatteryLow + public void AddWidgetInstance( Widget widget ) { - add - { - if (_batteryLowEventHandler == null) - { - _batteryLowCallback = new BatteryLowCallbackType( OnBatteryLow ); - BatteryLowSignal().Connect(_batteryLowCallback); - } - - _batteryLowEventHandler += value; - } - - remove - { - _batteryLowEventHandler -= value; - - if (_batteryLowEventHandler == null && BatteryLowSignal().Empty() == false) - { - BatteryLowSignal().Disconnect(_batteryLowCallback); - } - } + _widgetList.Add(widget); } - private void OnBatteryLow(IntPtr widgetApplication) + public void RegisterWidgetInfo(Dictionary widgetInfo) { - WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); - - if (widgetApplication != null) - { - e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); - } - - if (_batteryLowEventHandler != null) - { - _batteryLowEventHandler(this, e); - } + _widgetInfo = widgetInfo; } - internal WidgetApplicationLowBatterySignalType BatteryLowSignal() + public static System.IntPtr WidgetCreateFunction(ref string widgetName) { - WidgetApplicationLowBatterySignalType ret = new WidgetApplicationLowBatterySignalType(NDalicManualPINVOKE.WidgetApplication_LowBatterySignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void MemoryLowCallbackType(IntPtr widgetApplication); - private MemoryLowCallbackType _memoryLowCallback; - private DaliEventHandler _memoryLowEventHandler; + Dictionary widgetInfo = Instance.WidgetInfo; - /// - /// MemoryLow event. - /// - public event DaliEventHandler MemoryLow - { - add + foreach (System.Type widgetType in widgetInfo.Keys) { - if (_memoryLowEventHandler == null) + if (widgetInfo[widgetType] == widgetName) { - _memoryLowCallback = new MemoryLowCallbackType (OnMemoryLow); - MemoryLowSignal().Connect(_memoryLowCallback); + Widget widget = Activator.CreateInstance(widgetType) as Widget; + if (widget) + { + return widget.GetIntPtr(); + } } - - _memoryLowEventHandler += value; } - remove - { - _memoryLowEventHandler -= value; - - if (_memoryLowEventHandler == null && MemoryLowSignal().Empty() == false) - { - MemoryLowSignal().Disconnect(_memoryLowCallback); - } - } + return IntPtr.Zero; } - private void OnMemoryLow(IntPtr widgetApplication) + public Dictionary WidgetInfo { - WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); - - if (widgetApplication != null) - { - e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); - } - - if (_memoryLowEventHandler != null) + get { - _memoryLowEventHandler(this, e); + return _widgetInfo; } } - - internal WidgetApplicationLowMemorySignalType MemoryLowSignal() - { - WidgetApplicationLowMemorySignalType ret = new WidgetApplicationLowMemorySignalType(NDalicManualPINVOKE.WidgetApplication_LowMemorySignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - private static WidgetApplication _instance; //singleton - } - } diff --git a/src/Tizen.NUI/src/internal/WidgetApplicationLowBatterySignalType.cs b/src/Tizen.NUI/src/internal/WidgetApplicationLowBatterySignalType.cs deleted file mode 100755 index 3240acf..0000000 --- a/src/Tizen.NUI/src/internal/WidgetApplicationLowBatterySignalType.cs +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - /// - /// LowBatterySignalType. - /// - internal class WidgetApplicationLowBatterySignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - /// - /// swigCMemOwn. - /// - protected bool swigCMemOwn; - - internal WidgetApplicationLowBatterySignalType(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(WidgetApplicationLowBatterySignalType 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. - /// - protected bool disposed = false; - - - /// - /// Distructor. - /// - ~WidgetApplicationLowBatterySignalType() - { - 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); - } - } - - /// - /// you can override it to clean-up your own resources. - /// - /// DisposeTypes - /// 3 - 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.WidgetApplication_delete_LowBatterySignalType(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - disposed = true; - } - - /// - /// Empty - /// - /// true if there is no signal attached - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// GetConnectionCount - /// - /// number of attached signals - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// signal connect - /// - /// - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - /// - /// signal disconnect - /// - /// - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - internal void Emit(Application.BatteryStatus arg) - { - NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Emit(swigCPtr, (int)arg); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// - /// LowBatterySignalType - /// - public WidgetApplicationLowBatterySignalType() : this(NDalicManualPINVOKE.WidgetApplication_new_LowBatterySignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} - diff --git a/src/Tizen.NUI/src/internal/WidgetApplicationLowMemorySignalType.cs b/src/Tizen.NUI/src/internal/WidgetApplicationLowMemorySignalType.cs deleted file mode 100755 index b943ede..0000000 --- a/src/Tizen.NUI/src/internal/WidgetApplicationLowMemorySignalType.cs +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class WidgetApplicationLowMemorySignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetApplicationLowMemorySignalType(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(WidgetApplicationLowMemorySignalType 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. - protected bool disposed = false; - - ~WidgetApplicationLowMemorySignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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.WidgetApplication_delete_LowMemorySignalType(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - internal void Emit(Application.MemoryStatus arg) - { - NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Emit(swigCPtr, (int)arg); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetApplicationLowMemorySignalType() : this(NDalicManualPINVOKE.WidgetApplication_new_LowMemorySignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/internal/WidgetCreateSignalType.cs b/src/Tizen.NUI/src/internal/WidgetCreateSignalType.cs deleted file mode 100755 index 9bdb099..0000000 --- a/src/Tizen.NUI/src/internal/WidgetCreateSignalType.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class WidgetCreateSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetCreateSignalType(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(WidgetCreateSignalType 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. - protected bool disposed = false; - - ~WidgetCreateSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_WidgetCreateSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetCreateSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetCreateSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetCreateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetCreateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(string arg1, SWIGTYPE_p_bundle arg2, Window arg3) - { - NDalicManualPINVOKE.WidgetCreateSignalType_Emit(swigCPtr, arg1, SWIGTYPE_p_bundle.getCPtr(arg2), Window.getCPtr(arg3)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetCreateSignalType() : this(NDalicManualPINVOKE.new_WidgetCreateSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/internal/WidgetImpl.cs b/src/Tizen.NUI/src/internal/WidgetImpl.cs new file mode 100755 index 0000000..4d249ae --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetImpl.cs @@ -0,0 +1,406 @@ +/* + * 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.ComponentModel; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + internal class WidgetImpl : BaseObject + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetImpl() : this( NDalicManualPINVOKE.WidgetImpl_New(), true ) + { + SwigDirectorConnect(); + } + + internal WidgetImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetImpl_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetImpl obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override 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; + //throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class WIdgetInstanceOnCreateArgs : EventArgs + { + private string _contentInfo; + private Window _window; + + public string ContentInfo + { + get + { + return _contentInfo; + } + set + { + _contentInfo = value; + } + } + + public Window Window + { + get + { + return _window; + } + set + { + _window = value; + } + } + } + + private EventHandler _widgetInstanceOnCreateEventHandler; + public event EventHandler WidgetInstanceCreated + { + add + { + _widgetInstanceOnCreateEventHandler += value; + } + remove + { + _widgetInstanceOnCreateEventHandler -= value; + } + } + + public class WIdgetInstanceOnDestroyArgs : EventArgs + { + private string _contentInfo; + private Widget.TerminationType _terminateType; + + public string ContentInfo + { + get + { + return _contentInfo; + } + set + { + _contentInfo = value; + } + } + + public Widget.TerminationType TerminateType + { + get + { + return _terminateType; + } + set + { + _terminateType = value; + } + } + } + + private EventHandler _widgetInstanceOnDestroyEventHandler; + public event EventHandler WidgetInstanceDestroyed + { + add + { + _widgetInstanceOnDestroyEventHandler += value; + } + remove + { + _widgetInstanceOnDestroyEventHandler -= value; + } + } + + public class WidgetInstanceOnResizeArgs : EventArgs + { + private Window _window; + + public Window Window + { + get + { + return _window; + } + set + { + _window = value; + } + } + } + + private EventHandler _widgetInstanceOnResizeEventHandler; + public event EventHandler WidgetInstanceResized + { + add + { + _widgetInstanceOnResizeEventHandler += value; + } + remove + { + _widgetInstanceOnResizeEventHandler -= value; + } + } + + private EventHandler _widgetInstanceOnPauseEventHandler; + public event EventHandler WidgetInstancePaused + { + add + { + _widgetInstanceOnPauseEventHandler += value; + } + remove + { + _widgetInstanceOnPauseEventHandler -= value; + } + } + + private EventHandler _widgetInstanceOnResumeEventHandler; + public event EventHandler WidgetInstanceResumed + { + add + { + _widgetInstanceOnResumeEventHandler += value; + } + remove + { + _widgetInstanceOnResumeEventHandler -= value; + } + } + + public class WidgetInstanceOnUpdateArgs : EventArgs + { + private string _contentInfo; + private int _force; + + public string ContentInfo + { + get + { + return _contentInfo; + } + set + { + _contentInfo = value; + } + } + + public int Force + { + get + { + return _force; + } + set + { + _force = value; + } + } + } + + private EventHandler _widgetInstanceOnUpdateEventHandler; + public event EventHandler WidgetInstanceUpdated + { + add + { + _widgetInstanceOnUpdateEventHandler += value; + } + remove + { + _widgetInstanceOnUpdateEventHandler -= value; + } + } + + public virtual void OnCreate(string contentInfo, Window window) + { + WIdgetInstanceOnCreateArgs args = new WIdgetInstanceOnCreateArgs(); + args.ContentInfo = contentInfo; + args.Window = window; + _widgetInstanceOnCreateEventHandler?.Invoke(this, args); + } + + public virtual void OnTerminate(string contentInfo, Widget.TerminationType type) + { + WIdgetInstanceOnDestroyArgs args = new WIdgetInstanceOnDestroyArgs(); + args.ContentInfo = contentInfo; + args.TerminateType = type; + _widgetInstanceOnDestroyEventHandler?.Invoke(this,args); + } + + public virtual void OnPause() + { + _widgetInstanceOnPauseEventHandler?.Invoke(this, new EventArgs()); + } + + public virtual void OnResume() + { + _widgetInstanceOnResumeEventHandler?.Invoke(this, new EventArgs()); + } + + public virtual void OnResize(Window window) + { + WidgetInstanceOnResizeArgs args = new WidgetInstanceOnResizeArgs(); + args.Window = window; + _widgetInstanceOnResizeEventHandler?.Invoke(this, args); + } + + public virtual void OnUpdate(string contentInfo, int force) + { + WidgetInstanceOnUpdateArgs args = new WidgetInstanceOnUpdateArgs(); + args.ContentInfo = contentInfo; + args.Force = force; + _widgetInstanceOnUpdateEventHandler?.Invoke(this, args); + } + + internal virtual void SignalConnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + } + + internal virtual void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + } + + public void SetContentInfo(string contentInfo) + { + NDalicManualPINVOKE.WidgetImpl_SetContentInfo(swigCPtr, contentInfo); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetImpl(SWIGTYPE_p_Dali__Widget__Impl impl) + { + NDalicManualPINVOKE.WidgetImpl_SetImpl(swigCPtr, SWIGTYPE_p_Dali__Widget__Impl.getCPtr(impl)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private void SwigDirectorConnect() + { + swigDelegate0 = new SwigDelegateWidgetImpl_0(SwigDirectorOnCreate); + swigDelegate1 = new SwigDelegateWidgetImpl_1(SwigDirectorOnTerminate); + swigDelegate2 = new SwigDelegateWidgetImpl_2(SwigDirectorOnPause); + swigDelegate3 = new SwigDelegateWidgetImpl_3(SwigDirectorOnResume); + swigDelegate4 = new SwigDelegateWidgetImpl_4(SwigDirectorOnResize); + swigDelegate5 = new SwigDelegateWidgetImpl_5(SwigDirectorOnUpdate); + swigDelegate6 = new SwigDelegateWidgetImpl_6(SwigDirectorSignalConnected); + swigDelegate7 = new SwigDelegateWidgetImpl_7(SwigDirectorSignalDisconnected); + NDalicManualPINVOKE.WidgetImpl_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3, swigDelegate4, swigDelegate5, swigDelegate6, swigDelegate7); + } + + private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) + { + global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null); + bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(WidgetImpl)); + return hasDerivedMethod; + } + + private void SwigDirectorOnCreate(string contentInfo, global::System.IntPtr window) + { + OnCreate(contentInfo, new Window(window, true)); + } + + private void SwigDirectorOnTerminate(string contentInfo, int type) + { + OnTerminate(contentInfo, (Widget.TerminationType)type); + } + + private void SwigDirectorOnPause() + { + OnPause(); + } + + private void SwigDirectorOnResume() + { + OnResume(); + } + + private void SwigDirectorOnResize(global::System.IntPtr window) + { + OnResize(new Window(window, true)); + } + + private void SwigDirectorOnUpdate(string contentInfo, int force) + { + OnUpdate(contentInfo, force); + } + + private void SwigDirectorSignalConnected(global::System.IntPtr slotObserver, global::System.IntPtr callback) + { + SignalConnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false)); + } + + private void SwigDirectorSignalDisconnected(global::System.IntPtr slotObserver, global::System.IntPtr callback) + { + SignalDisconnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false)); + } + + public delegate void SwigDelegateWidgetImpl_0(string contentInfo, global::System.IntPtr window); + public delegate void SwigDelegateWidgetImpl_1(string contentInfo, int type); + public delegate void SwigDelegateWidgetImpl_2(); + public delegate void SwigDelegateWidgetImpl_3(); + public delegate void SwigDelegateWidgetImpl_4(global::System.IntPtr window); + public delegate void SwigDelegateWidgetImpl_5(string contentInfo, int force); + public delegate void SwigDelegateWidgetImpl_6(global::System.IntPtr slotObserver, global::System.IntPtr callback); + public delegate void SwigDelegateWidgetImpl_7(global::System.IntPtr slotObserver, global::System.IntPtr callback); + + private SwigDelegateWidgetImpl_0 swigDelegate0; + private SwigDelegateWidgetImpl_1 swigDelegate1; + private SwigDelegateWidgetImpl_2 swigDelegate2; + private SwigDelegateWidgetImpl_3 swigDelegate3; + private SwigDelegateWidgetImpl_4 swigDelegate4; + private SwigDelegateWidgetImpl_5 swigDelegate5; + private SwigDelegateWidgetImpl_6 swigDelegate6; + private SwigDelegateWidgetImpl_7 swigDelegate7; + + private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(string), typeof(Window) }; + private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(string), typeof(Widget.TerminationType) }; + private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes3 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes4 = new global::System.Type[] { typeof(Window) }; + private static global::System.Type[] swigMethodTypes5 = new global::System.Type[] { typeof(string), typeof(int) }; + private static global::System.Type[] swigMethodTypes6 = new global::System.Type[] { typeof(SlotObserver), typeof(SWIGTYPE_p_Dali__CallbackBase) }; + private static global::System.Type[] swigMethodTypes7 = new global::System.Type[] { typeof(SlotObserver), typeof(SWIGTYPE_p_Dali__CallbackBase) }; + } +} diff --git a/src/Tizen.NUI/src/internal/WidgetImplPtr.cs b/src/Tizen.NUI/src/internal/WidgetImplPtr.cs new file mode 100755 index 0000000..3f49a8a --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetImplPtr.cs @@ -0,0 +1,39 @@ +/* + * 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. + * + */ +namespace Tizen.NUI +{ + + internal class WidgetImplPtr + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetImplPtr(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected WidgetImplPtr() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetImplPtr obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } +} diff --git a/src/Tizen.NUI/src/internal/WidgetPauseSignalType.cs b/src/Tizen.NUI/src/internal/WidgetPauseSignalType.cs deleted file mode 100755 index df85d46..0000000 --- a/src/Tizen.NUI/src/internal/WidgetPauseSignalType.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class WidgetPauseSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetPauseSignalType(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(WidgetPauseSignalType 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. - protected bool disposed = false; - - ~WidgetPauseSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_WidgetPauseSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetPauseSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetPauseSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetPauseSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetPauseSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(string arg) - { - NDalicManualPINVOKE.WidgetPauseSignalType_Emit(swigCPtr, arg); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetPauseSignalType() : this(NDalicManualPINVOKE.new_WidgetPauseSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/internal/WidgetResizeSignalType.cs b/src/Tizen.NUI/src/internal/WidgetResizeSignalType.cs deleted file mode 100755 index 5d29bcf..0000000 --- a/src/Tizen.NUI/src/internal/WidgetResizeSignalType.cs +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class WidgetResizeSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetResizeSignalType(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(WidgetResizeSignalType 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. - protected bool disposed = false; - - ~WidgetResizeSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_WidgetResizeSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetResizeSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetResizeSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetResizeSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetResizeSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(string arg1, Window arg2) - { - NDalicManualPINVOKE.WidgetResizeSignalType_Emit(swigCPtr, arg1, Window.getCPtr(arg2)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetResizeSignalType() : this(NDalicManualPINVOKE.new_WidgetResizeSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/internal/WidgetResumeSignalType.cs b/src/Tizen.NUI/src/internal/WidgetResumeSignalType.cs deleted file mode 100755 index 18f320d..0000000 --- a/src/Tizen.NUI/src/internal/WidgetResumeSignalType.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class WidgetResumeSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetResumeSignalType(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(WidgetResumeSignalType 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. - protected bool disposed = false; - - ~WidgetResumeSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_WidgetResumeSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetResumeSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetResumeSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetResumeSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetResumeSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(string arg) - { - NDalicManualPINVOKE.WidgetResumeSignalType_Emit(swigCPtr, arg); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetResumeSignalType() : this(NDalicManualPINVOKE.new_WidgetResumeSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/internal/WidgetTerminateSignalType.cs b/src/Tizen.NUI/src/internal/WidgetTerminateSignalType.cs deleted file mode 100755 index feda42c..0000000 --- a/src/Tizen.NUI/src/internal/WidgetTerminateSignalType.cs +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - * - */ -namespace Tizen.NUI -{ - - internal class WidgetTerminateSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetTerminateSignalType(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(WidgetTerminateSignalType 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. - protected bool disposed = false; - - ~WidgetTerminateSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_WidgetTerminateSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetTerminateSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetTerminateSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetTerminateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetTerminateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(string arg1, SWIGTYPE_p_bundle arg2, Widget.WidgetTerminateType arg3) - { - NDalicManualPINVOKE.WidgetTerminateSignalType_Emit(swigCPtr, arg1, SWIGTYPE_p_bundle.getCPtr(arg2), (int)arg3); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetTerminateSignalType() : this(NDalicManualPINVOKE.new_WidgetTerminateSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/internal/WidgetUpdateSignalType.cs b/src/Tizen.NUI/src/internal/WidgetUpdateSignalType.cs deleted file mode 100755 index 89fe674..0000000 --- a/src/Tizen.NUI/src/internal/WidgetUpdateSignalType.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - * - */ - -namespace Tizen.NUI -{ - - internal class WidgetUpdateSignalType : global::System.IDisposable - { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal WidgetUpdateSignalType(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(WidgetUpdateSignalType 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. - protected bool disposed = false; - - ~WidgetUpdateSignalType() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - 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); - } - } - - 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) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_WidgetUpdateSignalType(swigCPtr); - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; - } - - public bool Empty() - { - bool ret = NDalicManualPINVOKE.WidgetUpdateSignalType_Empty(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public uint GetConnectionCount() - { - uint ret = NDalicManualPINVOKE.WidgetUpdateSignalType_GetConnectionCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public void Connect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetUpdateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Disconnect(System.Delegate func) - { - System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); - { - NDalicManualPINVOKE.WidgetUpdateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - } - - public void Emit(string arg1, SWIGTYPE_p_bundle arg2, int arg3) - { - NDalicManualPINVOKE.WidgetUpdateSignalType_Emit(swigCPtr, arg1, SWIGTYPE_p_bundle.getCPtr(arg2), arg3); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - public WidgetUpdateSignalType() : this(NDalicManualPINVOKE.new_WidgetUpdateSignalType(), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - } - -} diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs index 9caa1ee..6bd8eee 100755 --- a/src/Tizen.NUI/src/public/Animation.cs +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -37,6 +37,9 @@ namespace Tizen.NUI internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + + _animationFinishedEventCallback = OnFinished; + _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_animationFinishedEventCallback); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj) @@ -50,6 +53,20 @@ namespace Tizen.NUI /// 3 protected override void Dispose(DisposeTypes type) { + if (this != null) + { + if (_animationFinishedEventCallback != null) + { + FinishedSignal().Disconnect(_finishedCallbackOfNative); + } + + if (_animationProgressReachedEventCallback != null) + { + + ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback); + } + } + if(disposed) { return; @@ -66,24 +83,7 @@ namespace Tizen.NUI } - if (_animationFinishedEventCallback != null) - { - FinishedSignal().Disconnect(_animationFinishedEventCallback); - } - - if (_animationProgressReachedEventCallback != null) - { - - ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback); - } - - if(this) - { - this.Clear(); - this.Reset(); - NUILog.Error("Now Animation is playing! Clear and Reset here!"); - //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable"); - } + this?.Clear(); //Release your own unmanaged resources here. //You should not access any managed member here except static instance. @@ -120,6 +120,9 @@ namespace Tizen.NUI [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void AnimationFinishedEventCallbackType(IntPtr data); private event EventHandler _animationFinishedEventHandler; + + private System.IntPtr _finishedCallbackOfNative; + /** * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler. * The finished signal is emitted when an animation's animations have finished. @@ -129,12 +132,9 @@ namespace Tizen.NUI { add { - if (_animationFinishedEventHandler == null) + if (_animationFinishedEventHandler == null && disposed == false) { - NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); - _animationFinishedEventCallback = OnFinished; - FinishedSignal().Connect(_animationFinishedEventCallback); - NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + FinishedSignal().Connect(_finishedCallbackOfNative); } _animationFinishedEventHandler += value; } @@ -144,9 +144,7 @@ namespace Tizen.NUI if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false) { - NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); - FinishedSignal().Disconnect(_animationFinishedEventCallback); - NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + FinishedSignal().Disconnect(_finishedCallbackOfNative); } } } @@ -174,10 +172,8 @@ namespace Tizen.NUI { if (_animationProgressReachedEventHandler == null) { - NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); _animationProgressReachedEventCallback = OnProgressReached; ProgressReachedSignal().Connect(_animationProgressReachedEventCallback); - NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); } _animationProgressReachedEventHandler += value; @@ -188,9 +184,7 @@ namespace Tizen.NUI if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false) { - NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback); - NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 84f4b62..89ab4c2 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2018 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. @@ -162,6 +162,10 @@ namespace Tizen.NUI.BaseComponents internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get(); internal static readonly int PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.ImageView_Property_PRE_MULTIPLIED_ALPHA_get(); internal static readonly int PIXEL_AREA = NDalicPINVOKE.ImageView_Property_PIXEL_AREA_get(); + internal static readonly int ACTION_RELOAD = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get(); + internal static readonly int ACTION_PLAY = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_PLAY_get(); + internal static readonly int ACTION_PAUSE = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_PAUSE_get(); + internal static readonly int ACTION_STOP = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_STOP_get(); } /// @@ -233,6 +237,50 @@ namespace Tizen.NUI.BaseComponents } /// + /// Force reloading of the image, all visuals using this image will get the latest one. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Reload() + { + this.DoAction(ImageView.Property.IMAGE, Property.ACTION_RELOAD, new PropertyValue(0)); + } + + /// + /// Play the animated GIF. This is also Default playback mode. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Play() + { + this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PLAY, new PropertyValue(0)); + } + + /// + /// Pause the animated GIF. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Pause() + { + this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PAUSE, new PropertyValue(0)); + } + + /// + /// Stop the animated GIF. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Stop() + { + this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0)); + } + + /// /// ImageView ResourceUrl, type string. /// /// 3 diff --git a/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs b/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs index 83093a0..1d5c589 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs @@ -63,8 +63,10 @@ namespace Tizen.NUI.BaseComponents //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. - - DisConnectFromSignals(); + if (this != null) + { + DisConnectFromSignals(); + } if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/src/Tizen.NUI/src/public/BaseComponents/TableView.cs b/src/Tizen.NUI/src/public/BaseComponents/TableView.cs index f4801fa..be2115c 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TableView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TableView.cs @@ -17,6 +17,7 @@ using System; using System.ComponentModel; +using System.Runtime.InteropServices; namespace Tizen.NUI.BaseComponents { @@ -49,12 +50,12 @@ namespace Tizen.NUI.BaseComponents /// 3 protected override void Dispose(DisposeTypes type) { - if(disposed) + if (disposed) { return; } - if(type == DisposeTypes.Explicit) + if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. @@ -135,7 +136,7 @@ namespace Tizen.NUI.BaseComponents /// 3 ~CellPosition() { - if(!isDisposeQueued) + if (!isDisposeQueued) { isDisposeQueued = true; DisposeQueue.Instance.Add(this); @@ -177,7 +178,7 @@ namespace Tizen.NUI.BaseComponents return; } - if(type == DisposeTypes.Explicit) + if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. @@ -378,8 +379,12 @@ namespace Tizen.NUI.BaseComponents /// 3 public View GetChildAt(TableView.CellPosition position) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.TableView_GetChildAt(swigCPtr, TableView.CellPosition.getCPtr(position)); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -393,8 +398,12 @@ namespace Tizen.NUI.BaseComponents /// 3 public View RemoveChildAt(TableView.CellPosition position) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.TableView_RemoveChildAt(swigCPtr, TableView.CellPosition.getCPtr(position)); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 1bec44e..0cb1d41 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -68,7 +68,7 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - if (_textEditorTextChangedCallbackDelegate != null) + if (this != null && _textEditorTextChangedCallbackDelegate != null) { TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate); } @@ -297,11 +297,12 @@ namespace Tizen.NUI.BaseComponents internal static readonly int SCROLL_BAR_FADE_DURATION = NDalicManualPINVOKE.TextEditor_Property_SCROLL_BAR_FADE_DURATION_get(); internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextEditor_Property_PIXEL_SIZE_get(); internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextEditor_Property_LINE_COUNT_get(); - internal static readonly int PLACEHOLDER_TEXT = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_TEXT_get(); - internal static readonly int PLACEHOLDER_TEXT_COLOR = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get(); internal static readonly int ENABLE_SELECTION = NDalicManualPINVOKE.TextEditor_Property_ENABLE_SELECTION_get(); internal static readonly int PLACEHOLDER = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_get(); internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextEditor_Property_LINE_WRAP_MODE_get(); + internal static readonly int PLACEHOLDER_TEXT = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_TEXT_get(); + internal static readonly int PLACEHOLDER_TEXT_COLOR = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get(); + internal static readonly int ENABLE_SHIFT_SELECTION = NDalicManualPINVOKE.TextEditor_Property_ENABLE_SHIFT_SELECTION_get(); } internal class InputStyle @@ -1411,6 +1412,27 @@ namespace Tizen.NUI.BaseComponents } } - } + /// + /// Enables Text selection using Shift key. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool EnableShiftSelection + { + get + { + // mShiftSelectionFlag( true ) + bool temp = true; + GetProperty(TextEditor.Property.ENABLE_SHIFT_SELECTION).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.ENABLE_SHIFT_SELECTION, new Tizen.NUI.PropertyValue(value)); + } + } + + } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index 4cf304e..d9a9c52 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -67,15 +67,17 @@ namespace Tizen.NUI.BaseComponents //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 (_textFieldMaxLengthReachedCallbackDelegate != null) + if (this != null) { - this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate); - } + if (_textFieldMaxLengthReachedCallbackDelegate != null) + { + this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate); + } - if (_textFieldTextChangedCallbackDelegate != null) - { - TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate); + if (_textFieldTextChangedCallbackDelegate != null) + { + TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate); + } } if (swigCPtr.Handle != global::System.IntPtr.Zero) @@ -286,6 +288,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int ENABLE_SELECTION = NDalicManualPINVOKE.TextField_Property_ENABLE_SELECTION_get(); internal static readonly int PLACEHOLDER = NDalicManualPINVOKE.TextField_Property_PLACEHOLDER_get(); internal static readonly int ELLIPSIS = NDalicManualPINVOKE.TextField_Property_ELLIPSIS_get(); + internal static readonly int ENABLE_SHIFT_SELECTION = NDalicManualPINVOKE.TextField_Property_ENABLE_SHIFT_SELECTION_get(); } internal class InputStyle @@ -1441,7 +1444,28 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// Enables Text selection using Shift key. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool EnableShiftSelection + { + get + { + // mShiftSelectionFlag( true ) + bool temp = true; + GetProperty(TextField.Property.ENABLE_SHIFT_SELECTION).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.ENABLE_SHIFT_SELECTION, new Tizen.NUI.PropertyValue(value)); + } + } - } + + } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 2cc141b..f8e39ea 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -111,6 +111,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextLabel_Property_LINE_COUNT_get(); internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextLabel_Property_LINE_WRAP_MODE_get(); internal static readonly int TEXT_DIRECTION = NDalicManualPINVOKE.TextLabel_Property_TEXT_DIRECTION_get(); + internal static readonly int VERTICAL_LINE_ALIGNMENT = NDalicManualPINVOKE.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get(); } /// @@ -822,6 +823,7 @@ namespace Tizen.NUI.BaseComponents /// The text direction. /// /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public TextDirection TextDirection { @@ -832,5 +834,26 @@ namespace Tizen.NUI.BaseComponents return (TextDirection)temp; } } + + /// + /// The text vertical line alignment. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public VerticalLineAlignment VerticalLineAlignment + { + get + { + int temp = 0; + GetProperty(TextLabel.Property.VERTICAL_LINE_ALIGNMENT).Get(out temp); + return (VerticalLineAlignment)temp; + } + set + { + SetProperty(TextLabel.Property.VERTICAL_LINE_ALIGNMENT, new Tizen.NUI.PropertyValue((int)value)); + } + } + } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs index 4c15f39..f17dd45 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs @@ -61,7 +61,7 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - if (_videoViewFinishedCallbackDelegate != null) + if (this != null && _videoViewFinishedCallbackDelegate != null) { FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs old mode 100755 new mode 100644 index 37d437e..6a73ab0 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -32,7 +32,10 @@ namespace Tizen.NUI.BaseComponents internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - PositionUsesPivotPoint = false; + if (HasBody()) + { + PositionUsesPivotPoint = false; + } } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj) @@ -49,11 +52,18 @@ namespace Tizen.NUI.BaseComponents /// 4 public override void Add(View child) { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - Children.Add(child); + Container oldParent = child.GetParent(); + if(oldParent != this) + { + if (oldParent != null) + { + oldParent.Remove(child); + } + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Children.Add(child); + } } /// @@ -104,9 +114,12 @@ namespace Tizen.NUI.BaseComponents /// 4 public override Container GetParent() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); - - BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle); + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -116,7 +129,7 @@ namespace Tizen.NUI.BaseComponents internal bool IsTopLevelView() { - if(GetParent() is Layer) + if (GetParent() is Layer) { return true; } @@ -130,12 +143,12 @@ namespace Tizen.NUI.BaseComponents /// 3 protected override void Dispose(DisposeTypes type) { - if(disposed) + if (disposed) { return; } - if(type == DisposeTypes.Explicit) + if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. @@ -145,8 +158,10 @@ namespace Tizen.NUI.BaseComponents //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. - - DisConnectFromSignals(); + if (this != null) + { + DisConnectFromSignals(); + } if (swigCPtr.Handle != global::System.IntPtr.Zero) { @@ -401,6 +416,12 @@ namespace Tizen.NUI.BaseComponents private bool OnKeyEvent(IntPtr view, IntPtr keyEvent) { + if (keyEvent == global::System.IntPtr.Zero) + { + NUILog.Error("keyEvent should not be null!"); + return true; + } + KeyEventArgs e = new KeyEventArgs(); bool result = false; @@ -412,9 +433,9 @@ namespace Tizen.NUI.BaseComponents Delegate[] delegateList = _keyEventHandler.GetInvocationList(); // Oring the result of each callback. - foreach ( EventHandlerWithReturnType del in delegateList ) + foreach (EventHandlerWithReturnType del in delegateList) { - result |= del( this, e ); + result |= del(this, e); } } @@ -528,6 +549,12 @@ namespace Tizen.NUI.BaseComponents // Callback for View TouchSignal private bool OnTouch(IntPtr view, IntPtr touchData) { + if (touchData == global::System.IntPtr.Zero) + { + NUILog.Error("touchData should not be null!"); + return true; + } + TouchEventArgs e = new TouchEventArgs(); e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData); @@ -603,6 +630,12 @@ namespace Tizen.NUI.BaseComponents // Callback for View Hover signal private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent) { + if (hoverEvent == global::System.IntPtr.Zero) + { + NUILog.Error("hoverEvent should not be null!"); + return true; + } + HoverEventArgs e = new HoverEventArgs(); e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent); @@ -678,6 +711,12 @@ namespace Tizen.NUI.BaseComponents // Callback for View Wheel signal private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent) { + if (wheelEvent == global::System.IntPtr.Zero) + { + NUILog.Error("wheelEvent should not be null!"); + return true; + } + WheelEventArgs e = new WheelEventArgs(); e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent); @@ -1358,7 +1397,7 @@ namespace Tizen.NUI.BaseComponents /// background visual, creates one with transparent black as it's mixColor. /// /// 3 - public Animation AnimateBackgroundColor( object destinationValue, + public Animation AnimateBackgroundColor(object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, @@ -1366,51 +1405,51 @@ namespace Tizen.NUI.BaseComponents { Tizen.NUI.PropertyMap background = Background; - if( background.Empty() ) + if (background.Empty()) { // If there is no background yet, ensure there is a transparent // color visual BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); background = Background; } - return AnimateColor( "background", destinationValue, startTime, endTime, alphaFunction, initialValue ); + return AnimateColor("background", destinationValue, startTime, endTime, alphaFunction, initialValue); } /// /// Creates an animation to animate the mixColor of the named visual. /// /// 3 - public Animation AnimateColor( string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null ) + public Animation AnimateColor(string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null) { Animation animation = null; { PropertyMap _animator = new PropertyMap(); - if( alphaFunction != null ) + if (alphaFunction != null) { - _animator.Add("alphaFunction", new PropertyValue( AlphaFunction.BuiltinToPropertyKey(alphaFunction) ) ); + _animator.Add("alphaFunction", new PropertyValue(AlphaFunction.BuiltinToPropertyKey(alphaFunction))); } PropertyMap _timePeriod = new PropertyMap(); - _timePeriod.Add( "duration", new PropertyValue((endTime-startTime)/1000.0f) ); - _timePeriod.Add( "delay", new PropertyValue( startTime/1000.0f ) ); - _animator.Add( "timePeriod", new PropertyValue( _timePeriod ) ); + _timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f)); + _timePeriod.Add("delay", new PropertyValue(startTime / 1000.0f)); + _animator.Add("timePeriod", new PropertyValue(_timePeriod)); PropertyMap _transition = new PropertyMap(); - _transition.Add( "animator", new PropertyValue( _animator ) ); - _transition.Add( "target", new PropertyValue( targetVisual ) ); - _transition.Add( "property", new PropertyValue( "mixColor" ) ); + _transition.Add("animator", new PropertyValue(_animator)); + _transition.Add("target", new PropertyValue(targetVisual)); + _transition.Add("property", new PropertyValue("mixColor")); - if( initialColor != null ) + if (initialColor != null) { - PropertyValue initValue = PropertyValue.CreateFromObject( initialColor ); - _transition.Add( "initialValue", initValue ); + PropertyValue initValue = PropertyValue.CreateFromObject(initialColor); + _transition.Add("initialValue", initValue); } - PropertyValue destValue = PropertyValue.CreateFromObject( destinationColor ); - _transition.Add( "targetValue", destValue ); - TransitionData _transitionData = new TransitionData( _transition ); + PropertyValue destValue = PropertyValue.CreateFromObject(destinationColor); + _transition.Add("targetValue", destValue); + TransitionData _transitionData = new TransitionData(_transition); - animation = new Animation( NDalicManualPINVOKE.View_CreateTransition(swigCPtr, TransitionData.getCPtr(_transitionData)), true ); + animation = new Animation(NDalicManualPINVOKE.View_CreateTransition(swigCPtr, TransitionData.getCPtr(_transitionData)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1452,7 +1491,7 @@ namespace Tizen.NUI.BaseComponents get { Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); - GetProperty( View.Property.BACKGROUND ).Get(temp); + GetProperty(View.Property.BACKGROUND).Get(temp); return temp; } set @@ -1478,21 +1517,21 @@ namespace Tizen.NUI.BaseComponents switch (temp) { case 0: - { - return States.Normal; - } + { + return States.Normal; + } case 1: - { - return States.Focused; - } + { + return States.Focused; + } case 2: - { - return States.Disabled; - } + { + return States.Disabled; + } default: - { - return States.Normal; - } + { + return States.Normal; + } } } set @@ -1532,25 +1571,25 @@ namespace Tizen.NUI.BaseComponents switch (value) { case States.Normal: - { - valueToString = "NORMAL"; - break; - } + { + valueToString = "NORMAL"; + break; + } case States.Focused: - { - valueToString = "FOCUSED"; - break; - } + { + valueToString = "FOCUSED"; + break; + } case States.Disabled: - { - valueToString = "DISABLED"; - break; - } + { + valueToString = "DISABLED"; + break; + } default: - { - valueToString = "NORMAL"; - break; - } + { + valueToString = "NORMAL"; + break; + } } SetProperty(View.Property.SUB_STATE, new Tizen.NUI.PropertyValue(valueToString)); } @@ -1786,25 +1825,25 @@ namespace Tizen.NUI.BaseComponents switch (value) { case Tizen.NUI.HorizontalAlignmentType.Left: - { - valueToString = "left"; - break; - } + { + valueToString = "left"; + break; + } case Tizen.NUI.HorizontalAlignmentType.Center: - { - valueToString = "center"; - break; - } + { + valueToString = "center"; + break; + } case Tizen.NUI.HorizontalAlignmentType.Right: - { - valueToString = "right"; - break; - } + { + valueToString = "right"; + break; + } default: - { - valueToString = "left"; - break; - } + { + valueToString = "left"; + break; + } } SetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } @@ -1842,25 +1881,25 @@ namespace Tizen.NUI.BaseComponents switch (value) { case Tizen.NUI.VerticalAlignmentType.Top: - { - valueToString = "top"; - break; - } + { + valueToString = "top"; + break; + } case Tizen.NUI.VerticalAlignmentType.Center: - { - valueToString = "center"; - break; - } + { + valueToString = "center"; + break; + } case Tizen.NUI.VerticalAlignmentType.Bottom: - { - valueToString = "bottom"; - break; - } + { + valueToString = "bottom"; + break; + } default: - { - valueToString = "top"; - break; - } + { + valueToString = "top"; + break; + } } SetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } @@ -1885,7 +1924,7 @@ namespace Tizen.NUI.BaseComponents } set { - if(value) + if (value) { LeftFocusableViewId = (int)value.GetId(); } @@ -1915,7 +1954,7 @@ namespace Tizen.NUI.BaseComponents } set { - if(value) + if (value) { RightFocusableViewId = (int)value.GetId(); } @@ -1945,7 +1984,7 @@ namespace Tizen.NUI.BaseComponents } set { - if(value) + if (value) { UpFocusableViewId = (int)value.GetId(); } @@ -1975,7 +2014,7 @@ namespace Tizen.NUI.BaseComponents } set { - if(value) + if (value) { DownFocusableViewId = (int)value.GetId(); } @@ -2118,10 +2157,6 @@ namespace Tizen.NUI.BaseComponents { Vector2 temp = new Vector2(0.0f, 0.0f); GetProperty(View.Property.SCREEN_POSITION).Get(temp); - // Dali's default layer is default center origin. need to change as top left. - // NUI's Layer is like a transparent film which covers entire window. (Layer is not an actor of Dali) - // otherwise, this makes ScreenPosition as wrong value. - temp -= (Window.Instance.GetSize() * 0.5f); return temp; } } @@ -2215,7 +2250,7 @@ namespace Tizen.NUI.BaseComponents /// Sets the sibling order of the view so the depth position can be defined within the same parent. /// /// - /// Note the initial value is 0. + /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0. /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order. /// The values set by this property will likely change. /// @@ -2224,13 +2259,58 @@ namespace Tizen.NUI.BaseComponents { get { - int temp = 0; - GetProperty(View.Property.SIBLING_ORDER).Get(out temp); - return temp; + var parentChildren = GetParent()?.Children; + int currentOrder = 0; + if (parentChildren != null) + { + currentOrder = parentChildren.IndexOf(this); + + if (currentOrder < 0) + { + return 0; + } + else if (currentOrder < parentChildren.Count) + { + return currentOrder; + } + } + + return 0; } set { - SetProperty(View.Property.SIBLING_ORDER, new Tizen.NUI.PropertyValue(value)); + if(value < 0) + { + NUILog.Error("SiblingOrder should be bigger than 0 or equal to 0."); + return; + } + var siblings = GetParent()?.Children; + if (siblings != null) + { + int currentOrder = siblings.IndexOf(this); + if (value != currentOrder) + { + if (value == 0) + { + LowerToBottom(); + } + else if (value < siblings.Count - 1) + { + if (value > currentOrder) + { + RaiseAbove(siblings[value]); + } + else + { + LowerBelow(siblings[value]); + } + } + else + { + RaiseToTop(); + } + } + } } } @@ -2306,46 +2386,47 @@ namespace Tizen.NUI.BaseComponents internal void Raise() { - var parentChildren = Parent?.Children; + var parentChildren = GetParent()?.Children; if (parentChildren != null) { int currentIndex = parentChildren.IndexOf(this); // If the view is not already the last item in the list. - if (currentIndex != parentChildren.Count -1) + if (currentIndex >= 0 && currentIndex < parentChildren.Count -1) { View temp = parentChildren[currentIndex + 1]; parentChildren[currentIndex + 1] = this; parentChildren[currentIndex] = temp; + + NDalicPINVOKE.Raise(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } - NDalicPINVOKE.Raise(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void Lower() { - var parentChildren = Parent?.Children; + var parentChildren = GetParent()?.Children; if (parentChildren != null) { int currentIndex = parentChildren.IndexOf(this); // If the view is not already the first item in the list. - if (currentIndex > 0) + if (currentIndex > 0 && currentIndex < parentChildren.Count) { View temp = parentChildren[currentIndex - 1]; parentChildren[currentIndex - 1] = this; parentChildren[currentIndex] = temp; + + NDalicPINVOKE.Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } - - NDalicPINVOKE.Lower(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// @@ -2358,17 +2439,18 @@ namespace Tizen.NUI.BaseComponents /// 3 public void RaiseToTop() { - var parentChildren = Parent?.Children; + var parentChildren = GetParent()?.Children; if (parentChildren != null) { parentChildren.Remove(this); parentChildren.Add(this); + + NDalicPINVOKE.RaiseToTop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - NDalicPINVOKE.RaiseToTop(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// @@ -2381,17 +2463,17 @@ namespace Tizen.NUI.BaseComponents /// 3 public void LowerToBottom() { - var parentChildren = Parent?.Children; + var parentChildren = GetParent()?.Children; if (parentChildren != null) { parentChildren.Remove(this); parentChildren.Insert(0, this); - } - NDalicPINVOKE.LowerToBottom(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + NDalicPINVOKE.LowerToBottom(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } } /// @@ -2418,24 +2500,31 @@ namespace Tizen.NUI.BaseComponents /// Will be raised above this view. internal void RaiseAbove(View target) { - var parentChildren = Parent?.Children; + var parentChildren = GetParent()?.Children; if (parentChildren != null) { int currentIndex = parentChildren.IndexOf(this); int targetIndex = parentChildren.IndexOf(target); + if(currentIndex < 0 || targetIndex < 0 || + currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count) + { + NUILog.Error("index should be bigger than 0 and less than children of layer count"); + return; + } // If the currentIndex is less than the target index and the target has the same parent. if (currentIndex < targetIndex) { parentChildren.Remove(this); parentChildren.Insert(targetIndex, this); + + NDalicPINVOKE.RaiseAbove(swigCPtr, View.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } - NDalicPINVOKE.RaiseAbove(swigCPtr, View.getCPtr(target)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// @@ -2448,12 +2537,18 @@ namespace Tizen.NUI.BaseComponents /// Will be lowered below this view. internal void LowerBelow(View target) { - var parentChildren = Parent?.Children; + var parentChildren = GetParent()?.Children; if (parentChildren != null) { int currentIndex = parentChildren.IndexOf(this); int targetIndex = parentChildren.IndexOf(target); + if(currentIndex < 0 || targetIndex < 0 || + currentIndex >= parentChildren.Count ||targetIndex >= parentChildren.Count) + { + NUILog.Error("index should be bigger than 0 and less than children of layer count"); + return; + } // If the currentIndex is not already the 0th index and the target has the same parent. if ((currentIndex != 0) && (targetIndex != -1) && @@ -2461,12 +2556,13 @@ namespace Tizen.NUI.BaseComponents { parentChildren.Remove(this); parentChildren.Insert(targetIndex, this); + + NDalicPINVOKE.LowerBelow(swigCPtr, View.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } - NDalicPINVOKE.LowerBelow(swigCPtr, View.getCPtr(target)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal string GetName() @@ -2515,8 +2611,12 @@ namespace Tizen.NUI.BaseComponents /// 5 public Layer GetLayer() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Actor_GetLayer(swigCPtr); - Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Layer ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Layer; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -2543,9 +2643,12 @@ namespace Tizen.NUI.BaseComponents /// 3 public View FindChildByName(string viewName) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Actor_FindChildByName(swigCPtr, viewName); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -2554,9 +2657,12 @@ namespace Tizen.NUI.BaseComponents internal View FindChildById(uint id) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -3150,8 +3256,12 @@ namespace Tizen.NUI.BaseComponents /// 3 public Renderer GetRendererAt(uint index) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index); - Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Renderer; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Renderer; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -3222,14 +3332,16 @@ namespace Tizen.NUI.BaseComponents return ret; } - internal ViewVisibilityChangedSignal VisibilityChangedSignal(View view) { + internal ViewVisibilityChangedSignal VisibilityChangedSignal(View view) + { ViewVisibilityChangedSignal ret = new ViewVisibilityChangedSignal(NDalicPINVOKE.VisibilityChangedSignal(View.getCPtr(view)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal ViewLayoutDirectionChangedSignal LayoutDirectionChangedSignal(View view) { + internal ViewLayoutDirectionChangedSignal LayoutDirectionChangedSignal(View view) + { ViewLayoutDirectionChangedSignal ret = new ViewLayoutDirectionChangedSignal(NDalicManualPINVOKE.LayoutDirectionChangedSignal(View.getCPtr(view)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -3824,13 +3936,13 @@ namespace Tizen.NUI.BaseComponents switch (temp) { case "NORMAL": - return DrawModeType.Normal; + return DrawModeType.Normal; case "OVERLAY_2D": - return DrawModeType.Overlay2D; + return DrawModeType.Overlay2D; case "STENCIL": - return DrawModeType.Stencil; + return DrawModeType.Stencil; default: - return DrawModeType.Normal; + return DrawModeType.Normal; } } set @@ -4123,13 +4235,13 @@ namespace Tizen.NUI.BaseComponents switch (temp) { case "DISABLED": - return ClippingModeType.Disabled; + return ClippingModeType.Disabled; case "CLIP_CHILDREN": - return ClippingModeType.ClipChildren; + return ClippingModeType.ClipChildren; case "CLIP_TO_BOUNDING_BOX": - return ClippingModeType.ClipToBoundingBox; + return ClippingModeType.ClipToBoundingBox; default: - return ClippingModeType.Disabled; + return ClippingModeType.Disabled; } } set @@ -4214,8 +4326,10 @@ namespace Tizen.NUI.BaseComponents { View ret; IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); - - BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle); + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (basehandle is Layer) { diff --git a/src/Tizen.NUI/src/public/BaseHandle.cs b/src/Tizen.NUI/src/public/BaseHandle.cs index 653043c..17cf9f4 100755 --- a/src/Tizen.NUI/src/public/BaseHandle.cs +++ b/src/Tizen.NUI/src/public/BaseHandle.cs @@ -37,15 +37,16 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); _registerMe = swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); // using copy constructor to create another native handle so Registry.Unregister works fine. swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.new_BaseHandle__SWIG_2(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (_registerMe) { + // Register this instance of BaseHandle in the registry. Registry.Register(this); } diff --git a/src/Tizen.NUI/src/public/FocusManager.cs b/src/Tizen.NUI/src/public/FocusManager.cs index d1d57b7..f8fd384 100755 --- a/src/Tizen.NUI/src/public/FocusManager.cs +++ b/src/Tizen.NUI/src/public/FocusManager.cs @@ -43,72 +43,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - /// - /// To make the FocusManager instance be disposed. - /// - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. - /// 3 - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override 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 (_focusedViewEnterKeyEventCallback2 != null) - { - FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback2); - } - - if (_focusedViewEnterKeyEventCallback != null) - { - FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback); - } - - if (_focusGroupChangedEventCallback != null) - { - FocusGroupChangedSignal().Disconnect(_focusGroupChangedEventCallback); - } - - if (_focusChangedEventCallback != null) - { - FocusChangedSignal().Disconnect(_focusChangedEventCallback); - } - - if (_preFocusChangeCallback != null) - { - PreFocusChangeSignal().Disconnect(_preFocusChangeCallback); - } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_FocusManager(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); - } - - /// /// Event arguments that passed via the PreFocusChange signal. /// @@ -515,9 +449,13 @@ namespace Tizen.NUI /// 3 public View GetCurrentFocusView() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; return ret; } @@ -619,17 +557,12 @@ namespace Tizen.NUI /// 3 public View GetFocusGroup(View view) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; - - - /*View ret = new View(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if (ret.HasBody() == false) - { - return null; - }*/ + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); return ret; } @@ -659,9 +592,12 @@ namespace Tizen.NUI internal View GetFocusIndicatorView() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); return ret; } diff --git a/src/Tizen.NUI/src/public/ImageLoading.cs b/src/Tizen.NUI/src/public/ImageLoading.cs new file mode 100755 index 0000000..b04a085 --- /dev/null +++ b/src/Tizen.NUI/src/public/ImageLoading.cs @@ -0,0 +1,329 @@ +/* + * 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.ComponentModel; + +namespace Tizen.NUI +{ + + /// + /// Loading an image. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class ImageLoading + { + /// + /// Load an image synchronously from local file. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. + /// The filtering method used when sampling pixels from the input image while fitting it to desired size. + /// Reorient the image to respect any orientation metadata in its header. + /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from local file. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. + /// The filtering method used when sampling pixels from the input image while fitting it to desired size. + /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from local file. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. + /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer LoadImageFromFile(string url, Size2D size, FittingModeType fittingMode) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from local file. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer LoadImageFromFile(string url, Size2D size) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from local file. + /// + /// The URL of the image file to load. + /// Handle to the loaded PixelBuffer object or an empty handle in case loading failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer LoadImageFromFile(string url) + { + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.LoadImageFromFile__SWIG_4(url), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters. + /// + /// The name of the image. + /// The requested size for the image + /// The method to use to map the source image to the desired dimensions. + /// The image filter to use if the image needs to be downsampled to the requested size. + /// Whether to use image metadata to rotate or flip the image, e.g., from portrait to landscape. + /// Dimensions that image will have if it is loaded with given parameters. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_0(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters. + /// + /// The name of the image. + /// The requested size for the image + /// The method to use to map the source image to the desired dimensions. + /// The image filter to use if the image needs to be downsampled to the requested size. + /// Dimensions that image will have if it is loaded with given parameters. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_1(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters. + /// + /// The name of the image. + /// The requested size for the image + /// The method to use to map the source image to the desired dimensions. + /// Dimensions that image will have if it is loaded with given parameters. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Size2D GetClosestImageSize(string filename, Size2D size, FittingModeType fittingMode) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_2(filename, Uint16Pair.getCPtr(uSize), (int)fittingMode), true); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters. + /// + /// The name of the image. + /// The requested size for the image + /// Dimensions that image will have if it is loaded with given parameters. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Size2D GetClosestImageSize(string filename, Size2D size) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_3(filename, Uint16Pair.getCPtr(uSize)), true); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determine the size of an image that LoadImageFromFile will provide when given the same image loading parameters. + /// + /// The name of the image. + /// Dimensions that image will have if it is loaded with given parameters. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Size2D GetClosestImageSize(string filename) + { + var val = new Uint16Pair(NDalicPINVOKE.GetClosestImageSize__SWIG_4(filename), true); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from a remote resource. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. + /// The filtering method used when sampling pixels from the input image while fitting it to desired size. + /// Reorient the image to respect any orientation metadata in its header. + /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_0(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from a remote resource. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. + /// The filtering method used when sampling pixels from the input image while fitting it to desired size. + /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_1(url, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from a remote resource. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// The method used to fit the shape of the image before loading to the shape defined by the size parameter. + /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer DownloadImageSynchronously(string url, Size2D size, FittingModeType fittingMode) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_2(url, Uint16Pair.getCPtr(uSize), (int)fittingMode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from a remote resource. + /// + /// The URL of the image file to load. + /// The width and height to fit the loaded image to, 0.0 means whole image. + /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer DownloadImageSynchronously(string url, Size2D size) + { + var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height); + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_3(url, Uint16Pair.getCPtr(uSize)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Load an image synchronously from a remote resource. + /// + /// The URL of the image file to load. + /// Handle to the loaded PixelBuffer object or an empty handle in case downloading or decoding failed. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelBuffer DownloadImageSynchronously(string url) + { + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.DownloadImageSynchronously__SWIG_4(url), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Set the maximum texture size. Then size can be kwown by GL_MAX_TEXTURE_SIZE. + /// + /// The maximum texture size to set. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static void SetMaxTextureSize(uint size) + { + NDalicPINVOKE.SetMaxTextureSize(size); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Get the maximum texture size. + /// + /// The maximum texture size. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static uint GetMaxTextureSize() + { + uint ret = NDalicPINVOKE.GetMaxTextureSize(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} diff --git a/src/Tizen.NUI/src/public/ImfManager.cs b/src/Tizen.NUI/src/public/ImfManager.cs index 226577c..61e364a 100755 --- a/src/Tizen.NUI/src/public/ImfManager.cs +++ b/src/Tizen.NUI/src/public/ImfManager.cs @@ -54,53 +54,6 @@ namespace Tizen.NUI } /// - /// Dispose - /// - /// Dispose Type - /// 3 - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override 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 (_keyboardTypeChangedEventCallback != null) - { - KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback); - } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_ImfManager(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero); - } - - base.Dispose(type); - } - - /// /// This structure is used to pass on data from the IMF regarding predictive text. /// /// 3 @@ -539,18 +492,6 @@ namespace Tizen.NUI } /// - /// Destroy the context of the IMF.
- ///
- /// 4 - /// Please do not use! This will be deprecated, instead please USE Tizen.NUI.ImfManager.Instance.DestroyContext()! - [Obsolete("Please do not use! This will be deprecated! Please use ImfManager.Instance.DestroyContext() instead!")] - [EditorBrowsable(EditorBrowsableState.Never)] - public void Finalize() - { - DestroyContext(); - } - - /// /// Retrieves a handle to the instance of the ImfManager. /// /// A handle to the ImfManager. diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index bfa0b8e..11f6f49 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -17,6 +17,7 @@ using System; using Tizen.NUI.BaseComponents; using System.ComponentModel; +using System.Runtime.InteropServices; namespace Tizen.NUI { @@ -49,11 +50,18 @@ namespace Tizen.NUI /// 4 public override void Add(View child) { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - Children.Add(child); + Container oldParent = child.GetParent(); + if (oldParent != this) + { + if (oldParent != null) + { + oldParent.Remove(child); + } + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Children.Add(child); + } } /// @@ -162,7 +170,6 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if(Window.Instance != null) { - this.SetParentOrigin(Tizen.NUI.ParentOrigin.TopLeft); this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions); } @@ -180,13 +187,6 @@ namespace Tizen.NUI throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void SetParentOrigin(Vector3 origin) - { - NDalicPINVOKE.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - /// /// Downcasts a handle to layer handle. /// @@ -212,8 +212,12 @@ namespace Tizen.NUI /// 3 public View FindChildById(uint id) { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -258,13 +262,16 @@ namespace Tizen.NUI { int currentIdx = parentChildren.IndexOf(this); - if (currentIdx != parentChildren.Count - 1) + if (currentIdx >= 0 && currentIdx < parentChildren.Count - 1) { RaiseAbove(parentChildren[currentIdx + 1]); Layer temp = parentChildren[currentIdx + 1]; parentChildren[currentIdx + 1] = this; parentChildren[currentIdx] = temp; + + NDalicPINVOKE.Layer_Raise(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } } @@ -280,7 +287,7 @@ namespace Tizen.NUI { int currentIdx = parentChildren.IndexOf(this); - if (currentIdx > 0) + if (currentIdx > 0 && currentIdx < parentChildren.Count) { LowerBelow(parentChildren[currentIdx - 1]); @@ -288,20 +295,66 @@ namespace Tizen.NUI parentChildren[currentIdx - 1] = this; parentChildren[currentIdx] = temp; + NDalicPINVOKE.Layer_Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } } internal void RaiseAbove(Layer target) { - NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + var parentChildren = Window.Instance.LayersChildren; + if (parentChildren != null) + { + int currentIndex = parentChildren.IndexOf(this); + int targetIndex = parentChildren.IndexOf(target); + + if(currentIndex < 0 || targetIndex < 0 || + currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count) + { + NUILog.Error("index should be bigger than 0 and less than children of layer count"); + return; + } + + // If the currentIndex is less than the target index and the target has the same parent. + if (currentIndex < targetIndex) + { + parentChildren.Remove(this); + parentChildren.Insert(targetIndex, this); + + NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } internal void LowerBelow(Layer target) { - NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + var parentChildren = Window.Instance.LayersChildren; + + if (parentChildren != null) + { + int currentIndex = parentChildren.IndexOf(this); + int targetIndex = parentChildren.IndexOf(target); + + if(currentIndex < 0 || targetIndex < 0 || + currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count) + { + NUILog.Error("index should be bigger than 0 and less than children of layer count"); + return; + } + + // If the currentIndex is not already the 0th index and the target has the same parent. + if ((currentIndex != 0) && (targetIndex != -1) && + (currentIndex > targetIndex)) + { + parentChildren.Remove(this); + parentChildren.Insert(targetIndex, this); + + NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } /// @@ -316,9 +369,10 @@ namespace Tizen.NUI { parentChildren.Remove(this); parentChildren.Add(this); + + NDalicPINVOKE.Layer_RaiseToTop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - NDalicPINVOKE.Layer_RaiseToTop(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// @@ -333,10 +387,11 @@ namespace Tizen.NUI { parentChildren.Remove(this); parentChildren.Insert(0, this); + + NDalicPINVOKE.Layer_LowerToBottom(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - NDalicPINVOKE.Layer_LowerToBottom(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// diff --git a/src/Tizen.NUI/src/public/NUIApplication.cs b/src/Tizen.NUI/src/public/NUIApplication.cs index 000cc7a..97bba6c 100755 --- a/src/Tizen.NUI/src/public/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -168,17 +168,7 @@ namespace Tizen.NUI /// 3 protected override void OnCreate() { - // This is also required to create DisposeQueue on main thread. - DisposeQueue disposeQ = DisposeQueue.Instance; - disposeQ.Initialize(); base.OnCreate(); - - // Dali's default layer is default center origin. need to change as top left. - // NUI's Layer is like a transparent film which covers entire window. (Layer is not an actor of Dali) - // otherwise, this makes ScreenPosition as wrong value. - Layer defaultLayer = Window.Instance.GetDefaultLayer(); - defaultLayer.SetParentOrigin(Tizen.NUI.ParentOrigin.TopLeft); - defaultLayer.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); } /// diff --git a/src/Tizen.NUI/src/public/NUIConstants.cs b/src/Tizen.NUI/src/public/NUIConstants.cs index 90375d7..88920dc 100755 --- a/src/Tizen.NUI/src/public/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/NUIConstants.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// Copyright (c) 2018 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. @@ -1256,6 +1256,14 @@ namespace Tizen.NUI /// 4 public static readonly int FrameDelay = NDalic.IMAGE_VISUAL_FRAME_DELAY; /// + /// The number of times the AnimatedImageVisual will be looped + /// Default -1. if < 0, loop unlimited. else, loop loopCount times. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly int LoopCount = NDalic.IMAGE_VISUAL_LOOP_COUNT; + /// /// The policy to determine when an image should no longer be cached /// /// 5 @@ -2410,7 +2418,6 @@ namespace Tizen.NUI /// An enum of text direction. /// /// 5 - [EditorBrowsable(EditorBrowsableState.Never)] public enum TextDirection { /// @@ -2427,6 +2434,31 @@ namespace Tizen.NUI } /// + /// An enum of vertical line alignment. + /// + /// 5 + public enum VerticalLineAlignment + { + /// + /// vertical line alignment is from top. + /// + /// 5 + Top, + + /// + /// vertical line alignment is from center. + /// + /// 5 + Center, + + /// + /// vertical line alignment is from bottom. + /// + /// 5 + Bottom + } + + /// /// Enumeration type for the font's slant. /// /// 5 diff --git a/src/Tizen.NUI/src/public/NUIWidgetApplication.cs b/src/Tizen.NUI/src/public/NUIWidgetApplication.cs index ce61032..70c52fd 100755 --- a/src/Tizen.NUI/src/public/NUIWidgetApplication.cs +++ b/src/Tizen.NUI/src/public/NUIWidgetApplication.cs @@ -14,12 +14,9 @@ * limitations under the License. * */ - -using System; -using System.ComponentModel; using Tizen.Applications; using Tizen.Applications.CoreBackend; -using Tizen.NUI; +using System.Collections.Generic; namespace Tizen.NUI { @@ -28,32 +25,34 @@ namespace Tizen.NUI /// Represents an application that have UI screen. The NUIWidgetApplication class has a default stage. /// /// 4 - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] public class NUIWidgetApplication : CoreApplication { - /// /// The default constructor. /// - /// 4 - public NUIWidgetApplication() : base(new NUIWidgetCoreBackend()) + /// Widget ID will be replaced as the application ID. + /// Derived widget class type. + public NUIWidgetApplication( System.Type widgetType ) : base(new NUIWidgetCoreBackend()) { - Tizen.Log.Fatal("NUI", "### NUIWidgetApplication called"); + NUIWidgetCoreBackend core = Backend as NUIWidgetCoreBackend; + core?.RegisterWidgetInfo(new Dictionary { { widgetType, ApplicationInfo.ApplicationId } }); } /// - /// The constructor with stylesheet. + /// The default constructor with stylesheet. /// + /// Widget ID will be replaced as the application ID. + /// Derived widget class type. /// The styleSheet url. /// 4 - public NUIWidgetApplication(string styleSheet) : base(new NUIWidgetCoreBackend(styleSheet)) + public NUIWidgetApplication(System.Type widgetType, string styleSheet) : base(new NUIWidgetCoreBackend(styleSheet)) { - Tizen.Log.Fatal("NUI", "### NUIWidgetApplication(string) called"); + NUIWidgetCoreBackend core = Backend as NUIWidgetCoreBackend; + core?.RegisterWidgetInfo(new Dictionary { { widgetType, ApplicationInfo.ApplicationId } }); } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnLocaleChanged behavior. /// /// 4 protected override void OnLocaleChanged(LocaleChangedEventArgs e) @@ -63,7 +62,7 @@ namespace Tizen.NUI } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnLowBattery behavior. /// /// 4 protected override void OnLowBattery(LowBatteryEventArgs e) @@ -73,7 +72,7 @@ namespace Tizen.NUI } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnLowMemory behavior. /// /// 4 protected override void OnLowMemory(LowMemoryEventArgs e) @@ -83,7 +82,7 @@ namespace Tizen.NUI } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnRegionFormatChanged behavior. /// /// 4 protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) @@ -93,7 +92,7 @@ namespace Tizen.NUI } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnTerminate behavior. /// /// 4 protected override void OnTerminate() @@ -103,7 +102,7 @@ namespace Tizen.NUI } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnPreCreate behavior. /// /// 4 protected virtual void OnPreCreate() @@ -112,7 +111,7 @@ namespace Tizen.NUI } /// - /// Overrides this method if want to handle behavior. + /// Overrides this method if want to handle OnCreate behavior. /// /// 4 protected override void OnCreate() diff --git a/src/Tizen.NUI/src/public/PixelBuffer.cs b/src/Tizen.NUI/src/public/PixelBuffer.cs new file mode 100755 index 0000000..5c922f1 --- /dev/null +++ b/src/Tizen.NUI/src/public/PixelBuffer.cs @@ -0,0 +1,311 @@ +/** 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.ComponentModel; + +namespace Tizen.NUI +{ + + /// + /// The PixelBuffer object holds a pixel buffer. + /// The PixelBuffer keeps ownership of it's initial buffer however, the + /// user is free to modify the pixel data, either directly, or via image operations. + /// + /// In order to upload the pixel data to texture memory, there are two + /// possibilities - either convert it back to a PixelData object, which + /// releases the PixelBuffer object, leaving the user with an empty handle + /// (ideal for one-time indirect image manipulation), or create a new + /// PixelData object from this object, leaving the buffer intact (ideal + /// for continuous manipulation) + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class PixelBuffer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PixelBuffer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PixelBuffer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PixelBuffer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose. + /// + /// 5 + protected override 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; + NDalicPINVOKE.delete_PixelBuffer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Create a PixelBuffer with it's own data buffer. + /// + /// The pixel buffer width + /// The pixel buffer height + /// The pixel format + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public PixelBuffer(uint width, uint height, PixelFormat pixelFormat) : this(NDalicPINVOKE.PixelBuffer_New(width, height, (int)pixelFormat), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PixelBuffer(PixelBuffer handle) : this(NDalicPINVOKE.new_PixelBuffer__SWIG_1(PixelBuffer.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PixelBuffer Assign(PixelBuffer rhs) + { + PixelBuffer ret = new PixelBuffer(NDalicPINVOKE.PixelBuffer_Assign(swigCPtr, PixelBuffer.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Convert to a pixel data and release the pixelBuffer's object. + /// This handle is left empty. + /// Any other handles that keep a reference to this object + /// will be left with no buffer, trying to access it will return NULL. + /// + /// A pixel buffer + /// A new PixelData which takes ownership of the PixelBuffer's buffer. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PixelData Convert(PixelBuffer pixelBuffer) + { + PixelData ret = new PixelData(NDalicPINVOKE.PixelBuffer_Convert(PixelBuffer.getCPtr(pixelBuffer)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Copy the data from this object into a new PixelData object, which could be + /// used for uploading to a texture. + /// + /// The pixel data. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public PixelData CreatePixelData() + { + PixelData ret = new PixelData(NDalicPINVOKE.PixelBuffer_CreatePixelData(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_unsigned_char GetBuffer() + { + global::System.IntPtr cPtr = NDalicPINVOKE.PixelBuffer_GetBuffer(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the width of the buffer in pixels. + /// + /// The width of the buffer in pixels. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetWidth() + { + uint ret = NDalicPINVOKE.PixelBuffer_GetWidth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the height of the buffer in pixels. + /// + /// The height of the buffer in pixels. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetHeight() + { + uint ret = NDalicPINVOKE.PixelBuffer_GetHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the pixel format. + /// + /// The pixel format. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public PixelFormat GetPixelFormat() + { + PixelFormat ret = (PixelFormat)NDalicPINVOKE.PixelBuffer_GetPixelFormat(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Apply the mask to this pixel data, and return a new pixel data containing + /// the masked image. If this PixelBuffer doesn't have an alpha channel, then + /// the resultant PixelBuffer will be converted to a format that supports at + /// least the width of the color channels and the alpha channel from the mask. + /// + /// If cropToMask is set to true, then the contentScale is applied first to + /// this buffer, and the target buffer is cropped to the size of the mask. If + /// it's set to false, then the mask is scaled to match this buffer's size + /// before the mask is applied. + /// + /// The mask to apply. + /// The scaling factor to apply to the content. + /// Whether to crop the output to the mask size (true) or scale the mask to the content size (false). + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void ApplyMask(PixelBuffer mask, float contentScale, bool cropToMask) + { + NDalicPINVOKE.PixelBuffer_ApplyMask__SWIG_0(swigCPtr, PixelBuffer.getCPtr(mask), contentScale, cropToMask); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Apply the mask to this pixel data, and return a new pixel data containing + /// the masked image. If this PixelBuffer doesn't have an alpha channel, then + /// the resultant PixelBuffer will be converted to a format that supports at + /// least the width of the color channels and the alpha channel from the mask. + /// + /// If cropToMask is set to true, then the contentScale is applied first to + /// this buffer, and the target buffer is cropped to the size of the mask. If + /// it's set to false, then the mask is scaled to match this buffer's size + /// before the mask is applied. + /// + /// The mask to apply. + /// The scaling factor to apply to the content. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void ApplyMask(PixelBuffer mask, float contentScale) + { + NDalicPINVOKE.PixelBuffer_ApplyMask__SWIG_1(swigCPtr, PixelBuffer.getCPtr(mask), contentScale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Apply the mask to this pixel data, and return a new pixel data containing + /// the masked image. If this PixelBuffer doesn't have an alpha channel, then + /// the resultant PixelBuffer will be converted to a format that supports at + /// least the width of the color channels and the alpha channel from the mask. + /// + /// If cropToMask is set to true, then the contentScale is applied first to + /// this buffer, and the target buffer is cropped to the size of the mask. If + /// it's set to false, then the mask is scaled to match this buffer's size + /// before the mask is applied. + /// + /// The mask to apply. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void ApplyMask(PixelBuffer mask) + { + NDalicPINVOKE.PixelBuffer_ApplyMask__SWIG_2(swigCPtr, PixelBuffer.getCPtr(mask)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Apply a Gaussian blur to this pixel data with the given radius. + /// A bigger radius will yield a blurrier image. Only works for pixel data in RGBA format. + /// + /// The radius for Gaussian blur. A value of 0 or negative value indicates no blur. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void ApplyGaussianBlur(float blurRadius) + { + NDalicPINVOKE.PixelBuffer_ApplyGaussianBlur(swigCPtr, blurRadius); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Crops this buffer to the given crop rectangle. + /// + /// The top left corner's X. + /// The top left corner's Y. + /// The crop width. + /// The crop height. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Crop(ushort x, ushort y, ushort width, ushort height) + { + NDalicPINVOKE.PixelBuffer_Crop(swigCPtr, x, y, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Resizes the buffer to the given dimensions. + /// + /// The new width. + /// The new height. + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Resize(ushort width, ushort height) + { + NDalicPINVOKE.PixelBuffer_Resize(swigCPtr, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PixelBuffer(SWIGTYPE_p_unsigned_char pointer) : this(NDalicPINVOKE.new_PixelBuffer__SWIG_2(SWIGTYPE_p_unsigned_char.getCPtr(pointer)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/PixelData.cs b/src/Tizen.NUI/src/public/PixelData.cs index 33c58b5..9754a3c 100755 --- a/src/Tizen.NUI/src/public/PixelData.cs +++ b/src/Tizen.NUI/src/public/PixelData.cs @@ -14,8 +14,6 @@ * limitations under the License. * */ - -using System; using System.ComponentModel; namespace Tizen.NUI @@ -31,8 +29,8 @@ namespace Tizen.NUI /// And this would make some problem, because dotnet runtime would change the address of memory allocated. /// So this is required to be removed. /// currently no use. will be added later - /// 3 - [Obsolete("Please do not use! This will be deprecated!")] + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public class PixelData : BaseHandle { @@ -51,7 +49,7 @@ namespace Tizen.NUI /// /// Dispose. /// - /// 3 + /// 5 protected override void Dispose(DisposeTypes type) { if (disposed) @@ -94,7 +92,9 @@ namespace Tizen.NUI /// Buffer height in pixels. /// The pixel format. /// The function used to release the memory. - /// 3 + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public PixelData(byte[] buffer, uint bufferSize, uint width, uint height, PixelFormat pixelFormat, PixelData.ReleaseFunction releaseFunction) : this(NDalicPINVOKE.PixelData_New(buffer, bufferSize, width, height, (int)pixelFormat, (int)releaseFunction), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -105,7 +105,9 @@ namespace Tizen.NUI /// Gets the width of the buffer in pixels. /// /// The width of the buffer in pixels. - /// 3 + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public uint GetWidth() { uint ret = NDalicPINVOKE.PixelData_GetWidth(swigCPtr); @@ -117,7 +119,9 @@ namespace Tizen.NUI /// Gets the height of the buffer in pixels. /// /// The height of the buffer in pixels. - /// 3 + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public uint GetHeight() { uint ret = NDalicPINVOKE.PixelData_GetHeight(swigCPtr); @@ -129,7 +133,9 @@ namespace Tizen.NUI /// Gets the pixel format. /// /// The pixel format. - /// 3 + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public PixelFormat GetPixelFormat() { PixelFormat ret = (PixelFormat)NDalicPINVOKE.PixelData_GetPixelFormat(swigCPtr); @@ -140,20 +146,20 @@ namespace Tizen.NUI /// /// Enumeration for Function to release the pixel buffer. /// - /// 3 + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public enum ReleaseFunction { /// /// Use free function to release the pixel buffer. /// - FREE, + Free, /// /// Use delete[] operator to release the pixel buffer. /// - DELETE_ARRAY + DeleteArray } - } - } \ No newline at end of file diff --git a/src/Tizen.NUI/src/public/Property.cs b/src/Tizen.NUI/src/public/Property.cs index ae904d7..98cd07c 100755 --- a/src/Tizen.NUI/src/public/Property.cs +++ b/src/Tizen.NUI/src/public/Property.cs @@ -1302,7 +1302,7 @@ namespace Tizen.NUI { throw new global::System.InvalidOperationException("Unimplemented type for Property Value :" + type.Name); } - NUILog.Debug(" got an property value of =" + type.Name); + //NUILog.Debug(" got an property value of =" + type.Name); return value; } diff --git a/src/Tizen.NUI/src/public/Renderer.cs b/src/Tizen.NUI/src/public/Renderer.cs index 2556d75..e345ddd 100755 --- a/src/Tizen.NUI/src/public/Renderer.cs +++ b/src/Tizen.NUI/src/public/Renderer.cs @@ -15,6 +15,8 @@ * */ +using System.Runtime.InteropServices; + namespace Tizen.NUI { /// @@ -229,8 +231,12 @@ namespace Tizen.NUI /// 3 public Geometry GetGeometry() { + //to fix memory leak issue, match the handle count with native side. System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetGeometry(swigCPtr); - Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Geometry; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Geometry; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -266,8 +272,12 @@ namespace Tizen.NUI /// 3 public TextureSet GetTextures() { + //to fix memory leak issue, match the handle count with native side. System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetTextures(swigCPtr); - TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as TextureSet; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as TextureSet; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -291,8 +301,12 @@ namespace Tizen.NUI /// 3 public Shader GetShader() { + //to fix memory leak issue, match the handle count with native side. System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetShader(swigCPtr); - Shader ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Shader; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Shader ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Shader; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/StyleManager.cs b/src/Tizen.NUI/src/public/StyleManager.cs index 8dc30d3..4e57e16 100644 --- a/src/Tizen.NUI/src/public/StyleManager.cs +++ b/src/Tizen.NUI/src/public/StyleManager.cs @@ -59,51 +59,6 @@ namespace Tizen.NUI } /// - /// Dispose. - /// - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. - /// 3 - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override 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 (_styleManagerStyleChangedCallbackDelegate != null) - { - StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate); - } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicPINVOKE.delete_StyleManager(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); - } - - /// /// Style changed event arguments. /// /// 3 diff --git a/src/Tizen.NUI/src/public/TTSPlayer.cs b/src/Tizen.NUI/src/public/TTSPlayer.cs index 30e2ff5..52bfbea 100644 --- a/src/Tizen.NUI/src/public/TTSPlayer.cs +++ b/src/Tizen.NUI/src/public/TTSPlayer.cs @@ -53,52 +53,6 @@ namespace Tizen.NUI } } - /// - /// Dispose. - /// - /// The dispose type - /// 3 - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override 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 (_stateChangedEventCallback != null) - { - StateChangedSignal().Disconnect(_stateChangedEventCallback); - } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_TtsPlayer(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); - } - internal TTSPlayer() : this(NDalicManualPINVOKE.new_TtsPlayer__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/src/Tizen.NUI/src/public/TextureSet.cs b/src/Tizen.NUI/src/public/TextureSet.cs index 6951097..949dece 100755 --- a/src/Tizen.NUI/src/public/TextureSet.cs +++ b/src/Tizen.NUI/src/public/TextureSet.cs @@ -15,6 +15,8 @@ * */ +using System.Runtime.InteropServices; + namespace Tizen.NUI { /// @@ -102,8 +104,12 @@ namespace Tizen.NUI /// 3 public Texture GetTexture(uint index) { + //to fix memory leak issue, match the handle count with native side. System.IntPtr cPtr = NDalicPINVOKE.TextureSet_GetTexture(swigCPtr, index); - Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Texture ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Texture; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -129,8 +135,12 @@ namespace Tizen.NUI /// 3 public Sampler GetSampler(uint index) { + //to fix memory leak issue, match the handle count with native side. System.IntPtr cPtr = NDalicPINVOKE.TextureSet_GetSampler(swigCPtr, index); - Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Sampler; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Sampler; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/Timer.cs b/src/Tizen.NUI/src/public/Timer.cs index f733e25..52cb554 100755 --- a/src/Tizen.NUI/src/public/Timer.cs +++ b/src/Tizen.NUI/src/public/Timer.cs @@ -41,6 +41,16 @@ namespace Tizen.NUI internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Timer_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + + _timerTickCallbackDelegate = OnTick; + _timerTickCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_timerTickCallbackDelegate); + + NUILog.Debug($"(0x{swigCPtr.Handle:X})Timer() contructor!"); + } + + ~Timer() + { + NUILog.Debug($"(0x{swigCPtr.Handle:X})Timer() distructor!, disposed={disposed}"); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Timer obj) @@ -54,6 +64,13 @@ namespace Tizen.NUI /// 3 protected override void Dispose(DisposeTypes type) { + NUILog.Debug($"(0x{swigCPtr.Handle:X}) Timer.Dispose(type={type}, disposed={disposed})"); + + if (this != null && _timerTickCallbackDelegate != null) + { + TickSignal().Disconnect(_timerTickCallbackOfNative); + } + if (disposed) { return; @@ -70,11 +87,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - if (_timerTickCallbackDelegate != null) - { - TickSignal().Disconnect(_timerTickCallbackDelegate); - } - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -99,10 +111,12 @@ namespace Tizen.NUI } [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate bool TickCallbackDelegate(IntPtr data); + private delegate bool TickCallbackDelegate(); private EventHandlerWithReturnType _timerTickEventHandler; private TickCallbackDelegate _timerTickCallbackDelegate; + private System.IntPtr _timerTickCallbackOfNative; + /// /// @brief Event for the ticked signal, which can be used to subscribe or unsubscribe the event handler /// provided by the user. The ticked signal is emitted after specified time interval.
@@ -112,10 +126,9 @@ namespace Tizen.NUI { add { - if (_timerTickEventHandler == null) + if (_timerTickEventHandler == null && disposed == false) { - _timerTickCallbackDelegate = new TickCallbackDelegate(OnTick); - TickSignal().Connect(_timerTickCallbackDelegate); + TickSignal().Connect(_timerTickCallbackOfNative); } _timerTickEventHandler += value; } @@ -124,18 +137,19 @@ namespace Tizen.NUI _timerTickEventHandler -= value; if (_timerTickEventHandler == null && TickSignal().Empty() == false) { - TickSignal().Disconnect(_timerTickCallbackDelegate); + TickSignal().Disconnect(_timerTickCallbackOfNative); } } } - private bool OnTick(IntPtr data) + private bool OnTick() { TickEventArgs e = new TickEventArgs(); if (played == false) { - Tizen.Log.Fatal("NUI", $"({swigCPtr.Handle}) OnTick() is called even played is false!"); + Tizen.Log.Fatal("NUI", $"(0x{swigCPtr.Handle:X}) OnTick() is called even played is false!"); + //throw new System.InvalidOperationException($"OnTick() excpetion!"); } if (_timerTickEventHandler != null && played == true) @@ -156,7 +170,7 @@ namespace Tizen.NUI { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - Tizen.Log.Error("NUI", $"({swigCPtr.Handle}) Timer({milliSec}) Constructor!"); + NUILog.Debug($"(0x{swigCPtr.Handle:X}) Timer({milliSec}) Constructor!"); } internal Timer(Timer timer) : this(NDalicPINVOKE.new_Timer__SWIG_1(Timer.getCPtr(timer)), true) { @@ -191,6 +205,9 @@ namespace Tizen.NUI /// /// Gets/Sets the interval of the timer. /// + /// For setter, this sets a new interval on the timer and starts the timer.
+ /// Cancels the previous timer. + ///
/// 4 public uint Interval { @@ -211,20 +228,18 @@ namespace Tizen.NUI /// MilliSec interval in milliseconds. internal void SetInterval(uint milliSec) { + NUILog.Debug($"(0x{swigCPtr.Handle:X})SetInterval({milliSec})"); - Tizen.Log.Error("NUI", $"({swigCPtr.Handle}) SetInterval({milliSec})"); + played = true; NDalicPINVOKE.Timer_SetInterval(swigCPtr, milliSec); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - played = true; } internal uint GetInterval() { uint ret = NDalicPINVOKE.Timer_GetInterval(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - Tizen.Log.Error("NUI", $"({swigCPtr.Handle})GetInterval({ret})"); return ret; } diff --git a/src/Tizen.NUI/src/public/Touch.cs b/src/Tizen.NUI/src/public/Touch.cs index 2fe9de8..635c679 100755 --- a/src/Tizen.NUI/src/public/Touch.cs +++ b/src/Tizen.NUI/src/public/Touch.cs @@ -17,6 +17,7 @@ namespace Tizen.NUI { + using System.Runtime.InteropServices; using Tizen.NUI.BaseComponents; /// /// Touch events are a collection of points at a specific moment in time.
@@ -164,8 +165,12 @@ namespace Tizen.NUI /// 3 public View GetHitView(uint point) { + //to fix memory leak issue, match the handle count with native side. global::System.IntPtr cPtr = NDalicPINVOKE.Touch_GetHitActor(swigCPtr, point); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs index 636eddb..5e668f3 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Button.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs @@ -72,8 +72,10 @@ namespace Tizen.NUI.UIComponents //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. - - DisConnectFromSignals(); + if (this != null) + { + DisConnectFromSignals(); + } if (swigCPtr.Handle != global::System.IntPtr.Zero) { @@ -755,8 +757,8 @@ namespace Tizen.NUI.UIComponents Tizen.NUI.PropertyMap map = new Tizen.NUI.PropertyMap(); GetProperty( Button.Property.LABEL).Get(map); Tizen.NUI.PropertyValue value = map.Find( TextVisualProperty.Text, "Text"); - string str; - value.Get(out str); + string str = ""; + value?.Get(out str); return str; } set @@ -791,4 +793,4 @@ namespace Tizen.NUI.UIComponents } -} \ No newline at end of file +} diff --git a/src/Tizen.NUI/src/public/UIComponents/Popup.cs b/src/Tizen.NUI/src/public/UIComponents/Popup.cs index 3da49bf..1a557ee 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Popup.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Popup.cs @@ -62,15 +62,17 @@ namespace Tizen.NUI.UIComponents //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 (_popUpHiddenEventCallbackDelegate != null) + if (this != null) { - HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate); - } + if (_popUpHiddenEventCallbackDelegate != null) + { + HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate); + } - if (_popUpHidingEventCallbackDelegate != null) - { - HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate); + if (_popUpHidingEventCallbackDelegate != null) + { + HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate); + } } if (_popUpShownEventCallbackDelegate != null) @@ -403,8 +405,12 @@ namespace Tizen.NUI.UIComponents internal View GetTitle() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Popup_GetTitle(swigCPtr); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -423,8 +429,12 @@ namespace Tizen.NUI.UIComponents internal View GetContent() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Popup_GetContent(swigCPtr); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -443,8 +453,12 @@ namespace Tizen.NUI.UIComponents internal View GetFooter() { + //to fix memory leak issue, match the handle count with native side. IntPtr cPtr = NDalicPINVOKE.Popup_GetFooter(swigCPtr); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + NDalicPINVOKE.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs b/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs index 3d88973..4a280b3 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs @@ -63,7 +63,7 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - if (_progressBarValueChangedCallbackDelegate != null) + if (this != null && _progressBarValueChangedCallbackDelegate != null) { ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate); } diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs index e2d752d..44c39de 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs @@ -61,15 +61,17 @@ namespace Tizen.NUI.UIComponents //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 (_scrollBarScrollPositionIntervalReachedEventCallbackDelegate != null) + if (this != null) { - ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate); - } + if (_scrollBarScrollPositionIntervalReachedEventCallbackDelegate != null) + { + ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate); + } - if (_scrollBarPanFinishedEventCallbackDelegate != null) - { - PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate); + if (_scrollBarPanFinishedEventCallbackDelegate != null) + { + PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate); + } } if (swigCPtr.Handle != global::System.IntPtr.Zero) diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs index cf4159b..3041525 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs @@ -64,7 +64,7 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - if (_scrollViewSnapStartedCallbackDelegate != null) + if (this != null && _scrollViewSnapStartedCallbackDelegate != null) { this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate); } diff --git a/src/Tizen.NUI/src/public/UIComponents/Slider.cs b/src/Tizen.NUI/src/public/UIComponents/Slider.cs index 5e7e51a..322cb4a 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Slider.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Slider.cs @@ -62,20 +62,22 @@ namespace Tizen.NUI.UIComponents //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 (_sliderValueChangedCallbackDelegate != null) + if (this != null) { - ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate); - } + if (_sliderValueChangedCallbackDelegate != null) + { + ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate); + } - if (_sliderSlidingFinishedCallbackDelegate != null) - { - SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate); - } + if (_sliderSlidingFinishedCallbackDelegate != null) + { + SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate); + } - if (_sliderMarkReachedCallbackDelegate != null) - { - MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate); + if (_sliderMarkReachedCallbackDelegate != null) + { + MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate); + } } if (swigCPtr.Handle != global::System.IntPtr.Zero) diff --git a/src/Tizen.NUI/src/public/VisualFactory.cs b/src/Tizen.NUI/src/public/VisualFactory.cs index e965dd6..0c1e066 100755 --- a/src/Tizen.NUI/src/public/VisualFactory.cs +++ b/src/Tizen.NUI/src/public/VisualFactory.cs @@ -40,47 +40,6 @@ namespace Tizen.NUI } /// - /// Dispose. - /// - /// The dispose type - /// 3 - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override 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; - NDalicPINVOKE.delete_VisualFactory(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); - } - - /// /// Please do not use! this will be deprecated, please use VisualFactory.Instance instead. /// /// 3 diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 4dc5420..2acf366 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2018 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. @@ -2311,6 +2311,7 @@ namespace Tizen.NUI private int? _batchSize = null; private int? _cacheSize = null; private float? _frameDelay = null; + private float? _loopCount = null; /// /// Gets and Sets the url in the AnimatedImageVisual. @@ -2413,6 +2414,26 @@ namespace Tizen.NUI } /// + /// Gets and Sets the number of times the AnimatedImageVisual will be looped. + /// Default -1. if < 0, loop unlimited. else, loop loopCount times. + /// + /// 5 + /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float LoopCount + { + get + { + return _loopCount ?? -1; + } + set + { + _loopCount = value; + UpdateVisual(); + } + } + + /// /// Compose the out visual map. /// /// 3 @@ -2438,6 +2459,7 @@ namespace Tizen.NUI if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); } if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); } if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); } + if (_loopCount != null ) {_outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); } if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } diff --git a/src/Tizen.NUI/src/public/Widget.cs b/src/Tizen.NUI/src/public/Widget.cs index 4752cb7..cd4fc57 100755 --- a/src/Tizen.NUI/src/public/Widget.cs +++ b/src/Tizen.NUI/src/public/Widget.cs @@ -1,6 +1,6 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. - * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + *Z:\Desktop\shared\tizenfx\src\Tizen.NUI\src\public\BaseComponents\CustomView.cs * 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 @@ -14,658 +14,205 @@ * limitations under the License. * */ + using System; -using System.ComponentModel; -using System.Runtime.InteropServices; namespace Tizen.NUI { /// - /// Widget object should be created by WidgetApplication. + /// Widget provides some common functionality required by all custom widget. /// - /// This is an experimental feature. We do recommend not to use it. /// 4 - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] public class Widget : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; + internal WidgetImpl widgetImpl; - internal Widget(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.Widget_SWIGUpcast(cPtr), cMemoryOwn) + internal Widget(WidgetImpl widgetImpl, bool swigCMemOwn) : this(NDalicManualPINVOKE.Widget_New__SWIG_1(WidgetImpl.getCPtr(widgetImpl)), swigCMemOwn) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } + this.widgetImpl = widgetImpl; + widgetImpl.WidgetInstanceCreated += OnWidgetInstanceCreated; + widgetImpl.WidgetInstanceDestroyed += OnWidgetInstanceDestroyed; + widgetImpl.WidgetInstancePaused += OnWidgetInstancePaused; + widgetImpl.WidgetInstanceResumed += OnWidgetInstanceResumed; + widgetImpl.WidgetInstanceResized += OnWidgetInstanceResized; + widgetImpl.WidgetInstanceUpdated += OnWidgetInstanceUpdated; - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Widget obj) - { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + WidgetApplication.Instance?.AddWidgetInstance(this); } - /// - /// To make Widget instance be disposed. - /// - /// 4 - protected override void Dispose(DisposeTypes type) + internal Widget(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.Widget_SWIGUpcast(cPtr), cMemoryOwn) { - 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 (_createCallback != null) - { - this.CreateSignal().Disconnect(_createCallback); - } - - if (_pauseCallback != null) - { - this.PauseSignal().Disconnect(_pauseCallback); - } - - if (_resizeCallback != null) - { - this.ResizeSignal().Disconnect(_resizeCallback); - } - - if (_resumeCallback != null) - { - this.ResumeSignal().Disconnect(_resumeCallback); - } - - if (_terminateCallback != null) - { - this.TerminateSignal().Disconnect(_terminateCallback); - } - - if (_updateCallback != null) - { - this.UpdateSignal().Disconnect(_updateCallback); - } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicManualPINVOKE.delete_Widget(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - /// - /// This is the constructor for Widget. - /// - /// for widget instance - /// 4 - public Widget(string id) : this(NDalicManualPINVOKE.Widget_New(id), true) + private void OnWidgetInstanceCreated(object sender, WidgetImpl.WIdgetInstanceOnCreateArgs e) { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + OnCreate(e.ContentInfo, e.Window); } - internal Widget(Widget widget) : this(NDalicManualPINVOKE.new_Widget__SWIG_1(Widget.getCPtr(widget)), true) + private void OnWidgetInstanceDestroyed(object sender, WidgetImpl.WIdgetInstanceOnDestroyArgs e) { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + OnTerminate(e.ContentInfo, e.TerminateType); } - internal Widget Assign(Widget widget) + private void OnWidgetInstancePaused(object sender, EventArgs e) { - Widget ret = new Widget(NDalicManualPINVOKE.Widget_Assign(swigCPtr, Widget.getCPtr(widget)), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + OnPause(); } - /// - /// Event arguments that passed via KeyEvent signal. - /// - /// 4 - public class CreateEventArgs : EventArgs + private void OnWidgetInstanceResumed(object sender, EventArgs e) { - /// - /// widget id. - /// - /// 4 - public string ID - { - get; - set; - } - - /// - /// a bundle. - /// - /// 4 - public SWIGTYPE_p_bundle Bundle - { - get; - set; - } - - /// - /// window. - /// - /// 4 - public Window Window - { - get; - set; - } + OnResume(); } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void CreateCallbackType(string id, IntPtr bundle, IntPtr window); - private CreateCallbackType _createCallback; - private EventHandler _createEventHandler; - - /// - /// Create event. - /// - /// 4 - public event EventHandler Create + private void OnWidgetInstanceResized(object sender, WidgetImpl.WidgetInstanceOnResizeArgs e) { - add - { - if (_createEventHandler == null) - { - _createCallback = OnCreate; - CreateSignal().Connect(_createCallback); - } - - _createEventHandler += value; - } - - remove - { - _createEventHandler -= value; - - if (_createEventHandler == null && CreateSignal().Empty() == false) - { - CreateSignal().Disconnect(_createCallback); - } - } + OnResize(e.Window); } - private void OnCreate(string id, IntPtr bundle, IntPtr window) + private void OnWidgetInstanceUpdated(object sender, WidgetImpl.WidgetInstanceOnUpdateArgs e) { - CreateEventArgs e = new CreateEventArgs(); - - e.ID = id; - - if (bundle != null) - { - e.Bundle = new SWIGTYPE_p_bundle(bundle, false); - } - if (window != null) - { - e.Window = new Window(window, false); - } - - _createEventHandler?.Invoke(this, e); + OnUpdate(e.ContentInfo, e.Force); } - internal WidgetCreateSignalType CreateSignal() + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Widget obj) { - WidgetCreateSignalType ret = new WidgetCreateSignalType(NDalicManualPINVOKE.Widget_CreateSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } /// - /// Event arguments that passed via terminate event signal. + /// Dispose. /// + /// The dispose type /// 4 - public class TerminateEventArgs : EventArgs + protected override void Dispose(DisposeTypes type) { - /// - /// widget id. - /// - /// 4 - public string ID - { - get; - set; - } - - /// - /// a bundle. - /// - /// 4 - public SWIGTYPE_p_bundle Bundle - { - get; - set; - } - - /// - /// widget terminate type. - /// - /// 4 - public WidgetTerminateType WidgetTerminateType + if(disposed) { - get; - set; + return; } - } - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void TerminateCallbackType(string id, IntPtr bundle, WidgetTerminateType widgetTerminateType); - private TerminateCallbackType _terminateCallback; - private EventHandler _terminateEventHandler; - /// - /// Terminate event. - /// - /// 4 - public event EventHandler Terminate - { - add + if(type == DisposeTypes.Explicit) { - if (_terminateEventHandler == null) - { - _terminateCallback = OnTerminate; - TerminateSignal().Connect(_terminateCallback); - } - - _terminateEventHandler += value; + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. } - remove + if (swigCPtr.Handle != global::System.IntPtr.Zero) { - _terminateEventHandler -= value; - - if (_terminateEventHandler == null && TerminateSignal().Empty() == false) + if (swigCMemOwn) { - TerminateSignal().Disconnect(_terminateCallback); + swigCMemOwn = false; + NDalicManualPINVOKE.delete_Widget(swigCPtr); } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - } - - private void OnTerminate(string id, IntPtr bundle, WidgetTerminateType widgetTerminateType) - { - TerminateEventArgs e = new TerminateEventArgs(); - e.ID = id; - - if (bundle != null) - { - e.Bundle = new SWIGTYPE_p_bundle(bundle, false); - } - - e.WidgetTerminateType = widgetTerminateType; - _terminateEventHandler?.Invoke(this, e); - } - internal WidgetTerminateSignalType TerminateSignal() - { - WidgetTerminateSignalType ret = new WidgetTerminateSignalType(NDalicManualPINVOKE.Widget_TerminateSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + base.Dispose(type); } - /// - /// Event arguments that passed via pause event signal. + /// Enumeration for termination type of widget /// /// 4 - public class PauseEventArgs : EventArgs + public enum TerminationType { /// - /// widget id. + /// User deleted this widget from the viewer /// - /// 4 - public string ID - { - get; - set; - } + /// 4 + Permanent, + /// + /// Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by system) + /// + /// 4 + Temporary } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void PauseCallbackType(string id); - private PauseCallbackType _pauseCallback; - private EventHandler _pauseEventHandler; - /// - /// Pause event. + /// Creates a Widget handle. /// /// 4 - public event EventHandler Pause - { - add - { - if (_pauseEventHandler == null) - { - _pauseCallback = OnPause; - PauseSignal().Connect(_pauseCallback); - } - - _pauseEventHandler += value; - } - - remove - { - _pauseEventHandler -= value; + public Widget () : this (new WidgetImpl(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - if (_pauseEventHandler == null && PauseSignal().Empty() == false) - { - PauseSignal().Disconnect(_pauseCallback); - } - } - } - - private void OnPause(string id) - { - PauseEventArgs e = new PauseEventArgs(); - e.ID = id; - - _pauseEventHandler?.Invoke(this, e); - } - - internal WidgetPauseSignalType PauseSignal() + internal Widget Assign(Widget widget) { - WidgetPauseSignalType ret = new WidgetPauseSignalType(NDalicManualPINVOKE.Widget_PauseSignal(swigCPtr), false); + Widget ret = new Widget(NDalicManualPINVOKE.Widget_Assign(swigCPtr, Widget.getCPtr(widget)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// - /// Event arguments that passed via pause event signal. + /// The user should override this function to determine when they create widget. /// + /// Information from WidgetView for creating. It contains previous status of widget which is sent by SetContentInfo before. + /// Window for widget /// 4 - public class ResumeEventArgs : EventArgs + protected virtual void OnCreate(string contentInfo, Window window) { - /// - /// widget id. - /// - /// 4 - public string ID - { - get; - set; - } } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void ResumeCallbackType(string id); - private ResumeCallbackType _resumeCallback; - private EventHandler _resumeEventHandler; - /// - /// Resume event. + /// The user should override this function to determine when they terminate widget. /// + /// Data from WidgetView for deleting + /// Termination type. When user delete widget view, termination type is PERMANENT. /// 4 - public event EventHandler Resume + protected virtual void OnTerminate(string contentInfo, Widget.TerminationType type) { - add - { - if (_resumeEventHandler == null) - { - _resumeCallback = OnResume; - ResumeSignal().Connect(_resumeCallback); - } - - _resumeEventHandler += value; - } - - remove - { - _resumeEventHandler -= value; - - if (_resumeEventHandler == null && ResumeSignal().Empty() == false) - { - ResumeSignal().Disconnect(_resumeCallback); - } - } - } - - private void OnResume(string id) - { - ResumeEventArgs e = new ResumeEventArgs(); - e.ID = id; - - _resumeEventHandler?.Invoke(this, e); - } - - internal WidgetResumeSignalType ResumeSignal() - { - WidgetResumeSignalType ret = new WidgetResumeSignalType(NDalicManualPINVOKE.Widget_ResumeSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } /// - /// Event arguments that passed via resize signal. + /// The user should override this function to determine when they pause widget. /// /// 4 - public class ResizeEventArgs : EventArgs + protected virtual void OnPause() { - /// - /// widget id. - /// - /// 4 - public string ID - { - get; - set; - } - - /// - /// window. - /// - /// 4 - public Window Window - { - get; - set; - } } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void ResizeCallbackType(string id, IntPtr window); - private ResizeCallbackType _resizeCallback; - private EventHandler _resizeEventHandler; - /// - /// Resize event. + /// The user should override this function to determine when they resume widget. /// /// 4 - public event EventHandler Resize - { - add - { - if (_resizeEventHandler == null) - { - _resizeCallback = OnResize; - ResizeSignal().Connect(_resizeCallback); - } - - _resizeEventHandler += value; - } - - remove - { - _resizeEventHandler -= value; - - if (_resizeEventHandler == null && ResizeSignal().Empty() == false) - { - ResizeSignal().Disconnect(_resizeCallback); - } - } - } - - private void OnResize(string id, IntPtr window) - { - ResizeEventArgs e = new ResizeEventArgs(); - e.ID = id; - if (window != null) - { - e.Window = new Window(window, false); - } - - _resizeEventHandler?.Invoke(this, e); - } - - internal WidgetResizeSignalType ResizeSignal() + protected virtual void OnResume() { - WidgetResizeSignalType ret = new WidgetResizeSignalType(NDalicManualPINVOKE.Widget_ResizeSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } /// - /// Event arguments that passed via update event signal. + /// The user should override this function to determine when they resize widget. /// + /// Window for widget /// 4 - public class UpdateEventArgs : EventArgs + protected virtual void OnResize(Window window) { - /// - /// widget data. - /// - /// 4 - public string ID - { - get; - set; - } - - /// - /// A bundle. - /// - /// 4 - public SWIGTYPE_p_bundle Bundle - { - get; - set; - } - - /// - /// It means several steps. - /// - /// - /// 0 -> no force - /// 1 -> force but do something - /// 2 -> force - /// - /// 4 - public int Force - { - get; - set; - } } - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void UpdateCallbackType(string id, IntPtr bundle, int force); - private UpdateCallbackType _updateCallback; - private EventHandler _updateEventHandler; - /// - /// Update event. + /// The user should override this function to determine when they update widget. /// + /// Data from WidgetView for updating + /// Although the widget is paused, if it is true, the widget can be updated /// 4 - public event EventHandler Update + protected virtual void OnUpdate(string contentInfo, int force) { - add - { - if (_updateEventHandler == null) - { - _updateCallback = OnUpdate; - UpdateSignal().Connect(_updateCallback); - } - - _updateEventHandler += value; - } - - remove - { - _updateEventHandler -= value; - - if (_updateEventHandler == null && UpdateSignal().Empty() == false) - { - UpdateSignal().Disconnect(_updateCallback); - } - } - } - - private void OnUpdate(string id, IntPtr bundle, int force) - { - UpdateEventArgs e = new UpdateEventArgs(); - e.ID = id; - if (bundle != null) - { - e.Bundle = new SWIGTYPE_p_bundle(bundle, false); - } - e.Force = force; - - _updateEventHandler?.Invoke(this, e); - } - - internal WidgetUpdateSignalType UpdateSignal() - { - WidgetUpdateSignalType ret = new WidgetUpdateSignalType(NDalicManualPINVOKE.Widget_UpdateSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } /// - /// Enumeration for terminate type of widget instance. + /// Set content info to WidgetView. /// + /// Content info is kind of context information which contains current status of widget. /// 4 - public enum WidgetTerminateType + public void SetContentInfo(string contentInfo) { - /// - /// User deleted this widget from the viewer - /// - /// 4 - Permanent, - /// - /// Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) - /// - /// 4 - Temporary + widgetImpl.SetContentInfo(contentInfo); } - /// - /// Enumeration for lifecycle event type of widget instance. - /// - /// 4 - public enum WidgetLifecycleEventType + internal System.IntPtr GetIntPtr() { - /// - /// The widget is dead. - /// - /// 4 - AppDead = 0, - /// - /// The widget is dead. - /// - /// 4 - Create = 1, - /// - /// The widget is destroyed. - /// - /// 4 - Destroy = 2, - /// - /// The widget is paused. - /// - /// 4 - Pause = 3, - /// - /// The widget is resumed. - /// - /// 4 - Resume = 4 + return swigCPtr.Handle; } } } diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index e0cfcb4..48a61d4 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -57,97 +57,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - /// - /// To make the window instance be disposed. - /// - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. - /// 3 - [Obsolete("Please do not use! This will be deprecated!")] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override 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 (_windowFocusChangedEventCallback != null) - { - WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback); - } - - if (_stageTouchCallbackDelegate != null) - { - TouchSignal().Disconnect(_stageTouchCallbackDelegate); - } - - if (_stageWheelCallbackDelegate != null) - { - WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); - } - - if (_stageKeyCallbackDelegate != null) - { - KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); - } - - if (_stageEventProcessingFinishedEventCallbackDelegate != null) - { - EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); - } - - if (_stageContextLostEventCallbackDelegate != null) - { - ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate); - } - - if (_stageContextRegainedEventCallbackDelegate != null) - { - this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate); - } - - if (_stageSceneCreatedEventCallbackDelegate != null) - { - SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate); - } - - if (_windowResizedEventCallback != null) - { - ResizedSignal().Disconnect(_windowResizedEventCallback); - } - - if (_windowFocusChangedEventCallback2 != null) - { - WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2); - } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicPINVOKE.delete_Window(swigCPtr); - NDalicPINVOKE.delete_Stage(stageCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - base.Dispose(type); - } - internal static Window GetCurrent() { Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true); @@ -366,9 +275,14 @@ namespace Tizen.NUI } /// - /// Sets a transparent window's visual state to opaque. + /// Sets a transparent window's visual state to opaque.
+ /// If a visual state of a transparent window is opaque,
+ /// then the window manager could handle it as an opaque window when calculating visibility. ///
/// Whether the window's visual state is opaque. + /// This will have no effect on an opaque window.
+ /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window. + ///
/// 3 public void SetOpaqueState(bool opaque) { @@ -380,6 +294,7 @@ namespace Tizen.NUI /// Returns whether a transparent window's visual state is opaque or not. ///
/// True if the window's visual state is opaque, false otherwise. + /// The return value has no meaning on an opaque window. /// 3 public bool IsOpaqueState() { diff --git a/test/NUITestSample/NUITestSample/examples/imageview-doaction-test.cs b/test/NUITestSample/NUITestSample/examples/imageview-doaction-test.cs new file mode 100755 index 0000000..3fe14a0 --- /dev/null +++ b/test/NUITestSample/NUITestSample/examples/imageview-doaction-test.cs @@ -0,0 +1,89 @@ + +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace ImageViewDoActionTest +{ + class Example : NUIApplication + { + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + DoActionTest(); + } + + private static string resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; + private Window window; + private Layer defaultLayer; + public void Initialize() + { + Tizen.Log.Error("NUI", "Initialize() START!"); + window = Window.Instance; + window.BackgroundColor = Color.Green; + window.TouchEvent += OnWindowTouched; + window.WheelEvent += OnWindowWheelMoved; + window.KeyEvent += OnWindowKeyPressed; + + defaultLayer = window.GetDefaultLayer(); + + Tizen.Log.Error("NUI", "Initialize() END!"); + + } + + ImageView imageView1, imageView2; + public void DoActionTest() + { + string myUrl = resourcePath + "/images/gallery-0.jpg"; + + imageView1 = new ImageView(); + imageView1.ResourceUrl = myUrl; + imageView1.Position2D = new Position2D(100, 100); + imageView1.Size2D = new Size2D(200, 200); + defaultLayer.Add(imageView1); + + imageView2 = new ImageView(); + imageView2.ResourceUrl = myUrl; + imageView2.Position2D = new Position2D(500, 100); + imageView2.Size2D = new Size2D(400, 400); + defaultLayer.Add(imageView2); + } + + public void OnWindowKeyPressed(object sender, Window.KeyEventArgs e) + { + Tizen.Log.Error("NUI", $"OnWindowKeyPressed()! keyPressedName={e.Key.KeyPressedName} state={e.Key.State}"); + + if(e.Key.State == Key.StateType.Down) + { + if(e.Key.KeyPressedName == "Up") + { + PropertyMap attributes = new PropertyMap(); + imageView1.Reload(); + } + else if (e.Key.KeyPressedName == "Down") + { + + } + } + } + + public void OnWindowWheelMoved(object sender, Window.WheelEventArgs e) + { + Tizen.Log.Error("NUI", $"OnWindowWheelMoved()! direction={e.Wheel.Direction} type={e.Wheel.Type}"); + } + + public void OnWindowTouched(object sender, Window.TouchEventArgs e) + { + Tizen.Log.Error("NUI", $"OnWindowTouched()! e.TouchData.GetState(0)={e.Touch.GetState(0)}"); + } + + [STAThread] + static void _Main(string[] args) + { + Example example = new Example(); + example.Run(args); + } + } +} diff --git a/test/NUITestSample/NUITestSample/examples/ref-cnt-error-memory-leak.cs b/test/NUITestSample/NUITestSample/examples/ref-cnt-error-memory-leak.cs new file mode 100755 index 0000000..5e474fa --- /dev/null +++ b/test/NUITestSample/NUITestSample/examples/ref-cnt-error-memory-leak.cs @@ -0,0 +1,288 @@ +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.UIComponents; + +namespace RefCountMemoryLeakTest +{ + class Program : NUIApplication + { + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + } + + View test1; + View[] children = new View[10]; + + void Initialize() + { + Window.Instance.KeyEvent += OnKeyEvent; + Window.Instance.BackgroundColor = Color.Green; + + test1 = new View(); + test1.BackgroundColor = Color.Blue; + test1.Size2D = new Size2D(100, 100); + Window.Instance.Add(test1); + } + + Animation animation1; + public void OnKeyEvent(object sender, Window.KeyEventArgs e) + { + if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape")) + { + Exit(); + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "Return") + { + if(!test1) + { + test1 = new View(); + test1.BackgroundColor = Color.Blue; + test1.Size2D = new Size2D(100, 100); + Window.Instance.GetDefaultLayer().Add(test1); + } + + if (test1) + { + if(!animation1) + { + animation1 = new Animation(1000); + animation1.AnimateTo(test1, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500); + animation1.AnimateTo(test1, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000); + Tizen.Log.Fatal("NUI1", $"@@@ new Animation()!"); + } + animation1?.Play(); + } + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "Left") + { + //test1?.GetObjectPtr()?.Unreference(); + if(animation1) + { + animation1.Finished += Animation1_Finished; + Tizen.Log.Fatal("NUI1", $"@@@ ADD finished!"); + } + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "Up") + { + test1?.Dispose(); + test1 = null; + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "Right") + { + animation1?.Dispose(); + animation1 = null; + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "1") + { + Tizen.Log.Fatal("NUI1", $"########## 1 pressed! ##########"); + + Layer layer = Window.Instance.GetDefaultLayer(); + + Tizen.Log.Fatal("NUI1", $"[1]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + layer?.Add(test1); + Tizen.Log.Fatal("NUI1", $"[2]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"GetParent(): test1's refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + layer?.Remove(test1); + + Tizen.Log.Fatal("NUI1", $"[3]Remove! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"GetParent(): test1's refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"#####################"); + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "2") + { + Tizen.Log.Fatal("NUI1", $"########## 2 pressed! ##########"); + + Layer layer = Window.Instance.GetDefaultLayer(); + + Tizen.Log.Fatal("NUI1", $"[1]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + layer?.Add(test1); + Tizen.Log.Fatal("NUI1", $"[2]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"test1's GetParent() refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + for(int i=0; i<5; i++) + { + children[i] = new ImageView(); + children[i].Size2D = new Size2D(100, 100); + children[i].Position2D = new Position2D(100 + 50 * (i + 1), 100 + 50 * (i + 1)); + children[i].BackgroundColor = Color.Red; + layer.Add(children[i]); + Tizen.Log.Fatal("NUI1", $"children[{i}]'s refcnt={children[i]?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + } + + for (int i = 5; i < 10; i++) + { + children[i] = new View(); + children[i].Size2D = new Size2D(100, 100); + children[i].Position2D = new Position2D(100 + 50 * (i + 1), 100 + 50 * (i + 1)); + children[i].BackgroundColor = Color.Yellow; + test1.Add(children[i]); + Tizen.Log.Fatal("NUI1", $"children[{i}] refcnt={children[i]?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, test1 refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + } + + View temp; + for(int i=0; i<8; i++) + { + temp = layer.GetChildAt((uint)i); + Tizen.Log.Fatal("NUI1", $"temp(idx[{i}])={temp?.GetTypeName()}'s refcnt={temp?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + } + + for (int i = 0; i < 8; i++) + { + temp = test1.GetChildAt((uint)i); + Tizen.Log.Fatal("NUI1", $"GetChildAt: temp(idx[{i}])={temp?.GetTypeName()}'s refcnt={temp?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + } + + layer?.Remove(test1); + + Tizen.Log.Fatal("NUI1", $"[3]Remove! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"test1's GetParent() refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"#####################"); + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "3") + { + Tizen.Log.Fatal("NUI1", $"########## 3 pressed! ##########"); + + Layer layer = Window.Instance.GetDefaultLayer(); + + Tizen.Log.Fatal("NUI1", $"[1]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + layer?.Add(test1); + Tizen.Log.Fatal("NUI1", $"[2]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"test1's GetParent() refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + for (int i = 0; i < 5; i++) + { + children[i] = new ImageView(); + children[i].Size2D = new Size2D(100, 100); + children[i].Position2D = new Position2D(100 + 50 * (i + 1), 100 + 50 * (i + 1)); + children[i].BackgroundColor = Color.Red; + layer.Add(children[i]); + Tizen.Log.Fatal("NUI1", $"children[{i}]:id({children[i].ID})'s refcnt={children[i]?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + } + + for (int i = 5; i < 10; i++) + { + children[i] = new View(); + children[i].Size2D = new Size2D(100, 100); + children[i].Position2D = new Position2D(100 + 50 * (i + 1), 100 + 50 * (i + 1)); + children[i].BackgroundColor = Color.Yellow; + test1.Add(children[i]); + Tizen.Log.Fatal("NUI1", $"children[{i}] refcnt={children[i]?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, test1 refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + } + + View temp; + for (int i = 1; i < children[9].ID + 1; i++) + { + temp = layer.FindChildById((uint)i); + Tizen.Log.Fatal("NUI1", $"FindChildById: temp(id[{i}])={temp?.GetTypeName()}'s refcnt={temp?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + } + + for (int i = 0; i < 10; i++) + { + children[i].Unparent(); + children[i].Dispose(); + children[i] = null; + } + + layer?.Remove(test1); + + Tizen.Log.Fatal("NUI1", $"[3]Remove! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"test1's GetParent() refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"#####################"); + } + else if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "4") + { + Tizen.Log.Fatal("NUI1", $"########## 4 pressed! ##########"); + + Layer layer = Window.Instance.GetDefaultLayer(); + + Tizen.Log.Fatal("NUI1", $"[1]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + layer?.Add(test1); + Tizen.Log.Fatal("NUI1", $"[2]Add! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + for (int i = 0; i < 5; i++) + { + children[i] = new ImageView(); + children[i].Size2D = new Size2D(100, 100); + children[i].Position2D = new Position2D(100 + 50 * (i + 1), 100 + 50 * (i + 1)); + children[i].BackgroundColor = Color.Red; + children[i].Name = "TestView" + i; + test1.Add(children[i]); + Tizen.Log.Fatal("NUI1", $"children[{i}]:id({children[i].ID})'s refcnt={children[i]?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + } + + for (int i = 5; i < 10; i++) + { + children[i] = new View(); + children[i].Size2D = new Size2D(100, 100); + children[i].Position2D = new Position2D(100 + 50 * (i + 1), 100 + 50 * (i + 1)); + children[i].BackgroundColor = Color.Yellow; + children[i].Name = "TestView" + i; + test1.Add(children[i]); + Tizen.Log.Fatal("NUI1", $"children[{i}] refcnt={children[i]?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, test1 refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + } + + View temp; + for (int i = 0; i < 10; i++) + { + temp = test1.FindChildByName("TestView" + i); + Tizen.Log.Fatal("NUI1", $"FindChildByName: temp(name:{temp.Name})={temp?.GetTypeName()}'s refcnt={temp?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + } + + for (int i = 0; i < 10; i++) + { + children[i].Unparent(); + children[i].Dispose(); + children[i] = null; + } + + layer?.Remove(test1); + + Tizen.Log.Fatal("NUI1", $"[3]Remove! test1 id={test1.ID} test1's refcnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"test1's GetParent() refcnt={test1?.GetParent()?.GetObjectPtr()?.ReferenceCount()}, layer's refcnt={layer?.GetObjectPtr()?.ReferenceCount()}"); + + Tizen.Log.Fatal("NUI1", $"#####################"); + } + + + Tizen.Log.Fatal("NUI1", $"@@@ test1 refcnt={test1?.GetObjectPtr()?.ReferenceCount()} , key={e.Key.KeyPressedName}"); + Tizen.Log.Fatal("NUI1", $"@@@ animation1 refcnt={animation1?.GetObjectPtr()?.ReferenceCount()}"); + } + + private void Animation1_Finished(object sender, EventArgs e) + { + Tizen.Log.Fatal("NUI1", $"@@@ ======== Finished! animation1 ref-cnt={animation1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"@@@ test1 ref-cnt={test1?.GetObjectPtr()?.ReferenceCount()}"); + Tizen.Log.Fatal("NUI1", $"@@@ =========================================="); + } + + static void ___Main(string[] args) + { + var app = new Program(); + app.Run(args); + } + } +} + diff --git a/test/NUITestSample/NUITestSample/examples/text-test.cs b/test/NUITestSample/NUITestSample/examples/text-test.cs index 11bc56a..40fcb22 100755 --- a/test/NUITestSample/NUITestSample/examples/text-test.cs +++ b/test/NUITestSample/NUITestSample/examples/text-test.cs @@ -121,6 +121,7 @@ namespace TextTest hiddenMap.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x23)); field.HiddenInputSettings = hiddenMap; field.EnableSelection = true; + field.EnableShiftSelection = false; window.Add(field); InputMethod inputMethod = new InputMethod(); @@ -165,6 +166,9 @@ namespace TextTest FocusManager.Instance.SetCurrentFocusView(editor); editor.UpFocusableView = field; field.DownFocusableView = editor; + + NUILog.Debug($"### field.EnableShiftSelection={field.EnableShiftSelection}, editor.EnableShiftSelection={editor.EnableShiftSelection}"); + } [STAThread] -- 2.7.4