/* * Copyright(c) 2021 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 { using System; using System.Runtime.InteropServices; using Tizen.NUI.BaseComponents; using Tizen.NUI.Binding; /// /// The WidgetView is a class for displaying the widget image and controlling the widget.
/// Input events that the WidgetView gets are delivered to the widget. ///
/// 3 public class WidgetView : View { /// /// PreviewProperty /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty PreviewProperty = BindableProperty.Create(nameof(Preview), typeof(bool), typeof(Tizen.NUI.WidgetView), false, propertyChanged: (bindable, oldValue, newValue) => { var instance = (Tizen.NUI.WidgetView)bindable; if (newValue != null) { instance.InternalPreview = (bool)newValue; } }, defaultValueCreator: (bindable) => { var instance = (Tizen.NUI.WidgetView)bindable; return instance.InternalPreview; }); /// /// LoadingTextProperty /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty LoadingTextProperty = BindableProperty.Create(nameof(LoadingText), typeof(bool), typeof(Tizen.NUI.WidgetView), false, propertyChanged: (bindable, oldValue, newValue) => { var instance = (Tizen.NUI.WidgetView)bindable; if (newValue != null) { instance.InternalLoadingText = (bool)newValue; } }, defaultValueCreator: (bindable) => { var instance = (Tizen.NUI.WidgetView)bindable; return instance.InternalLoadingText; }); /// /// WidgetStateFaultedProperty /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty WidgetStateFaultedProperty = BindableProperty.Create(nameof(WidgetStateFaulted), typeof(bool), typeof(Tizen.NUI.WidgetView), false, propertyChanged: (bindable, oldValue, newValue) => { var instance = (Tizen.NUI.WidgetView)bindable; if (newValue != null) { instance.InternalWidgetStateFaulted = (bool)newValue; } }, defaultValueCreator: (bindable) => { var instance = (Tizen.NUI.WidgetView)bindable; return instance.InternalWidgetStateFaulted; }); /// /// PermanentDeleteProperty /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty PermanentDeleteProperty = BindableProperty.Create(nameof(PermanentDelete), typeof(bool), typeof(Tizen.NUI.WidgetView), false, propertyChanged: (bindable, oldValue, newValue) => { var instance = (Tizen.NUI.WidgetView)bindable; if (newValue != null) { instance.InternalPermanentDelete = (bool)newValue; } }, defaultValueCreator: (bindable) => { var instance = (Tizen.NUI.WidgetView)bindable; return instance.InternalPermanentDelete; }); /// /// RetryTextProperty /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty RetryTextProperty = BindableProperty.Create(nameof(RetryText), typeof(Tizen.NUI.PropertyMap), typeof(Tizen.NUI.WidgetView), null, propertyChanged: (bindable, oldValue, newValue) => { var instance = (Tizen.NUI.WidgetView)bindable; if (newValue != null) { instance.InternalRetryText = (Tizen.NUI.PropertyMap)newValue; } }, defaultValueCreator: (bindable) => { var instance = (Tizen.NUI.WidgetView)bindable; return instance.InternalRetryText; }); /// /// EffectProperty /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty EffectProperty = BindableProperty.Create(nameof(Effect), typeof(Tizen.NUI.PropertyMap), typeof(Tizen.NUI.WidgetView), null, propertyChanged: (bindable, oldValue, newValue) => { var instance = (Tizen.NUI.WidgetView)bindable; if (newValue != null) { instance.InternalEffect = (Tizen.NUI.PropertyMap)newValue; } }, defaultValueCreator: (bindable) => { var instance = (Tizen.NUI.WidgetView)bindable; return instance.InternalEffect; }); private EventHandler widgetAddedEventHandler; private WidgetAddedEventCallbackType widgetAddedEventCallback; private EventHandler widgetContentUpdatedEventHandler; private WidgetContentUpdatedEventCallbackType widgetContentUpdatedEventCallback; private EventHandler widgetDeletedEventHandler; private WidgetDeletedEventCallbackType widgetDeletedEventCallback; private EventHandler widgetCreationAbortedEventHandler; private WidgetCreationAbortedEventCallbackType widgetCreationAbortedEventCallback; private EventHandler widgetUpdatePeriodChangedEventHandler; private WidgetUpdatePeriodChangedEventCallbackType widgetUpdatePeriodChangedEventCallback; private EventHandler widgetFaultedEventHandler; private WidgetFaultedEventCallbackType widgetFaultedEventCallback; /// /// Used in xaml as factory method to create WidgetView. /// /// /// /// /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public static WidgetView CreateWidgetView(string widgetId, string contentInfo, int width, int height, float updatePeriod) { return WidgetViewManager.Instance.AddWidget(widgetId, contentInfo, width, height, updatePeriod); } /// /// Creates a new WidgetView. /// /// 3 public WidgetView(string widgetId, string contentInfo, int width, int height, float updatePeriod) : this(Interop.WidgetView.New(widgetId, contentInfo, width, height, updatePeriod), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { } internal WidgetView(WidgetView handle) : this(Interop.WidgetView.NewWidgetView(WidgetView.getCPtr(handle)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WidgetAddedEventCallbackType(IntPtr data); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WidgetContentUpdatedEventCallbackType(IntPtr data); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WidgetDeletedEventCallbackType(IntPtr data); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WidgetCreationAbortedEventCallbackType(IntPtr data); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WidgetUpdatePeriodChangedEventCallbackType(IntPtr data); [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WidgetFaultedEventCallbackType(IntPtr data); /// /// An event for the WidgetAdded signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when widget is added.
///
/// 3 public event EventHandler WidgetAdded { add { if (widgetAddedEventHandler == null) { widgetAddedEventCallback = OnWidgetAdded; WidgetViewSignal widgetAdded = WidgetAddedSignal(); widgetAdded?.Connect(widgetAddedEventCallback); widgetAdded?.Dispose(); } widgetAddedEventHandler += value; } remove { widgetAddedEventHandler -= value; WidgetViewSignal widgetAdded = WidgetAddedSignal(); if (widgetAddedEventHandler == null && widgetAdded?.Empty() == false) { widgetAdded?.Disconnect(widgetAddedEventCallback); } widgetAdded?.Dispose(); } } /// /// An event for the WidgetContentUpdated signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when the widget content is updated.
///
/// 3 public event EventHandler WidgetContentUpdated { add { if (widgetContentUpdatedEventHandler == null) { widgetContentUpdatedEventCallback = OnWidgetContentUpdated; WidgetViewSignal widgetContentUpdated = WidgetContentUpdatedSignal(); widgetContentUpdated?.Connect(widgetContentUpdatedEventCallback); widgetContentUpdated?.Dispose(); } widgetContentUpdatedEventHandler += value; } remove { widgetContentUpdatedEventHandler -= value; WidgetViewSignal widgetContentUpdated = WidgetContentUpdatedSignal(); if (widgetContentUpdatedEventHandler == null && widgetContentUpdated?.Empty() == false) { widgetContentUpdated?.Disconnect(widgetContentUpdatedEventCallback); } widgetContentUpdated?.Dispose(); } } /// /// An event for the WidgetDeleted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when the widget is deleted.
///
/// 3 public event EventHandler WidgetDeleted { add { if (widgetDeletedEventHandler == null) { widgetDeletedEventCallback = OnWidgetDeleted; WidgetViewSignal widgetDeleted = WidgetDeletedSignal(); widgetDeleted?.Connect(widgetDeletedEventCallback); widgetDeleted?.Dispose(); } widgetDeletedEventHandler += value; } remove { widgetDeletedEventHandler -= value; WidgetViewSignal widgetDeleted = WidgetDeletedSignal(); if (widgetDeletedEventHandler == null && widgetDeleted?.Empty() == false) { widgetDeleted?.Disconnect(widgetDeletedEventCallback); } widgetDeleted?.Dispose(); } } /// /// An event for the WidgetCreationAborted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when the widget creation is aborted.
///
/// 3 public event EventHandler WidgetCreationAborted { add { if (widgetCreationAbortedEventHandler == null) { widgetCreationAbortedEventCallback = OnWidgetCreationAborted; WidgetViewSignal widgetCreationAborted = WidgetCreationAbortedSignal(); widgetCreationAborted?.Connect(widgetCreationAbortedEventCallback); widgetCreationAborted?.Dispose(); } widgetCreationAbortedEventHandler += value; } remove { widgetCreationAbortedEventHandler -= value; WidgetViewSignal widgetCreationAborted = WidgetCreationAbortedSignal(); if (widgetCreationAbortedEventHandler == null && widgetCreationAborted?.Empty() == false) { widgetCreationAborted?.Disconnect(widgetCreationAbortedEventCallback); } widgetCreationAborted?.Dispose(); } } /// /// An event for the WidgetUpdatePeriodChanged signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when the widget update period is changed.
///
/// 3 public event EventHandler WidgetUpdatePeriodChanged { add { if (widgetUpdatePeriodChangedEventHandler == null) { widgetUpdatePeriodChangedEventCallback = OnWidgetUpdatePeriodChanged; WidgetViewSignal widgetUpdatePeriodChanged = WidgetUpdatePeriodChangedSignal(); widgetUpdatePeriodChanged?.Connect(widgetUpdatePeriodChangedEventCallback); widgetUpdatePeriodChanged?.Dispose(); } widgetUpdatePeriodChangedEventHandler += value; } remove { widgetUpdatePeriodChangedEventHandler -= value; WidgetViewSignal widgetUpdatePeriodChanged = WidgetUpdatePeriodChangedSignal(); if (widgetUpdatePeriodChangedEventHandler == null && widgetUpdatePeriodChanged?.Empty() == false) { widgetUpdatePeriodChanged?.Disconnect(widgetUpdatePeriodChangedEventCallback); } widgetUpdatePeriodChanged?.Dispose(); } } /// /// An event for the WidgetFaulted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when the widget process is not running.
///
/// 3 public event EventHandler WidgetFaulted { add { if (widgetFaultedEventHandler == null) { widgetFaultedEventCallback = OnWidgetFaulted; WidgetViewSignal widgetFaulted = WidgetFaultedSignal(); widgetFaulted?.Connect(widgetFaultedEventCallback); widgetFaulted?.Dispose(); } widgetFaultedEventHandler += value; } remove { widgetFaultedEventHandler -= value; WidgetViewSignal widgetFaulted = WidgetFaultedSignal(); if (widgetFaultedEventHandler == null && widgetFaulted?.Empty() == false) { widgetFaulted?.Disconnect(widgetFaultedEventCallback); } widgetFaulted?.Dispose(); } } /// /// Gets the ID of the widget. /// /// 3 public string WidgetID { get { string retValue = ""; PropertyValue widgetId = GetProperty(WidgetView.Property.WidgetId); widgetId?.Get(out retValue); widgetId?.Dispose(); return retValue; } } /// /// Gets the ID of the instance. /// /// 3 public string InstanceID { get { string retValue = ""; PropertyValue instanceId = GetProperty(WidgetView.Property.InstanceId); instanceId?.Get(out retValue); instanceId?.Dispose(); return retValue; } } /// /// Gets the content info. /// /// 3 public string ContentInfo { get { string retValue = ""; PropertyValue contentInfo = GetProperty(WidgetView.Property.ContentInfo); contentInfo?.Get(out retValue); contentInfo?.Dispose(); return retValue; } } /// /// Gets the title. /// /// 3 public string Title { get { string retValue = ""; PropertyValue title = GetProperty(WidgetView.Property.TITLE); title?.Get(out retValue); title?.Dispose(); return retValue; } } /// /// Gets the update period. /// /// 3 public float UpdatePeriod { get { float retValue = 0; PropertyValue updatePeriod = GetProperty(WidgetView.Property.UpdatePeriod); updatePeriod?.Get(out retValue); updatePeriod?.Dispose(); return retValue; } } /// /// Gets or sets the preview. /// /// 3 public bool Preview { get { return (bool)GetValue(PreviewProperty); } set { SetValue(PreviewProperty, value); NotifyPropertyChanged(); } } private bool InternalPreview { get { bool retValue = false; PropertyValue preview = GetProperty(WidgetView.Property.PREVIEW); preview?.Get(out retValue); preview?.Dispose(); return retValue; } set { PropertyValue setValue = new Tizen.NUI.PropertyValue(value); SetProperty(WidgetView.Property.PREVIEW, setValue); setValue?.Dispose(); } } /// /// Gets or sets the loading text. /// /// 3 public bool LoadingText { get { return (bool)GetValue(LoadingTextProperty); } set { SetValue(LoadingTextProperty, value); NotifyPropertyChanged(); } } private bool InternalLoadingText { get { bool retValue = false; PropertyValue loadingText = GetProperty(WidgetView.Property.LoadingText); loadingText?.Get(out retValue); loadingText?.Dispose(); return retValue; } set { PropertyValue setValue = new Tizen.NUI.PropertyValue(value); SetProperty(WidgetView.Property.LoadingText, setValue); setValue?.Dispose(); } } /// /// Gets or sets whether the widget state is faulted or not. /// /// 3 public bool WidgetStateFaulted { get { return (bool)GetValue(WidgetStateFaultedProperty); } set { SetValue(WidgetStateFaultedProperty, value); NotifyPropertyChanged(); } } private bool InternalWidgetStateFaulted { get { bool retValue = false; PropertyValue widgetStateFaulted = GetProperty(WidgetView.Property.WidgetStateFaulted); widgetStateFaulted?.Get(out retValue); widgetStateFaulted?.Dispose(); return retValue; } set { PropertyValue setValue = new Tizen.NUI.PropertyValue(value); SetProperty(WidgetView.Property.WidgetStateFaulted, setValue); setValue?.Dispose(); } } /// /// Gets or sets whether the widget is to delete permanently or not. /// /// 3 public bool PermanentDelete { get { return (bool)GetValue(PermanentDeleteProperty); } set { SetValue(PermanentDeleteProperty, value); NotifyPropertyChanged(); } } private bool InternalPermanentDelete { get { bool retValue = false; PropertyValue permanentDelete = GetProperty(WidgetView.Property.PermanentDelete); permanentDelete?.Get(out retValue); permanentDelete?.Dispose(); return retValue; } set { PropertyValue setValue = new Tizen.NUI.PropertyValue(value); SetProperty(WidgetView.Property.PermanentDelete, setValue); setValue.Dispose(); } } /// /// Gets or sets retry text. /// /// 4 public PropertyMap RetryText { get { return GetValue(RetryTextProperty) as PropertyMap; } set { SetValue(RetryTextProperty, value); NotifyPropertyChanged(); } } private PropertyMap InternalRetryText { get { PropertyMap retValue = new PropertyMap(); PropertyValue retryText = GetProperty(WidgetView.Property.RetryText); retryText?.Get(retValue); retryText?.Dispose(); return retValue; } set { PropertyValue setValue = new Tizen.NUI.PropertyValue(value); SetProperty(WidgetView.Property.RetryText, setValue); setValue?.Dispose(); } } /// /// Gets or sets effect. /// /// 4 public PropertyMap Effect { get { return GetValue(EffectProperty) as PropertyMap; } set { SetValue(EffectProperty, value); NotifyPropertyChanged(); } } private PropertyMap InternalEffect { get { PropertyMap retValue = new PropertyMap(); PropertyValue effect = GetProperty(WidgetView.Property.EFFECT); effect?.Get(retValue); effect?.Dispose(); return retValue; } set { PropertyValue setValue = new Tizen.NUI.PropertyValue(value); SetProperty(WidgetView.Property.EFFECT, setValue); setValue?.Dispose(); } } /// /// Pauses a given widget. /// /// True on success, false otherwise. /// 3 public bool PauseWidget() { bool ret = Interop.WidgetView.PauseWidget(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Resumes a given widget. /// /// True on success, false otherwise. /// 3 public bool ResumeWidget() { bool ret = Interop.WidgetView.ResumeWidget(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Cancels the 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. /// 3 public bool CancelTouchEvent() { bool ret = Interop.WidgetView.CancelTouchEvent(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Activates a widget in the faulted state. /// A widget in faulted state must be activated before adding the widget. /// /// 3 public void ActivateFaultedWidget() { Interop.WidgetView.ActivateFaultedWidget(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Terminate a widget instance. /// /// True on success, false otherwise /// 4 public bool TerminateWidget() { bool ret = Interop.WidgetView.TerminateWidget(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static WidgetView DownCast(BaseHandle handle) { WidgetView ret = new WidgetView(Interop.WidgetView.DownCast(BaseHandle.getCPtr(handle)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static WidgetView GetWidgetViewFromPtr(global::System.IntPtr cPtr) { if (cPtr == global::System.IntPtr.Zero) { return null; } WidgetView ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as WidgetView; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetView Assign(WidgetView handle) { WidgetView ret = new WidgetView(Interop.WidgetView.Assign(SwigCPtr, WidgetView.getCPtr(handle)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetViewSignal WidgetAddedSignal() { WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetAddedSignal(SwigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetViewSignal WidgetDeletedSignal() { WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetDeletedSignal(SwigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetViewSignal WidgetCreationAbortedSignal() { WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetCreationAbortedSignal(SwigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetViewSignal WidgetContentUpdatedSignal() { WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetContentUpdatedSignal(SwigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetViewSignal WidgetUpdatePeriodChangedSignal() { WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetUpdatePeriodChangedSignal(SwigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WidgetViewSignal WidgetFaultedSignal() { WidgetViewSignal ret = new WidgetViewSignal(Interop.WidgetView.WidgetFaultedSignal(SwigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// To make the Button instance be disposed. /// /// 3 protected override void Dispose(DisposeTypes type) { if (disposed) { return; } //Remove Widget from WidgetViewManager WidgetViewManager.Instance.RemoveWidget(this); //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 (widgetAddedEventCallback != null) { WidgetViewSignal widgetAdded = this.WidgetAddedSignal(); widgetAdded?.Disconnect(widgetAddedEventCallback); widgetAdded?.Dispose(); } if (widgetContentUpdatedEventCallback != null) { WidgetViewSignal widgetContentUpdated = this.WidgetContentUpdatedSignal(); widgetContentUpdated?.Disconnect(widgetContentUpdatedEventCallback); widgetContentUpdated?.Dispose(); } if (widgetCreationAbortedEventCallback != null) { WidgetViewSignal widgetCreationAborted = this.WidgetCreationAbortedSignal(); widgetCreationAborted?.Disconnect(widgetCreationAbortedEventCallback); widgetCreationAborted?.Dispose(); } if (widgetDeletedEventCallback != null) { WidgetViewSignal widgetDeleted = this.WidgetDeletedSignal(); widgetDeleted?.Disconnect(widgetDeletedEventCallback); widgetDeleted?.Dispose(); } if (widgetFaultedEventCallback != null) { WidgetViewSignal widgetFaulted = this.WidgetFaultedSignal(); widgetFaulted?.Disconnect(widgetFaultedEventCallback); widgetFaulted?.Dispose(); } if (widgetUpdatePeriodChangedEventCallback != null) { WidgetViewSignal widgetUpdatePeriodChanged = this.WidgetUpdatePeriodChangedSignal(); widgetUpdatePeriodChanged?.Disconnect(widgetUpdatePeriodChangedEventCallback); widgetUpdatePeriodChanged?.Dispose(); } base.Dispose(type); } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.WidgetView.DeleteWidgetView(swigCPtr); } /// [EditorBrowsable(EditorBrowsableState.Never)] protected override bool HandleControlStateOnTouch(Touch touch) { base.HandleControlStateOnTouch(touch); return true; // Do not pass the touch event to the below. } internal override void ApplyCornerRadius() { base.ApplyCornerRadius(); if (backgroundExtraData == null) { return; } // Update corner radius properties to widgetView by ActionUpdateProperty if (backgroundExtraData.CornerRadius != null) { Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, WidgetView.Property.WidgetId, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius)); } Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, WidgetView.Property.WidgetId, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy); } // 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); } } // 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); } } // 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); } } // 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); } } // 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); } } // 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); } } /// /// Event arguments of the widget view. /// /// 3 public class WidgetViewEventArgs : EventArgs { private WidgetView _widgetView; /// /// The widget view. /// /// 3 public WidgetView WidgetView { get { return _widgetView; } set { _widgetView = value; } } } internal new class Property { internal static readonly int WidgetId = Interop.WidgetView.WidgetIdGet(); internal static readonly int InstanceId = Interop.WidgetView.InstanceIdGet(); internal static readonly int ContentInfo = Interop.WidgetView.ContentInfoGet(); internal static readonly int TITLE = Interop.WidgetView.TitleGet(); internal static readonly int UpdatePeriod = Interop.WidgetView.UpdatePeriodGet(); internal static readonly int PREVIEW = Interop.WidgetView.PreviewGet(); internal static readonly int LoadingText = Interop.WidgetView.LoadingTextGet(); internal static readonly int WidgetStateFaulted = Interop.WidgetView.WidgetStateFaultedGet(); internal static readonly int PermanentDelete = Interop.WidgetView.PermanentDeleteGet(); internal static readonly int RetryText = Interop.WidgetView.RetryTextGet(); internal static readonly int EFFECT = Interop.WidgetView.EffectGet(); [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use WidgetId instead.")] internal static readonly int WIDGET_ID = Interop.WidgetView.WidgetIdGet(); [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use ContentInfo instead.")] internal static readonly int CONTENT_INFO = Interop.WidgetView.ContentInfoGet(); [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use UpdatePeriod instead.")] internal static readonly int UPDATE_PERIOD = Interop.WidgetView.UpdatePeriodGet(); [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use LoadingText instead.")] internal static readonly int LOADING_TEXT = Interop.WidgetView.LoadingTextGet(); } } }