From c692f011f578763bdea6e5df208e45b7d2a611ff Mon Sep 17 00:00:00 2001 From: "xb.teng" Date: Fri, 16 Jun 2017 14:04:40 +0800 Subject: [PATCH] [Tizen] Manual binding for widget view and widget view manager. - When making tizen tpk application, the privilege setting is required. please add the followings in tizen-manifest.xml => "appmanager.launch", "widget.viewer" Conflicts: NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj NUISamples/NUISamples/NUISamples.TizenTV/tizen-manifest.xml Tizen.NUI/src/internal/ManualPINVOKE.cs Change-Id: If4e879baae9b4de6bd72e5ec8c5cce8a5effd897 --- NUISamples/examples/widget-view-test.cs | 105 ++++ src/Tizen.NUI/src/internal/ManualPINVOKE.cs | 132 +++++ src/Tizen.NUI/src/internal/WidgetViewSignal.cs | 97 ++++ src/Tizen.NUI/src/public/NUIApplication.cs | 8 + src/Tizen.NUI/src/public/WidgetView.cs | 671 +++++++++++++++++++++++++ src/Tizen.NUI/src/public/WidgetViewManager.cs | 122 +++++ 6 files changed, 1135 insertions(+) create mode 100755 NUISamples/examples/widget-view-test.cs create mode 100755 src/Tizen.NUI/src/internal/WidgetViewSignal.cs create mode 100755 src/Tizen.NUI/src/public/WidgetView.cs create mode 100755 src/Tizen.NUI/src/public/WidgetViewManager.cs diff --git a/NUISamples/examples/widget-view-test.cs b/NUISamples/examples/widget-view-test.cs new file mode 100755 index 0000000..cdc2562 --- /dev/null +++ b/NUISamples/examples/widget-view-test.cs @@ -0,0 +1,105 @@ + +using System; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +namespace WidgetViewTest +{ + class Example : NUIApplication + { + private PushButton _widgetButton; + private PushButton _deletedButton; + private WidgetView _widgetView; + private WidgetViewManager _widgetViewManager; + private View _container; + private string _instanceID; + + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + } + + protected override void OnTerminate() + { + //This function is called when the app exit normally. + base.OnTerminate(); + } + + public void Initialize() + { + Window window = Window.Instance; + window.BackgroundColor = Color.White; + + Tizen.Log.Debug("NUI", "### DP1"); + Layer layer = new Layer(); + layer.Behavior = Layer.LayerBehavior.Layer3D; + window.Add(layer); + Tizen.Log.Debug("NUI", "### DP2"); + _container = new View(); + _container.ParentOrigin = ParentOrigin.Center; + _container.PivotPoint = PivotPoint.Center; + _container.Size2D = new Size2D(400, 400); + Tizen.Log.Debug("NUI", "### DP3"); + _widgetButton = new PushButton(); + _widgetButton.LabelText = "Widget"; + _widgetButton.ParentOrigin = ParentOrigin.BottomLeft; + _widgetButton.PivotPoint = PivotPoint.BottomLeft; + _widgetButton.PositionUsesAnchorPoint = true; + _widgetButton.Size2D = new Size2D(200, 100); + window.Add(_widgetButton); + _widgetButton.Clicked += (obj, e) => + { + _widgetView = _widgetViewManager.AddWidget("widget-efl.example", "", 450, 700, -1); + _widgetView.ParentOrigin = ParentOrigin.Center; + _widgetView.PivotPoint = PivotPoint.Center; + _widgetView.PositionUsesAnchorPoint = true; + _widgetView.BackgroundColor = Color.Yellow; + _widgetView.WidgetAdded += (sender, eargs) => + { + _widgetButton.LabelText = "Quit"; + window.Add(_widgetView); + }; + _widgetView.WidgetDeleted += (sender, eargs) => + { + window.Remove(_widgetView); + _widgetButton.LabelText = "Button"; + }; + _instanceID = _widgetView.InstanceID; + return false; + }; + + _deletedButton = new PushButton(); + _deletedButton.LabelText = "Buton"; + _deletedButton.ParentOrigin = ParentOrigin.BottomRight; + _deletedButton.PivotPoint = PivotPoint.BottomRight; + _deletedButton.PositionUsesAnchorPoint = true; + _deletedButton.Size2D = new Size2D(200, 100); + window.Add(_deletedButton); + _deletedButton.Clicked += (obj, e) => + { + OnTerminate(); + return true; + }; + + layer.Add(_container); + Tizen.Log.Debug("NUI", "### widget view manager create start"); + _widgetViewManager = new WidgetViewManager(this, "org.tizen.example.widget_viewer_test.Tizen"); + if (!_widgetViewManager) + { + Tizen.Log.Fatal("NUI", "### Widget is not enabled!"); + } + + Tizen.Log.Debug("NUI", "### widget view manager create sucess"); + } + + [STAThread] + static void _Main(string[] args) + { + Example example = new Example(); + example.Run(args); + } + } +} + diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index 7b257e1..d5e3da9 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -719,5 +719,137 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ResizedSignal")] public static extern void delete_ResizedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + //for widget view + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_WIDGET_ID_get")] + public static extern int WidgetView_Property_WIDGET_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_INSTANCE_ID_get")] + public static extern int WidgetView_Property_INSTANCE_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_CONTENT_INFO_get")] + public static extern int WidgetView_Property_CONTENT_INFO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_TITLE_get")] + public static extern int WidgetView_Property_TITLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_UPDATE_PERIOD_get")] + public static extern int WidgetView_Property_UPDATE_PERIOD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_PREVIEW_get")] + public static extern int WidgetView_Property_PREVIEW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_LOADING_TEXT_get")] + public static extern int WidgetView_Property_LOADING_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_WIDGET_STATE_FAULTED_get")] + public static extern int WidgetView_Property_WIDGET_STATE_FAULTED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_PERMANENT_DELETE_get")] + public static extern int WidgetView_Property_PERMANENT_DELETE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetView_Property")] + public static extern global::System.IntPtr new_WidgetView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetView_Property")] + public static extern void delete_WidgetView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_New")] + public static extern global::System.IntPtr WidgetView_New(string jarg1, string jarg2, int jarg3, int jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_DownCast")] + public static extern global::System.IntPtr WidgetView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetView__SWIG_0")] + public static extern global::System.IntPtr new_WidgetView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetView__SWIG_1")] + public static extern global::System.IntPtr new_WidgetView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Assign")] + public static extern global::System.IntPtr WidgetView_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_WidgetView")] + public static extern void delete_WidgetView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_PauseWidget")] + public static extern bool WidgetView_PauseWidget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_ResumeWidget")] + public static extern bool WidgetView_ResumeWidget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_CancelTouchEvent")] + public static extern bool WidgetView_CancelTouchEvent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_ActivateFaultedWidget")] + public static extern void WidgetView_ActivateFaultedWidget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetAddedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetAddedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetDeletedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetDeletedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetCreationAbortedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetCreationAbortedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetContentUpdatedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetContentUpdatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetUpdatePeriodChangedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetUpdatePeriodChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetFaultedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetFaultedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_Empty")] + public static extern bool WidgetViewSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_GetConnectionCount")] + public static extern uint WidgetViewSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_Connect")] + public static extern void WidgetViewSignal_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_WidgetViewSignal_Disconnect")] + public static extern void WidgetViewSignal_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_WidgetViewSignal_Emit")] + public static extern void WidgetViewSignal_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_WidgetViewSignal")] + public static extern global::System.IntPtr new_WidgetViewSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetViewSignal")] + public static extern void delete_WidgetViewSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_SWIGUpcast")] + public static extern global::System.IntPtr WidgetView_SWIGUpcast(global::System.IntPtr jarg1); + + // For widget view manager + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_New")] + public static extern global::System.IntPtr WidgetViewManager_New(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_DownCast")] + public static extern global::System.IntPtr WidgetViewManager_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetViewManager__SWIG_0")] + public static extern global::System.IntPtr new_WidgetViewManager__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetViewManager__SWIG_1")] + public static extern global::System.IntPtr new_WidgetViewManager__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_Assign")] + public static extern global::System.IntPtr WidgetViewManager_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_WidgetViewManager")] + public static extern void delete_WidgetViewManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_AddWidget")] + public static extern global::System.IntPtr WidgetViewManager_AddWidget(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5, float jarg6); + + [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); + } } diff --git a/src/Tizen.NUI/src/internal/WidgetViewSignal.cs b/src/Tizen.NUI/src/internal/WidgetViewSignal.cs new file mode 100755 index 0000000..bab8ae1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetViewSignal.cs @@ -0,0 +1,97 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + public class WidgetViewSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetViewSignal(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(WidgetViewSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~WidgetViewSignal() + { + Dispose(); + } + + public virtual void Dispose() + { + lock (this) + { + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetViewSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetViewSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetViewSignal_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.WidgetViewSignal_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.WidgetViewSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetView arg) + { + NDalicManualPINVOKE.WidgetViewSignal_Emit(swigCPtr, WidgetView.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetViewSignal() : this(NDalicManualPINVOKE.new_WidgetViewSignal(), true) + { + 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 7411f0c..d8f7bbd 100755 --- a/src/Tizen.NUI/src/public/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -254,5 +254,13 @@ namespace Tizen.NUI return _application.GetWindow(); } } + + internal Application ApplicationHandle + { + get + { + return _application; + } + } } } diff --git a/src/Tizen.NUI/src/public/WidgetView.cs b/src/Tizen.NUI/src/public/WidgetView.cs new file mode 100755 index 0000000..cccc109 --- /dev/null +++ b/src/Tizen.NUI/src/public/WidgetView.cs @@ -0,0 +1,671 @@ +/** 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. +* +*/ +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// WidgetView is a class for displaying the widget image and controlling the widget.
+ /// Input events that WidgetView gets are delivered to the widget. + ///
+ public class WidgetView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Button instance be disposed. + /// + 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; + NDalicManualPINVOKE.delete_WidgetView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + base.Dispose(); + } + + internal class Property + { + internal static readonly int WIDGET_ID = NDalicManualPINVOKE.WidgetView_Property_WIDGET_ID_get(); + internal static readonly int INSTANCE_ID = NDalicManualPINVOKE.WidgetView_Property_INSTANCE_ID_get(); + internal static readonly int CONTENT_INFO = NDalicManualPINVOKE.WidgetView_Property_CONTENT_INFO_get(); + internal static readonly int TITLE = NDalicManualPINVOKE.WidgetView_Property_TITLE_get(); + internal static readonly int UPDATE_PERIOD = NDalicManualPINVOKE.WidgetView_Property_UPDATE_PERIOD_get(); + internal static readonly int PREVIEW = NDalicManualPINVOKE.WidgetView_Property_PREVIEW_get(); + internal static readonly int LOADING_TEXT = NDalicManualPINVOKE.WidgetView_Property_LOADING_TEXT_get(); + internal static readonly int WIDGET_STATE_FAULTED = NDalicManualPINVOKE.WidgetView_Property_WIDGET_STATE_FAULTED_get(); + internal static readonly int PERMANENT_DELETE = NDalicManualPINVOKE.WidgetView_Property_PERMANENT_DELETE_get(); + } + + /// + /// Create a new WidgetView. + /// + public WidgetView(string widgetId, string contentInfo, int width, int height, float updatePeriod) : this(NDalicManualPINVOKE.WidgetView_New(widgetId, contentInfo, width, height, updatePeriod), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + internal new static WidgetView DownCast(BaseHandle handle) + { + WidgetView ret = new WidgetView(NDalicManualPINVOKE.WidgetView_DownCast(BaseHandle.getCPtr(handle)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetView(WidgetView handle) : this(NDalicManualPINVOKE.new_WidgetView__SWIG_1(WidgetView.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetView Assign(WidgetView handle) + { + WidgetView ret = new WidgetView(NDalicManualPINVOKE.WidgetView_Assign(swigCPtr, WidgetView.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static WidgetView GetWidgetViewFromPtr(global::System.IntPtr cPtr) + { + WidgetView ret = new WidgetView(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments of widget view. + /// + public class WidgetViewEventArgs : EventArgs + { + private WidgetView _widgetView; + + /// + /// The widet view. + /// + public WidgetView WidgetView + { + get + { + return _widgetView; + } + set + { + _widgetView = value; + } + } + } + + private EventHandler _widgetAddedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetAddedEventCallbackType(IntPtr data); + private WidgetAddedEventCallbackType _widgetAddedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetAdded + { + add + { + if (_widgetAddedEventHandler == null) + { + _widgetAddedEventCallback = OnWidgetAdded; + WidgetAddedSignal().Connect(_widgetAddedEventCallback); + } + + _widgetAddedEventHandler += value; + } + + remove + { + _widgetAddedEventHandler -= value; + + if (_widgetAddedEventHandler == null && WidgetAddedSignal().Empty() == false) + { + WidgetAddedSignal().Disconnect(_widgetAddedEventCallback); + } + } + } + + // Callback for WidgetView WidgetAdded signal + private void OnWidgetAdded(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetAddedEventHandler != null) + { + _widgetAddedEventHandler(this, e); + } + } + + private EventHandler _widgetDeletedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetDeletedEventCallbackType(IntPtr data); + private WidgetDeletedEventCallbackType _widgetDeletedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetDeleted + { + add + { + if (_widgetDeletedEventHandler == null) + { + _widgetDeletedEventCallback = OnWidgetDeleted; + WidgetDeletedSignal().Connect(_widgetDeletedEventCallback); + } + + _widgetDeletedEventHandler += value; + } + + remove + { + _widgetDeletedEventHandler -= value; + + if (_widgetDeletedEventHandler == null && WidgetDeletedSignal().Empty() == false) + { + WidgetDeletedSignal().Disconnect(_widgetDeletedEventCallback); + } + } + } + + // Callback for WidgetView WidgetDeleted signal + private void OnWidgetDeleted(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetDeletedEventHandler != null) + { + _widgetDeletedEventHandler(this, e); + } + } + + private EventHandler _widgetCreationAbortedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetCreationAbortedEventCallbackType(IntPtr data); + private WidgetCreationAbortedEventCallbackType _widgetCreationAbortedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetCreationAborted + { + add + { + if (_widgetCreationAbortedEventHandler == null) + { + _widgetCreationAbortedEventCallback = OnWidgetCreationAborted; + WidgetCreationAbortedSignal().Connect(_widgetCreationAbortedEventCallback); + } + + _widgetCreationAbortedEventHandler += value; + } + + remove + { + _widgetCreationAbortedEventHandler -= value; + + if (_widgetCreationAbortedEventHandler == null && WidgetCreationAbortedSignal().Empty() == false) + { + WidgetCreationAbortedSignal().Disconnect(_widgetCreationAbortedEventCallback); + } + } + } + + // Callback for WidgetView WidgetCreationAborted signal + private void OnWidgetCreationAborted(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetCreationAbortedEventHandler != null) + { + _widgetCreationAbortedEventHandler(this, e); + } + } + + private EventHandler _widgetContentUpdatedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetContentUpdatedEventCallbackType(IntPtr data); + private WidgetContentUpdatedEventCallbackType _widgetContentUpdatedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetContentUpdated + { + add + { + if (_widgetContentUpdatedEventHandler == null) + { + _widgetContentUpdatedEventCallback = OnWidgetContentUpdated; + WidgetContentUpdatedSignal().Connect(_widgetContentUpdatedEventCallback); + } + + _widgetContentUpdatedEventHandler += value; + } + + remove + { + _widgetContentUpdatedEventHandler -= value; + + if (_widgetContentUpdatedEventHandler == null && WidgetContentUpdatedSignal().Empty() == false) + { + WidgetContentUpdatedSignal().Disconnect(_widgetContentUpdatedEventCallback); + } + } + } + + // Callback for WidgetView WidgetContentUpdated signal + private void OnWidgetContentUpdated(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetContentUpdatedEventHandler != null) + { + _widgetContentUpdatedEventHandler(this, e); + } + } + + private EventHandler _widgetUpdatePeriodChangedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetUpdatePeriodChangedEventCallbackType(IntPtr data); + private WidgetUpdatePeriodChangedEventCallbackType _widgetUpdatePeriodChangedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetUpdatePeriodChanged + { + add + { + if (_widgetUpdatePeriodChangedEventHandler == null) + { + _widgetUpdatePeriodChangedEventCallback = OnWidgetUpdatePeriodChanged; + WidgetUpdatePeriodChangedSignal().Connect(_widgetUpdatePeriodChangedEventCallback); + } + + _widgetUpdatePeriodChangedEventHandler += value; + } + + remove + { + _widgetUpdatePeriodChangedEventHandler -= value; + + if (_widgetUpdatePeriodChangedEventHandler == null && WidgetUpdatePeriodChangedSignal().Empty() == false) + { + WidgetUpdatePeriodChangedSignal().Disconnect(_widgetUpdatePeriodChangedEventCallback); + } + } + } + + // Callback for WidgetView WidgetUpdatePeriodChanged signal + private void OnWidgetUpdatePeriodChanged(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetUpdatePeriodChangedEventHandler != null) + { + _widgetUpdatePeriodChangedEventHandler(this, e); + } + } + + private EventHandler _widgetFaultedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetFaultedEventCallbackType(IntPtr data); + private WidgetFaultedEventCallbackType _widgetFaultedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetFaulted + { + add + { + if (_widgetFaultedEventHandler == null) + { + _widgetFaultedEventCallback = OnWidgetFaulted; + WidgetFaultedSignal().Connect(_widgetFaultedEventCallback); + } + + _widgetFaultedEventHandler += value; + } + + remove + { + _widgetFaultedEventHandler -= value; + + if (_widgetFaultedEventHandler == null && WidgetFaultedSignal().Empty() == false) + { + WidgetFaultedSignal().Disconnect(_widgetFaultedEventCallback); + } + } + } + + // Callback for WidgetView WidgetFaulted signal + private void OnWidgetFaulted(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetFaultedEventHandler != null) + { + _widgetFaultedEventHandler(this, e); + } + } + + /// + /// Pauses a given widget. + /// + /// true on success, false otherwise. + public bool PauseWidget() + { + bool ret = NDalicManualPINVOKE.WidgetView_PauseWidget(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Resume a given widget. + /// + /// true on success, false otherwise. + public bool ResumeWidget() + { + bool ret = NDalicManualPINVOKE.WidgetView_ResumeWidget(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Cancels touch event procedure. + /// If you call this function after feed the touch down event, the widget will get ON_HOLD events. + /// If a widget gets ON_HOLD event, it will not do anything even if you feed touch up event. + /// + /// true on success, false otherwise. + public bool CancelTouchEvent() + { + bool ret = NDalicManualPINVOKE.WidgetView_CancelTouchEvent(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Activate a widget in faulted state. + /// A widget in faulted state MUST be activated before adding the widget. + /// + public void ActivateFaultedWidget() + { + NDalicManualPINVOKE.WidgetView_ActivateFaultedWidget(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetViewSignal WidgetAddedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetAddedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetDeletedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetDeletedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetCreationAbortedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetCreationAbortedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetContentUpdatedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetContentUpdatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetUpdatePeriodChangedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetUpdatePeriodChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetFaultedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetFaultedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the id of widget. + /// + public string WidgetID + { + get + { + string temp; + GetProperty(WidgetView.Property.WIDGET_ID).Get(out temp); + return temp; + } + } + + /// + /// Gets the id of instance. + /// + public string InstanceID + { + get + { + string temp; + GetProperty(WidgetView.Property.INSTANCE_ID).Get(out temp); + return temp; + } + } + + /// + /// Gets the content info. + /// + public string ContentInfo + { + get + { + string temp; + GetProperty(WidgetView.Property.CONTENT_INFO).Get(out temp); + return temp; + } + } + + /// + /// Gets the title. + /// + public string Title + { + get + { + string temp; + GetProperty(WidgetView.Property.TITLE).Get(out temp); + return temp; + } + } + + /// + /// Gets the update peroid. + /// + public float UpdatePeriod + { + get + { + float temp; + GetProperty(WidgetView.Property.UPDATE_PERIOD).Get(out temp); + return temp; + } + } + + /// + /// Gets/sets the preview. + /// + public bool Preview + { + get + { + bool temp; + GetProperty(WidgetView.Property.PREVIEW).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.PREVIEW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/sets the loading text. + /// + public bool LoadingText + { + get + { + bool temp; + GetProperty(WidgetView.Property.LOADING_TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.LOADING_TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/sets whether the widget state is faulted or not. + /// + public bool WidgetStateFaulted + { + get + { + bool temp; + GetProperty(WidgetView.Property.WIDGET_STATE_FAULTED).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.WIDGET_STATE_FAULTED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/sets whether the widget is permanent delete or not. + /// + public bool PermanentDelete + { + get + { + bool temp; + GetProperty(WidgetView.Property.PERMANENT_DELETE).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.PERMANENT_DELETE, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/WidgetViewManager.cs b/src/Tizen.NUI/src/public/WidgetViewManager.cs new file mode 100755 index 0000000..b77dcde --- /dev/null +++ b/src/Tizen.NUI/src/public/WidgetViewManager.cs @@ -0,0 +1,122 @@ +/** 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. +* +*/ +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + /// + /// WidgetViewManager manages addition of WidgetView controls. + /// This class provides the functionality of adding the widget views and controlling the widgets. + /// + public class WidgetViewManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetViewManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetViewManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetViewManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make WidgetViewManager instance be disposed. + /// + 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; + NDalicManualPINVOKE.delete_WidgetViewManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + base.Dispose(type); + } + + public WidgetViewManager(NUIApplication nuiApplication, string appId) : this(NDalicManualPINVOKE.WidgetViewManager_New(Application.getCPtr(nuiApplication.ApplicationHandle), appId), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static WidgetViewManager DownCast(BaseHandle handle) + { + WidgetViewManager ret = new WidgetViewManager(NDalicManualPINVOKE.WidgetViewManager_DownCast(BaseHandle.getCPtr(handle)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewManager(WidgetViewManager handle) : this(NDalicManualPINVOKE.new_WidgetViewManager__SWIG_1(WidgetViewManager.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetViewManager Assign(WidgetViewManager handle) + { + WidgetViewManager ret = new WidgetViewManager(NDalicManualPINVOKE.WidgetViewManager_Assign(swigCPtr, WidgetViewManager.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Creates a new widget view object. + /// + /// The widget id. + /// Contents that will be given to the widget instance. + /// The widget width. + /// The widget height. + /// The period of updating contents of the widget. + /// A handle to WidgetView. + public WidgetView AddWidget(string widgetId, string contentInfo, int width, int height, float updatePeriod) + { + WidgetView ret = new WidgetView(NDalicManualPINVOKE.WidgetViewManager_AddWidget(swigCPtr, widgetId, contentInfo, width, height, updatePeriod), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} -- 2.7.4