From: sunghyun kim Date: Thu, 26 Oct 2023 02:30:58 +0000 (+0900) Subject: [NUI] Add KeepWidgetSize for control widget's size X-Git-Tag: accepted/tizen/unified/20231205.024657~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d04ac5dbe5724bf7955d9fc4fdc13a924ef4928;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add KeepWidgetSize for control widget's size WidgetView keep widget instance's size and don't resize even if WidgetView is resized. --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WidgetView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WidgetView.cs index 367177e..834df9d 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.WidgetView.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WidgetView.cs @@ -55,6 +55,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WidgetView_Property_EFFECT_get")] public static extern int EffectGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WidgetView_Property_KEEP_WIDGET_SIZE_get")] + public static extern int KeepWidgetSizeGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WidgetView_Property")] public static extern global::System.IntPtr NewWidgetViewProperty(); diff --git a/src/Tizen.NUI/src/public/Widget/WidgetView.cs b/src/Tizen.NUI/src/public/Widget/WidgetView.cs index 1dceadf..0732e87 100755 --- a/src/Tizen.NUI/src/public/Widget/WidgetView.cs +++ b/src/Tizen.NUI/src/public/Widget/WidgetView.cs @@ -138,6 +138,25 @@ namespace Tizen.NUI return instance.InternalEffect; }); + /// + /// UpdateWidgetSizeProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty KeepWidgetSizeProperty = BindableProperty.Create(nameof(KeepWidgetSize), typeof(bool), typeof(Tizen.NUI.WidgetView), false, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.WidgetView)bindable; + if (newValue != null) + { + instance.InternalKeepWidgetSize = (bool)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.WidgetView)bindable; + return instance.InternalKeepWidgetSize; + }); + + private EventHandler widgetAddedEventHandler; private WidgetAddedEventCallbackType widgetAddedEventCallback; private EventHandler widgetContentUpdatedEventHandler; @@ -686,6 +705,42 @@ namespace Tizen.NUI } /// + /// Gets or sets KeepWidgetSize + /// + /// if this value is true, WidgetView keep widget instance's size and don't resize even if WidgetView is resized. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool KeepWidgetSize + { + get + { + return (bool)GetValue(KeepWidgetSizeProperty); + } + set + { + SetValue(KeepWidgetSizeProperty, value); + NotifyPropertyChanged(); + } + } + private bool InternalKeepWidgetSize + { + get + { + bool retValue = false; + PropertyValue keepWidgetSize = GetProperty(WidgetView.Property.KeepWidgetSize); + keepWidgetSize?.Get(out retValue); + keepWidgetSize?.Dispose(); + return retValue; + } + set + { + PropertyValue setValue = new Tizen.NUI.PropertyValue(value); + SetProperty(WidgetView.Property.KeepWidgetSize, setValue); + setValue.Dispose(); + } + } + + /// /// Pauses a given widget. /// /// True on success, false otherwise. @@ -1022,6 +1077,7 @@ namespace Tizen.NUI internal static readonly int RetryText = Interop.WidgetView.RetryTextGet(); internal static readonly int EFFECT = Interop.WidgetView.EffectGet(); + internal static readonly int KeepWidgetSize = Interop.WidgetView.KeepWidgetSizeGet(); [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();