From: xb.teng Date: Mon, 31 Jul 2017 08:52:35 +0000 (+0800) Subject: [Tizen] Addtional Adaptor/Animation apis for nui, to use FeedKeyEvent/PlayAfter function X-Git-Tag: preview1-00180^2~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7a332505d2d6063598b27d676af17570aa1e599;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Tizen] Addtional Adaptor/Animation apis for nui, to use FeedKeyEvent/PlayAfter function Conflicts: Tizen.NUI/src/internal/ManualPINVOKE.cs Change-Id: Ia4606572080ddd370de12bac60f87596813a0a7e --- diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/feedkey-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/feedkey-test.cs new file mode 100755 index 0000000..bbec809 --- /dev/null +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/feedkey-test.cs @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; +using System.Runtime.InteropServices; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Constants; + +namespace FeedKeyTest +{ + class Example : NUIApplication + { + public Example() : base() + { + } + + public Example(string stylesheet) : base(stylesheet) + { + } + + public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode) + { + } + + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + } + + public void Initialize() + { + Window window = Window.Instance; + window.BackgroundColor = Color.White; + + View view1 = new View() + { + Position2D = new Position2D(10, 10), + BackgroundColor = Color.Magenta, + Size2D = new Size2D(200, 200), + Focusable = true + }; + + View view2 = new View() + { + Position2D = new Position2D(10, 240), + BackgroundColor = Color.Red, + Size2D = new Size2D(200, 200), + Focusable = true + }; + + window.Add(view1); + window.Add(view2); + + FocusManager.Instance.SetCurrentFocusView(view1); + view2.UpFocusableView = view1; + view1.DownFocusableView = view2; + + view1.KeyEvent += (obj, e) => + { + if (e.Key.State != Key.StateType.Down) + { + return false; + } + Tizen.Log.Debug("NUI", "View1 KeyPressedName: " + e.Key.KeyPressedName); + Adaptor.Instance.FeedKeyEvent(e.Key); + return false; + }; + + view2.KeyEvent += (obj, e) => + { + if (e.Key.State != Key.StateType.Down) + { + // Tizen.Log.Debug("NUI", "View2 key state != Down"); + return false; + } + + // Tizen.Log.Debug("NUI", "View2 KeyPressedName: " + e.Key.KeyPressedName); + View v = obj as View; + if(v == view1) + { + Tizen.Log.Debug("NUI", "View2 received view1 feed event: " + e.Key.KeyPressedName); + } + if (v == view2) + { + Tizen.Log.Debug("NUI", "View2 received event: " + e.Key.KeyPressedName); + } + return false; + }; + } + + [STAThread] + static void _Main(string[] args) + { + Example example = new Example(); + example.Run(args); + } + } +} diff --git a/src/Tizen.NUI/src/internal/AdaptorSignalType.cs b/src/Tizen.NUI/src/internal/AdaptorSignalType.cs new file mode 100755 index 0000000..ede7447 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AdaptorSignalType.cs @@ -0,0 +1,103 @@ +/** 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 +{ + + public class AdaptorSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AdaptorSignalType(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(AdaptorSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~AdaptorSignalType() + { + Dispose(); + } + + public virtual void Dispose() + { + lock (this) + { + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_AdaptorSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.AdaptorSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.AdaptorSignalType_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.AdaptorSignalType_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.AdaptorSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Adaptor arg) + { + NDalicManualPINVOKE.AdaptorSignalType_Emit(swigCPtr, Adaptor.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AdaptorSignalType() : this(NDalicManualPINVOKE.new_AdaptorSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index dbc1d40..ba61c57 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -926,5 +926,118 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_SWIGUpcast")] public static extern global::System.IntPtr WidgetViewManager_SWIGUpcast(global::System.IntPtr jarg1); + //For Adaptor + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_0")] + public static extern global::System.IntPtr Adaptor_New__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_1")] + public static extern global::System.IntPtr Adaptor_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_2")] + public static extern global::System.IntPtr Adaptor_New__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_Adaptor_New__SWIG_3")] + public static extern global::System.IntPtr Adaptor_New__SWIG_3(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_Adaptor")] + public static extern void delete_Adaptor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Start")] + public static extern void Adaptor_Start(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Pause")] + public static extern void Adaptor_Pause(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Resume")] + public static extern void Adaptor_Resume(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Stop")] + public static extern void Adaptor_Stop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_AddIdle")] + public static extern bool Adaptor_AddIdle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_RemoveIdle")] + public static extern void Adaptor_RemoveIdle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_ReplaceSurface")] + public static extern void Adaptor_ReplaceSurface(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_Adaptor_GetSurface")] + public static extern global::System.IntPtr Adaptor_GetSurface(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_GetNativeWindowHandle")] + public static extern global::System.IntPtr Adaptor_GetNativeWindowHandle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_ReleaseSurfaceLock")] + public static extern void Adaptor_ReleaseSurfaceLock(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetRenderRefreshRate")] + public static extern void Adaptor_SetRenderRefreshRate(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetUseHardwareVSync")] + public static extern void Adaptor_SetUseHardwareVSync(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Get")] + public static extern global::System.IntPtr Adaptor_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_IsAvailable")] + public static extern bool Adaptor_IsAvailable(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_NotifySceneCreated")] + public static extern void Adaptor_NotifySceneCreated(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_NotifyLanguageChanged")] + public static extern void Adaptor_NotifyLanguageChanged(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetMinimumPinchDistance")] + public static extern void Adaptor_SetMinimumPinchDistance(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedTouchPoint")] + public static extern void Adaptor_FeedTouchPoint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedWheelEvent")] + public static extern void Adaptor_FeedWheelEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedKeyEvent")] + public static extern void Adaptor_FeedKeyEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SceneCreated")] + public static extern void Adaptor_SceneCreated(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetViewMode")] + public static extern void Adaptor_SetViewMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetStereoBase")] + public static extern void Adaptor_SetStereoBase(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_ResizedSignal")] + public static extern global::System.IntPtr Adaptor_ResizedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_LanguageChangedSignal")] + public static extern global::System.IntPtr Adaptor_LanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + //Adaptor Signal Type + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_Empty")] + public static extern bool AdaptorSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_GetConnectionCount")] + public static extern uint AdaptorSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_Connect")] + public static extern void AdaptorSignalType_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_AdaptorSignalType_Disconnect")] + public static extern void AdaptorSignalType_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_AdaptorSignalType_Emit")] + public static extern void AdaptorSignalType_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_AdaptorSignalType")] + public static extern global::System.IntPtr new_AdaptorSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AdaptorSignalType")] + public static extern void delete_AdaptorSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + } } diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs index e02e7f2..6e3640e 100755 --- a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -4493,6 +4493,7 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimePeriod_durationSeconds_get")] public static extern float TimePeriod_durationSeconds_get(global::System.Runtime.InteropServices.HandleRef jarg1); + //Animation Pinvoke [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Animation__SWIG_0")] public static extern global::System.IntPtr new_Animation__SWIG_0(); @@ -4598,6 +4599,9 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_ProgressReachedSignal")] public static extern global::System.IntPtr Animation_ProgressReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_PlayAfter")] + public static extern void Animation_PlayAfter(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBy__SWIG_0")] public static extern void Animation_AnimateBy__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.cs new file mode 100755 index 0000000..8693098 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.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__RenderSurface + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__RenderSurface(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__RenderSurface() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__RenderSurface obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/public/Adaptor.cs b/src/Tizen.NUI/src/public/Adaptor.cs new file mode 100755 index 0000000..bffcd33 --- /dev/null +++ b/src/Tizen.NUI/src/public/Adaptor.cs @@ -0,0 +1,518 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + /// + /// An Adaptor object is used to initialize and control how Dali runs. + /// + /// It provides a lifecycle interface that allows the application + /// writer to provide their own main loop and other platform related + /// features. + /// + /// The Adaptor class provides a means for initialising the resources required by the Dali::Core. + /// + /// When dealing with platform events, the application writer MUST ensure that Dali is called in a + /// thread-safe manner. + /// + /// As soon as the Adaptor class is created and started, the application writer can initialise their + /// View objects straight away or as required by the main loop they intend to use (there is no + /// need to wait for an initialise signal as per the Tizen.NUI.Application class). + /// + /// + public class Adaptor : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Adaptor(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(Adaptor 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; + + ~Adaptor() + { + 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_Adaptor(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + internal static Adaptor GetAdaptorFromPtr(global::System.IntPtr cPtr) + { + Adaptor ret = new Adaptor(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Window window) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_0(Window.getCPtr(window)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Window window, SWIGTYPE_p_Configuration__ContextLoss configuration) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_1(Window.getCPtr(window), SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Any nativeWindow, SWIGTYPE_p_Dali__RenderSurface surface) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_2(Any.getCPtr(nativeWindow), SWIGTYPE_p_Dali__RenderSurface.getCPtr(surface)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Any nativeWindow, SWIGTYPE_p_Dali__RenderSurface surface, SWIGTYPE_p_Configuration__ContextLoss configuration) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_3(Any.getCPtr(nativeWindow), SWIGTYPE_p_Dali__RenderSurface.getCPtr(surface), SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Starts the Adaptor. + /// + internal void Start() + { + NDalicManualPINVOKE.Adaptor_Start(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Pauses the Adaptor. + /// + internal void Pause() + { + NDalicManualPINVOKE.Adaptor_Pause(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Resumes the Adaptor, if previously paused. + /// + /// If the adaptor is not paused, this does not do anything. + internal void Resume() + { + NDalicManualPINVOKE.Adaptor_Resume(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Stops the Adaptor. + /// + internal void Stop() + { + NDalicManualPINVOKE.Adaptor_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback) + { + bool ret = NDalicManualPINVOKE.Adaptor_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void RemoveIdle(SWIGTYPE_p_Dali__CallbackBase callback) + { + NDalicManualPINVOKE.Adaptor_RemoveIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void ReplaceSurface(Any nativeWindow, SWIGTYPE_p_Dali__RenderSurface surface) + { + NDalicManualPINVOKE.Adaptor_ReplaceSurface(swigCPtr, Any.getCPtr(nativeWindow), SWIGTYPE_p_Dali__RenderSurface.getCPtr(surface)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_Dali__RenderSurface GetSurface() + { + SWIGTYPE_p_Dali__RenderSurface ret = new SWIGTYPE_p_Dali__RenderSurface(NDalicManualPINVOKE.Adaptor_GetSurface(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Any GetNativeWindowHandle() + { + Any ret = new Any(NDalicManualPINVOKE.Adaptor_GetNativeWindowHandle(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Release any locks the surface may hold. + /// + /// + /// For example, after compositing an offscreen surface, use this method to allow rendering to continue. + /// + internal void ReleaseSurfaceLock() + { + NDalicManualPINVOKE.Adaptor_ReleaseSurfaceLock(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set the number of frames per render. + /// + /// The number of vsyncs between successive renders.. + /// + /// Suggest this is a power of two: + /// 1 - render each vsync frame + /// 2 - render every other vsync frame + /// 4 - render every fourth vsync frame + /// 8 - render every eighth vsync frame + /// + internal void SetRenderRefreshRate(uint numberOfVSyncsPerRender) + { + NDalicManualPINVOKE.Adaptor_SetRenderRefreshRate(swigCPtr, numberOfVSyncsPerRender); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set whether the frame count per render is managed using the hardware VSync or manually timed. + /// + /// True if the hardware VSync should be used. + internal void SetUseHardwareVSync(bool useHardware) + { + NDalicManualPINVOKE.Adaptor_SetUseHardwareVSync(swigCPtr, useHardware); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private static readonly Adaptor instance = Adaptor.Get(); + + internal static Adaptor Get() + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_Get(), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns a reference to the instance of the adaptor used by the current thread. + /// + /// The adaptor has been initialised.This is only valid in the main thread. + public static Adaptor Instance + { + get + { + return instance; + } + } + + /// + /// Checks whether the adaptor is available. + /// + /// true, if it is available, false otherwise. + internal static bool IsAvailable() + { + bool ret = NDalicManualPINVOKE.Adaptor_IsAvailable(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Call this method to notify Dali when scene is created and initialized. + /// Notify Adaptor that the scene has been created. + /// + internal void NotifySceneCreated() + { + NDalicManualPINVOKE.Adaptor_NotifySceneCreated(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Call this method to notify Dali when the system language changes. + /// + /// Use this only when NOT using Dali::Application, As Application created using + /// Application will automatically receive notification of language change. + /// When Dali::Application is not used, the application developer should + /// use app-core to receive language change notifications and should update Dali + /// by calling this method. + /// + internal void NotifyLanguageChanged() + { + NDalicManualPINVOKE.Adaptor_NotifyLanguageChanged(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets minimum distance in pixels that the fingers must move towards/away from each other in order to trigger a pinch gesture. + /// + /// The minimum pinch distance in pixels. + internal void SetMinimumPinchDistance(float distance) + { + NDalicManualPINVOKE.Adaptor_SetMinimumPinchDistance(swigCPtr, distance); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void FeedTouchPoint(TouchPoint point, int timeStamp) + { + NDalicManualPINVOKE.Adaptor_FeedTouchPoint(swigCPtr, TouchPoint.getCPtr(point), timeStamp); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feed a wheel event to the adaptor. + /// + /// wheel event. + public void FeedWheelEvent(Wheel wheelEvent) + { + NDalicManualPINVOKE.Adaptor_FeedWheelEvent(swigCPtr, Wheel.getCPtr(wheelEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feed a key event to the adaptor. + /// + /// The key event holding the key information. + public void FeedKeyEvent(Key keyEvent) + { + NDalicManualPINVOKE.Adaptor_FeedKeyEvent(swigCPtr, Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Notify Core that the scene has been created. + /// + internal void SceneCreated() + { + NDalicManualPINVOKE.Adaptor_SceneCreated(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetViewMode(ViewMode viewMode) + { + NDalicManualPINVOKE.Adaptor_SetViewMode(swigCPtr, (int)viewMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets the stereo base (eye separation) for Stereoscopic 3D. + /// The stereo base is the distance in millimetres between the eyes. Typical values are + /// between 50mm and 70mm. The default value is 65mm. + /// + /// The stereo base (eye separation) for Stereoscopic 3D. + internal void SetStereoBase(float stereoBase) + { + NDalicManualPINVOKE.Adaptor_SetStereoBase(swigCPtr, stereoBase); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Event arguments that passed via Resized signal. + /// + internal class ResizedEventArgs : EventArgs + { + + /// + /// Adaptor - is the adaptor which has size changed. + /// + public Adaptor Adaptor + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ResizedCallbackDelegate(IntPtr adaptor); + private EventHandler _resizedEventHandler; + private ResizedCallbackDelegate _resizedCallbackDelegate; + + /// + /// Event for Resized signal which can be used to subscribe/unsubscribe the event handler + /// provided by the user. Resized signal is emitted when the size changes.
+ ///
+ internal event EventHandler Resized + { + add + { + if (_resizedEventHandler == null) + { + _resizedCallbackDelegate = (OnResized); + ResizedSignal().Connect(_resizedCallbackDelegate); + } + _resizedEventHandler += value; + } + remove + { + _resizedEventHandler -= value; + if (_resizedEventHandler == null && ResizedSignal().Empty() == false) + { + ResizedSignal().Disconnect(_resizedCallbackDelegate); + } + } + } + + private void OnResized(IntPtr adaptor) + { + ResizedEventArgs e = new ResizedEventArgs(); + if (adaptor != null) + { + e.Adaptor = Adaptor.GetAdaptorFromPtr(adaptor); + } + + if (_resizedEventHandler != null) + { + //here we send all data to user event handlers + _resizedEventHandler(this, e); + } + } + + internal AdaptorSignalType ResizedSignal() + { + AdaptorSignalType ret = new AdaptorSignalType(NDalicManualPINVOKE.Adaptor_ResizedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via LanguageChanged signal. + /// + internal class LanguageChangedEventArgs : EventArgs + { + + /// + /// Adaptor - is the adaptor which has language changed. + /// + public Adaptor Adaptor + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void LanguageChangedCallbackDelegate(IntPtr adaptor); + private EventHandler _languageChangedEventHandler; + private LanguageChangedCallbackDelegate _languageChangedCallbackDelegate; + + /// + /// Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler + /// provided by the user. LanguageChanged signal is emitted when the language changes.
+ ///
+ internal event EventHandler LanguageChanged + { + add + { + if (_languageChangedEventHandler == null) + { + _languageChangedCallbackDelegate = (OnLanguageChanged); + LanguageChangedSignal().Connect(_languageChangedCallbackDelegate); + } + _languageChangedEventHandler += value; + } + remove + { + _languageChangedEventHandler -= value; + if (_languageChangedEventHandler == null && LanguageChangedSignal().Empty() == false) + { + LanguageChangedSignal().Disconnect(_languageChangedCallbackDelegate); + } + } + } + + private void OnLanguageChanged(IntPtr adaptor) + { + LanguageChangedEventArgs e = new LanguageChangedEventArgs(); + if (adaptor != null) + { + e.Adaptor = Adaptor.GetAdaptorFromPtr(adaptor); + } + + if (_languageChangedEventHandler != null) + { + //here we send all data to user event handlers + _languageChangedEventHandler(this, e); + } + } + + internal AdaptorSignalType LanguageChangedSignal() + { + AdaptorSignalType ret = new AdaptorSignalType(NDalicManualPINVOKE.Adaptor_LanguageChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs index aa4e8a1..b0deba5 100755 --- a/src/Tizen.NUI/src/public/Animation.cs +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -904,6 +904,18 @@ namespace Tizen.NUI } /// + /// Play the animation after a given delay time.
+ /// The delay time is not included in the looping time.
+ /// When the delay time is negative value, it would treat as play immediately.
+ ///
+ /// The delay time + public void PlayAfter(int delayMiliSeconds) + { + NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMiliSeconds)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Pauses the animation. /// public void Pause() diff --git a/src/Tizen.NUI/src/public/Key.cs b/src/Tizen.NUI/src/public/Key.cs index 650a776..e17632e 100755 --- a/src/Tizen.NUI/src/public/Key.cs +++ b/src/Tizen.NUI/src/public/Key.cs @@ -126,6 +126,10 @@ namespace Tizen.NUI { return keyPressedName; } + set + { + keyPressedName = value; + } } /* duplicated with KeyPressedName : removed @@ -147,6 +151,10 @@ namespace Tizen.NUI { return keyCode; } + set + { + keyCode = value; + } } /// @@ -158,6 +166,10 @@ namespace Tizen.NUI { return keyModifier; } + set + { + keyModifier = value; + } } /// @@ -169,6 +181,10 @@ namespace Tizen.NUI { return time; } + set + { + time = value; + } } /// @@ -180,6 +196,10 @@ namespace Tizen.NUI { return state; } + set + { + state = value; + } } public DeviceClassType DeviceClass