if (instance.isEnabled != newEnabled)
{
instance.isEnabled = newEnabled;
+ // FIXME : InsEnabled Property should not change other property value.
instance.Sensitive = newEnabled;
+ ((Control)instance).IsEnabled = newEnabled;
instance.UpdateState();
}
}
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
public static extern bool IsFocusableInTouch(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_SetEnabled")]
+ public static extern void SetEanbled(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_IsEnabled")]
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+ public static extern bool IsEnabled(global::System.Runtime.InteropServices.HandleRef jarg1);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_SetSizeScalePolicy")]
public static extern void SetSizeScalePolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_Property_SENSITIVE_get")]
public static extern int SensitiveGet();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_Property_ENABLED_get")]
+ public static extern int EnabledGet();
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_Property_LEAVE_REQUIRED_get")]
public static extern int LeaveRequiredGet();
}
/// <summary>
+ /// Gets or sets the status of whether the view should be enabled user interactions.
+ /// If a View is made disabled, then user interactions including touch, focus, and actiavation is disabled.
+ /// </summary>
+ /// <since_tizen> tizen_next </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEnabled
+ {
+ get
+ {
+ return (bool)GetValue(IsEnabledProperty);
+ }
+ set
+ {
+ SetValue(IsEnabledProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
/// Gets or sets the status of whether the view should receive a notification when touch or hover motion events leave the boundary of the view.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}));
/// <summary>
+ /// IsEnabledProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(Sensitive), typeof(bool), typeof(View), false, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ if (newValue != null)
+ {
+ newValue = view.OnEnabled((bool)newValue);
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.Enabled, new Tizen.NUI.PropertyValue((bool)newValue));
+ }
+ }),
+ defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
+ {
+ var view = (View)bindable;
+ bool temp = true;
+ Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.Enabled).Get(out temp);
+ return temp;
+ }));
+
+ /// <summary>
/// DispatchKeyEventsProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static readonly int WorldMatrix = Interop.ActorProperty.WorldMatrixGet();
internal static readonly int NAME = Interop.ActorProperty.NameGet();
internal static readonly int SENSITIVE = Interop.ActorProperty.SensitiveGet();
+ internal static readonly int Enabled = Interop.ActorProperty.EnabledGet();
internal static readonly int LeaveRequired = Interop.ActorProperty.LeaveRequiredGet();
internal static readonly int InheritOrientation = Interop.ActorProperty.InheritOrientationGet();
internal static readonly int InheritScale = Interop.ActorProperty.InheritScaleGet();
return false;
}
+ /// <summary>
+ /// Internal callback of enabled property changes.
+ /// Inherited view can override this method to implements enabled property changes.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual bool OnEnabled(bool enabled)
+ {
+ if (enableControlState)
+ {
+ if (enabled)
+ {
+ ControlState -= ControlState.Disabled;
+ }
+ else
+ {
+ ControlState += ControlState.Disabled;
+ }
+ }
+ return enabled;
+ }
+
+
+
private void DisConnectFromSignals()
{
if (HasBody() == false)
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/BaseComponents/View")]
+ public class ViewTest
+ {
+ private const string tag = "NUITEST";
+ private const int testSize = 100;
+ private const int testPosition = 100;
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Get default value test for View.IsEnabled")]
+ [Property("SPEC", "Tizen.NUI.BaseComponents.View.IsEnabled")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "sh10233.lee@samsung.com")]
+ public void IsEnabled_CHECK_DEFAULT_VALUE()
+ {
+ /* TEST CODE */
+ View testView = new View();
+ var isEnabled = testView.IsEnabled;
+
+ Assert.AreEqual(true, isEnabled, "View IsEnabled should be true by default");
+
+ testView.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Set value test for View.IsEnabled")]
+ [Property("SPEC", "Tizen.NUI.BaseComponents.View.IsEnabled")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "sh10233.lee@samsung.com")]
+ public void IsEnabled_SET_VALUE()
+ {
+ /* TEST CODE */
+ View testView = new View();
+ var isEnabled = testView.IsEnabled;
+
+ Assert.AreEqual(true, isEnabled, "View IsEnabled should be true by default");
+
+ testView.IsEnabled = false;
+
+ Assert.AreEqual(false, isEnabled, "View IsEnabled should be changed by set value");
+
+ testView.Dispose();
+ }
+
+ }
+}
Text = "Disabled",
IsEnabled = false,
};
+ disabledButton.EnableFocus();
disabledButton.Clicked += (object obj, ClickedEventArgs ev) =>
{
// This event should not be recieved. button is disabled.
Log.Info(this.GetType().Name, "Selected Button Clicked\n");
if (obj is Button button)
{
+ disabledButton.IsEnabled = button.IsSelected;
if (button.IsSelected)
{
button.Text = "Selected";