From 38b4f827e9d20853d7401c7cba2af4fa99ddc5d7 Mon Sep 17 00:00:00 2001 From: AdunFang <30402408+AdunFang@users.noreply.github.com> Date: Tue, 3 Dec 2019 16:19:41 +0800 Subject: [PATCH] [NUI] Refactor NUI Components (#1159) --- src/Tizen.NUI.Components/Attributes/Attributes.cs | 36 - .../Attributes/ButtonAttributes.cs | 256 ++- .../Attributes/ControlStyle.cs | 135 ++ .../Attributes/DropDownAttributes.cs | 466 ++++-- .../{ImageAttributes.cs => ImageControlStyle.cs} | 78 +- .../Attributes/InputFieldAttributes.cs | 47 +- .../Attributes/LoadingAttributes.cs | 76 +- .../Attributes/PaginationAttributes.cs | 88 +- .../Attributes/PopupAttributes.cs | 149 +- .../Attributes/ProgressAttributes.cs | 118 +- .../Attributes/ScrollbarAttributes.cs | 101 +- .../Attributes/SelectButtonAttributes.cs | 78 +- .../Attributes/SliderAttributes.cs | 337 +++- .../Attributes/SwitchAttributes.cs | 95 +- .../Attributes/TabAttributes.cs | 86 +- .../Attributes/TextAttributes.cs | 355 ---- .../Attributes/TextFieldAttributes.cs | 319 ---- .../Attributes/ToastAttributes.cs | 95 +- .../Attributes/ViewAttributes.cs | 268 --- src/Tizen.NUI.Components/Controls/Button.cs | 784 +++------ src/Tizen.NUI.Components/Controls/CheckBox.cs | 2 +- src/Tizen.NUI.Components/Controls/Control.cs | 370 ++--- src/Tizen.NUI.Components/Controls/DropDown.cs | 988 +++++------ .../Controls/FlexibleView/FlexibleView.cs | 243 ++- .../Controls/FlexibleView/GridLayoutManager.cs | 4 +- .../Controls/FlexibleView/LinearLayoutManager.cs | 139 +- src/Tizen.NUI.Components/Controls/ImageControl.cs | 127 ++ src/Tizen.NUI.Components/Controls/InputField.cs | 89 +- src/Tizen.NUI.Components/Controls/Loading.cs | 162 +- src/Tizen.NUI.Components/Controls/Pagination.cs | 150 +- src/Tizen.NUI.Components/Controls/Popup.cs | 948 +++++------ src/Tizen.NUI.Components/Controls/Progress.cs | 345 ++-- src/Tizen.NUI.Components/Controls/RadioButton.cs | 2 +- src/Tizen.NUI.Components/Controls/Scrollbar.cs | 313 ++-- src/Tizen.NUI.Components/Controls/SelectButton.cs | 665 +------- src/Tizen.NUI.Components/Controls/Slider.cs | 651 ++++---- src/Tizen.NUI.Components/Controls/Switch.cs | 213 +-- src/Tizen.NUI.Components/Controls/Tab.cs | 310 ++-- src/Tizen.NUI.Components/Controls/Toast.cs | 392 ++--- src/Tizen.NUI.Components/Utils/Selector.cs | 175 +- src/Tizen.NUI.Components/Utils/StyleBase.cs | 5 +- src/Tizen.NUI.Components/Utils/StyleManager.cs | 40 +- src/Tizen.NUI/src/internal/ViewWrapperImpl.cs | 19 +- .../src/public/BaseComponents/CustomView.cs | 114 +- .../src/public/BaseComponents/ImageView.cs | 87 +- .../src/public/BaseComponents/Style/BundledPipe.cs | 141 ++ .../src/public/BaseComponents/Style}/Constants.cs | 0 .../BaseComponents/Style/ImageViewAttributes.cs | 232 +++ .../src/public/BaseComponents/Style/Selector.cs | 242 +++ .../BaseComponents/Style/TextFieldAttributes.cs | 1124 +++++++++++++ .../BaseComponents/Style/TextLabelAttributes.cs | 698 ++++++++ .../public/BaseComponents/Style/ViewAttributes.cs | 1727 ++++++++++++++++++++ .../src/public/BaseComponents/TextField.cs | 231 +++ .../BaseComponents/TextFieldBindableProperty.cs | 36 +- .../src/public/BaseComponents/TextLabel.cs | 175 ++ src/Tizen.NUI/src/public/BaseComponents/View.cs | 176 ++ .../src/public/BaseComponents/ViewInternal.cs | 10 +- .../src/public/BaseComponents/VisualView.cs | 7 + src/Tizen.NUI/src/public/Extents.cs | 37 +- src/Tizen.NUI/src/public/ViewWrapper.cs | 8 +- .../src/public/XamlBinding/BindableObject.cs | 105 ++ .../src/public/XamlBinding/BindableProperty.cs | 59 + 62 files changed, 9634 insertions(+), 5894 deletions(-) delete mode 100755 src/Tizen.NUI.Components/Attributes/Attributes.cs create mode 100755 src/Tizen.NUI.Components/Attributes/ControlStyle.cs rename src/Tizen.NUI.Components/Attributes/{ImageAttributes.cs => ImageControlStyle.cs} (52%) delete mode 100755 src/Tizen.NUI.Components/Attributes/TextAttributes.cs delete mode 100755 src/Tizen.NUI.Components/Attributes/TextFieldAttributes.cs delete mode 100755 src/Tizen.NUI.Components/Attributes/ViewAttributes.cs create mode 100755 src/Tizen.NUI.Components/Controls/ImageControl.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Style/BundledPipe.cs rename src/{Tizen.NUI.Components/Utils => Tizen.NUI/src/public/BaseComponents/Style}/Constants.cs (100%) create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Style/ImageViewAttributes.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Style/Selector.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Style/TextFieldAttributes.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelAttributes.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Style/ViewAttributes.cs diff --git a/src/Tizen.NUI.Components/Attributes/Attributes.cs b/src/Tizen.NUI.Components/Attributes/Attributes.cs deleted file mode 100755 index f5a7ce0..0000000 --- a/src/Tizen.NUI.Components/Attributes/Attributes.cs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright(c) 2019 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.Components -{ - /// - /// Base attributes. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public abstract class Attributes - { - /// - /// Clone the Attributes, each derived class need to override this method. - /// - /// Return the attributes clone. - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public abstract Attributes Clone(); - } -} diff --git a/src/Tizen.NUI.Components/Attributes/ButtonAttributes.cs b/src/Tizen.NUI.Components/Attributes/ButtonAttributes.cs index 3e07971..04f2597 100755 --- a/src/Tizen.NUI.Components/Attributes/ButtonAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/ButtonAttributes.cs @@ -14,7 +14,10 @@ * limitations under the License. * */ +using System.Collections.Generic; using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { @@ -24,123 +27,178 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class ButtonAttributes : ViewAttributes + public class ButtonStyle : ControlStyle { + private bool? isSelectable; + private bool? isSelected; + private bool? isEnabled; + private Button.IconOrientation? iconRelativeOrientation; + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create("IsSelectable", typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var buttonStyle = (ButtonStyle)bindable; + buttonStyle.isSelectable = (bool?)newValue; + }, + defaultValueCreator: (bindable) => + { + var buttonStyle = (ButtonStyle)bindable; + return buttonStyle.isSelectable; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create("IsSelected", typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var buttonStyle = (ButtonStyle)bindable; + buttonStyle.isSelected = (bool?)newValue; + }, + defaultValueCreator: (bindable) => + { + var buttonStyle = (ButtonStyle)bindable; + return buttonStyle.isSelected; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var buttonStyle = (ButtonStyle)bindable; + buttonStyle.isEnabled = (bool?)newValue; + }, + defaultValueCreator: (bindable) => + { + var buttonStyle = (ButtonStyle)bindable; + return buttonStyle.isEnabled; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create("IconRelativeOrientation", typeof(Button.IconOrientation?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var buttonStyle = (ButtonStyle)bindable; + buttonStyle.iconRelativeOrientation = (Button.IconOrientation?)newValue; + }, + defaultValueCreator: (bindable) => + { + var buttonStyle = (ButtonStyle)bindable; + return buttonStyle.iconRelativeOrientation; + }); + /// - /// Creates a new instance of a ButtonAttributes. + /// Creates a new instance of a ButtonStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ButtonAttributes() : base() { } + public ButtonStyle() : base() + { + InitSubAttributes(); + } /// - /// Creates a new instance of a ButtonAttributes with attributes. + /// Creates a new instance of a ButtonStyle with style. /// - /// Create ButtonAttributes by attributes customized by user. + /// Create ButtonStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ButtonAttributes(ButtonAttributes attributes) : base(attributes) + public ButtonStyle(ButtonStyle style) : base(style) { - if(attributes == null) + if(style == null) { return; } - IsSelectable = attributes.IsSelectable; - IconRelativeOrientation = attributes.IconRelativeOrientation; + IsSelectable = style.IsSelectable; + IconRelativeOrientation = style.IconRelativeOrientation; - if (attributes.ShadowImageAttributes != null) - { - ShadowImageAttributes = attributes.ShadowImageAttributes.Clone() as ImageAttributes; - } + InitSubAttributes(); - if (attributes.BackgroundImageAttributes != null) - { - BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes; - } - - if (attributes.OverlayImageAttributes != null) - { - OverlayImageAttributes = attributes.OverlayImageAttributes.Clone() as ImageAttributes; - } - - if (attributes.TextAttributes != null) - { - TextAttributes = attributes.TextAttributes.Clone() as TextAttributes; - } - - if (attributes.IconAttributes != null) - { - IconAttributes = attributes.IconAttributes.Clone() as ImageAttributes; - } + Overlay.CopyFrom(style.Overlay); + Text.CopyFrom(style.Text); + Icon.CopyFrom(style.Icon); } /// - /// Shadow image's attributes. + /// Overlay image's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ShadowImageAttributes + public ImageViewStyle Overlay { get; set; } /// - /// Background image's attributes. + /// Text's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes BackgroundImageAttributes + public TextLabelStyle Text { get; set; } /// - /// Overlay image's attributes. + /// Icon's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes OverlayImageAttributes + public ImageViewStyle Icon { get; set; } - /// - /// Text's attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes TextAttributes + public bool? IsSelectable { - get; - set; + get + { + bool? temp = (bool?)GetValue(IsSelectableProperty); + return temp; + } + set + { + SetValue(IsSelectableProperty, value); + } } - /// - /// Icon's attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes IconAttributes + public bool? IsSelected { - get; - set; + get + { + bool? temp = (bool?)GetValue(IsSelectedProperty); + return temp; + } + set + { + SetValue(IsSelectedProperty, value); + } } + /// /// Flag to decide button can be selected or not. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public bool? IsSelectable + public bool? IsEnabled { - get; - set; + get + { + bool? temp = (bool?)GetValue(IsEnabledProperty); + return temp; + } + set + { + SetValue(IsEnabledProperty, value); + } } + /// /// Icon relative orientation. /// @@ -149,18 +207,82 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public Button.IconOrientation? IconRelativeOrientation { - get; - set; + get + { + Button.IconOrientation? temp = (Button.IconOrientation?)GetValue(IconRelativeOrientationProperty); + return temp; + } + set + { + SetValue(IconRelativeOrientationProperty, value); + } } - /// - /// Attributes's clone function. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) + { + base.CopyFrom(bindableObject); + + ButtonStyle buttonAttributes = bindableObject as ButtonStyle; + + if (null != buttonAttributes) + { + if (null != buttonAttributes.Overlay) + { + Overlay.CopyFrom(buttonAttributes.Overlay); + } + + if (null != buttonAttributes.Text) + { + Text.CopyFrom(buttonAttributes.Text); + } + + if (null != buttonAttributes.Icon) + { + Icon.CopyFrom(buttonAttributes.Icon); + } + } + } + + private void InitSubAttributes() + { + Overlay = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent + }; + Overlay.PropertyChanged += SubStyleCalledEvent; + + Text = new TextLabelStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }; + Text.PropertyChanged += SubStyleCalledEvent; + + Icon = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.UseNaturalSize, + HeightResizePolicy = ResizePolicyType.UseNaturalSize, + }; + Icon.PropertyChanged += SubStyleCalledEvent; + } + + private void SubStyleCalledEvent(object sender, global::System.EventArgs e) { - return new ButtonAttributes(this); + OnPropertyChanged(); } } } diff --git a/src/Tizen.NUI.Components/Attributes/ControlStyle.cs b/src/Tizen.NUI.Components/Attributes/ControlStyle.cs new file mode 100755 index 0000000..329dd06 --- /dev/null +++ b/src/Tizen.NUI.Components/Attributes/ControlStyle.cs @@ -0,0 +1,135 @@ +/* + * Copyright(c) 2019 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.Collections.Generic; +using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; + +namespace Tizen.NUI.Components +{ + /// + /// ButtonAttributes is a class which saves Button's ux data. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class ControlStyle : ViewStyle + { + /// + /// Creates a new instance of a ButtonStyle. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ControlStyle() : base() + { + InitSubAttributes(); + } + /// + /// Creates a new instance of a ButtonStyle with style. + /// + /// Create ButtonStyle by style customized by user. + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ControlStyle(ControlStyle style) : base(style) + { + if(style == null) + { + return; + } + + InitSubAttributes(); + + Shadow.CopyFrom(style.Shadow); + Background.CopyFrom(style.Background); + } + + /// + /// Shadow image's Style. + /// + /// 6 + /// This will be public opened in tizen__6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageViewStyle Shadow + { + get; + set; + } + /// + /// Background image's Style. + /// + /// 6 + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageViewStyle Background + { + get; + set; + } + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override void CopyFrom(BindableObject bindableObject) + { + base.CopyFrom(bindableObject); + + ControlStyle controlStyle = bindableObject as ControlStyle; + + if (null != controlStyle) + { + if (null != controlStyle.Shadow) + { + Shadow.CopyFrom(controlStyle.Shadow); + } + + if (null != controlStyle.Background) + { + Background.CopyFrom(controlStyle.Background); + } + } + } + + private void InitSubAttributes() + { + Shadow = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent + }; + Shadow.PropertyChanged += SubStyleCalledEvent; + + Background = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent + }; + Background.PropertyChanged += SubStyleCalledEvent; + } + + private void SubStyleCalledEvent(object sender, global::System.EventArgs e) + { + OnPropertyChanged(); + } + } +} diff --git a/src/Tizen.NUI.Components/Attributes/DropDownAttributes.cs b/src/Tizen.NUI.Components/Attributes/DropDownAttributes.cs index b9b9002..0c7522e 100755 --- a/src/Tizen.NUI.Components/Attributes/DropDownAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/DropDownAttributes.cs @@ -15,303 +15,544 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; +using static Tizen.NUI.Components.DropDown; namespace Tizen.NUI.Components { /// - /// DropDownAttributes is a class which saves DropDown's ux data. + /// DropDownStyle is a class which saves DropDown's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class DropDownAttributes : ViewAttributes + public class DropDownStyle : ControlStyle { - /// - /// Creates a new instance of a DropDownAttributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownAttributes() : base() - { - SpaceBetweenButtonTextAndIcon = 0; - Space = new Vector4(0, 0, 0, 0); - ListRelativeOrientation = DropDown.ListOrientation.Left; - ListMargin = new Vector4(0, 0, 0, 0); - FocusedItemIndex = 0; - } - /// - /// Creates a new instance of a DropDownAttributes with attributes. - /// - /// Create DropDownAttributes by attributes customized by user. - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownAttributes(DropDownAttributes attributes) : base(attributes) + private int spaceBetweenButtonTextAndIcon = 0; + + private Extents _space; + private Extents space { - if(attributes == null) + get { - return; - } + if (null == _space) + { + _space = new Extents((ushort start, ushort end, ushort top, ushort bottom) => + { + Extents extents = new Extents(start, end, top, bottom); + _space.CopyFrom(extents); + }, 0, 0, 0, 0); + } - if (attributes.ButtonAttributes != null) - { - ButtonAttributes = attributes.ButtonAttributes.Clone() as ButtonAttributes; + return _space; } + } - if (attributes.HeaderTextAttributes != null) - { - HeaderTextAttributes = attributes.HeaderTextAttributes.Clone() as TextAttributes; - } + private ListOrientation? listRelativeOrientation = ListOrientation.Left; - if (attributes.ListBackgroundImageAttributes != null) + private bool isListMarginSetted = false; + private Extents _listMargin; + private Extents listMargin + { + get { - ListBackgroundImageAttributes = attributes.ListBackgroundImageAttributes.Clone() as ImageAttributes; - } + if (null == _listMargin) + { + _listMargin = new Extents((ushort start, ushort end, ushort top, ushort bottom) => + { + Extents extents = new Extents(start, end, top, bottom); + _listMargin.CopyFrom(extents); + }, 0, 0, 0, 0); + } - if (attributes.Space != null) - { - Space = new Vector4(attributes.Space.X, attributes.Space.Y, attributes.Space.Z, attributes.Space.W); + return _listMargin; } + } - if (attributes.ListMargin != null) - { - ListMargin = new Vector4(attributes.ListMargin.X, attributes.ListMargin.Y, attributes.ListMargin.Z, attributes.ListMargin.W); - } + private int focusedItemIndex = 0; + private int selectedItemIndex = 0; + private Size listSize; - if (attributes.ListSize != null) + private Extents _listPadding; + private Extents listPadding + { + get { - ListSize = new Size(attributes.ListSize.Width, attributes.ListSize.Height); - } + if (null == _listPadding) + { + _listPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom) => + { + Extents extents = new Extents(start, end, top, bottom); + _listPadding.CopyFrom(extents); + }, 0, 0, 0, 0); + } - if (attributes.ListPadding != null) - { - ListPadding = attributes.ListPadding; + return _listPadding; } - - SpaceBetweenButtonTextAndIcon = attributes.SpaceBetweenButtonTextAndIcon; - ListRelativeOrientation = attributes.ListRelativeOrientation; - FocusedItemIndex = attributes.FocusedItemIndex; } + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SpaceBetweenButtonTextAndIconProperty = BindableProperty.Create("SpaceBetweenButtonTextAndIcon", typeof(int), typeof(DropDownStyle), 0, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.spaceBetweenButtonTextAndIcon = (int)newValue; + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.spaceBetweenButtonTextAndIcon; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SpaceProperty = BindableProperty.Create("Space", typeof(Extents), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.space.CopyFrom((Extents)newValue); + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.space; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListRelativeOrientationProperty = BindableProperty.Create("ListRelativeOrientation", typeof(ListOrientation?), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.listRelativeOrientation = (ListOrientation?)newValue; + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.listRelativeOrientation; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListMarginProperty = BindableProperty.Create("ListMargin", typeof(Extents), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.listMargin.CopyFrom((Extents)newValue); + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.listMargin; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty FocusedItemIndexProperty = BindableProperty.Create("FocusedItemIndex", typeof(int), typeof(DropDownStyle), 0, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.focusedItemIndex = (int)newValue; + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.focusedItemIndex; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create("SelectedItemIndex", typeof(int), typeof(DropDownStyle), 0, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.selectedItemIndex = (int)newValue; + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.selectedItemIndex; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListSizeProperty = BindableProperty.Create("ListSize", typeof(Size), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.listSize = (Size)newValue; + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.listSize; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListPaddingProperty = BindableProperty.Create("ListPadding", typeof(Extents), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var dropDownStyle = (DropDownStyle)bindable; + dropDownStyle.listPadding.CopyFrom((Extents)newValue); + }, + defaultValueCreator: (bindable) => + { + var dropDownStyle = (DropDownStyle)bindable; + return dropDownStyle.listPadding; + }); + /// - /// DropDown button's attributes. + /// Creates a new instance of a DropDownStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ButtonAttributes ButtonAttributes + public DropDownStyle() : base() { - get; - set; + Button = new ButtonStyle(); + HeaderText = new TextLabelStyle(); + ListBackgroundImage = new ImageViewStyle(); + } + /// + /// Creates a new instance of a DropDownStyle with style. + /// + /// Create DropDownStyle by style customized by user. + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public DropDownStyle(DropDownStyle style) : base(style) + { + if(style == null) + { + return; + } + + Button = new ButtonStyle(); + HeaderText = new TextLabelStyle(); + ListBackgroundImage = new ImageViewStyle(); + + CopyFrom(style); } /// - /// Header text's attributes. + /// DropDown button's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes HeaderTextAttributes + public ButtonStyle Button { get; set; } /// - /// Space between button text and button icon. + /// Header text's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public int SpaceBetweenButtonTextAndIcon + public TextLabelStyle HeaderText { get; set; } /// - /// List background image's attributes. + /// List background image's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ListBackgroundImageAttributes + public ImageViewStyle ListBackgroundImage { get; set; } /// - /// Space in DropDown. + /// Space between button text and button icon. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Vector4 Space + public int SpaceBetweenButtonTextAndIcon { - get; - set; + get + { + int temp = (int)GetValue(SpaceBetweenButtonTextAndIconProperty); + return temp; + } + set + { + SetValue(SpaceBetweenButtonTextAndIconProperty, value); + } + } + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Extents Space + { + get + { + Extents temp = (Extents)GetValue(SpaceProperty); + return temp; + } + set + { + SetValue(SpaceProperty, value); + } } /// /// List relative orientation. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDown.ListOrientation ListRelativeOrientation + public ListOrientation? ListRelativeOrientation { - get; - set; + get + { + ListOrientation? temp = (ListOrientation?)GetValue(ListRelativeOrientationProperty); + return temp; + } + set + { + SetValue(ListRelativeOrientationProperty, value); + } } /// /// List margin. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Vector4 ListMargin + public Extents ListMargin { - get; - set; + get + { + Extents temp = (Extents)GetValue(ListMarginProperty); + return temp; + } + set + { + SetValue(ListMarginProperty, value); + } } /// /// Focused item index. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public int FocusedItemIndex { + get + { + int temp = (int)GetValue(FocusedItemIndexProperty); + return temp; + } + set + { + SetValue(FocusedItemIndexProperty, value); + } + } + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public int SelectedItemIndex + { + get + { + int temp = (int)GetValue(SelectedItemIndexProperty); + return temp; + } + set + { + SetValue(SelectedItemIndexProperty, value); + } + } + + /// + /// List size. + /// + /// 6 + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Size ListSize + { + get + { + Size temp = (Size)GetValue(ListSizeProperty); + return temp; + } + set + { + SetValue(ListSizeProperty, value); + } + } + + /// + /// List padding. + /// + /// 6 + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Extents ListPadding + { + get + { + Extents temp = (Extents)GetValue(ListPaddingProperty); + return temp; + } + set + { + SetValue(ListPaddingProperty, value); + } + } + + /// + /// Icon's Style. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageViewStyle Icon + { get; set; } /// - /// List size. + /// Check image's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Size ListSize + public ImageViewStyle CheckImage { get; set; } /// - /// List padding. + /// Gap of Check image to boundary. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Extents ListPadding + public int CheckImageGapToBoundary { get; set; } /// - /// Attributes's clone function. + /// Flag to decide item is selected or not. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public bool IsSelected { - return new DropDownAttributes(this); + get; + set; + } + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override void CopyFrom(BindableObject bindableObject) + { + base.CopyFrom(bindableObject); + + DropDownStyle dropDownStyle = bindableObject as DropDownStyle; + + if (null != dropDownStyle) + { + Button.CopyFrom(dropDownStyle.Button); + HeaderText.CopyFrom(dropDownStyle.HeaderText); + ListBackgroundImage.CopyFrom(dropDownStyle.ListBackgroundImage); + } } } /// - /// DropDownItemAttributes is a class which saves DropDownItem's ux data. + /// DropDownItemStyle is a class which saves DropDownItem's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class DropDownItemAttributes : ViewAttributes + public class DropDownItemStyle : ControlStyle { /// - /// Creates a new instance of a DropDownItemAttributes. + /// Creates a new instance of a DropDownItemStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownItemAttributes() : base() { } + public DropDownItemStyle() : base() { } /// - /// Creates a new instance of a DropDownItemAttributes with attributes. + /// Creates a new instance of a DropDownItemStyle with style. /// - /// Create DropDownItemAttributes by attributes customized by user. + /// Create DropDownItemStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownItemAttributes(DropDownItemAttributes attributes) : base(attributes) + public DropDownItemStyle(DropDownItemStyle style) : base(style) { - if (attributes.TextAttributes != null) + if (style.Text!= null) { - TextAttributes = attributes.TextAttributes.Clone() as TextAttributes; + Text.CopyFrom(style.Text); } - if (attributes.IconAttributes != null) + if (style.Icon!= null) { - IconAttributes = attributes.IconAttributes.Clone() as ImageAttributes; + Icon.CopyFrom(style.Icon); } - if (attributes.CheckImageAttributes != null) + if (style.CheckImage!= null) { - CheckImageAttributes = attributes.CheckImageAttributes.Clone() as ImageAttributes; + CheckImage.CopyFrom(style.CheckImage); } - CheckImageRightSpace = attributes.CheckImageRightSpace; - IsSelected = attributes.IsSelected; + CheckImageGapToBoundary = style.CheckImageGapToBoundary; + IsSelected = style.IsSelected; } /// - /// Text's attributes. + /// Text's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes TextAttributes + public TextLabelStyle Text { get; set; } /// - /// Icon's attributes. + /// Icon's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes IconAttributes + public ImageViewStyle Icon { get; set; } /// - /// Check image's attributes. + /// Check image's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes CheckImageAttributes + public ImageViewStyle CheckImage { get; set; } /// - /// Right space from check image. + /// Gap of Check image to boundary. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public int CheckImageRightSpace + public int CheckImageGapToBoundary { get; set; @@ -328,16 +569,5 @@ namespace Tizen.NUI.Components get; set; } - - /// - /// Attributes's clone function. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() - { - return new DropDownItemAttributes(this); - } } } diff --git a/src/Tizen.NUI.Components/Attributes/ImageAttributes.cs b/src/Tizen.NUI.Components/Attributes/ImageControlStyle.cs similarity index 52% rename from src/Tizen.NUI.Components/Attributes/ImageAttributes.cs rename to src/Tizen.NUI.Components/Attributes/ImageControlStyle.cs index b5768b8..dcf7853 100755 --- a/src/Tizen.NUI.Components/Attributes/ImageAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/ImageControlStyle.cs @@ -14,76 +14,88 @@ * limitations under the License. * */ +using System.Collections.Generic; using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// The image view attributes class. + /// ImageControlStyle is a class which saves Button's ux data. /// + /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class ImageAttributes : ViewAttributes + public class ImageControlStyle : ControlStyle { /// - /// Construct ImageAttributes. + /// Creates a new instance of a ImageControlStyle. /// + /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes() : base() { } + public ImageControlStyle() : base() + { + InitSubStyle(); + } /// - /// Construct with specified attribute. + /// Creates a new instance of a ImageControlStyle with style. /// - /// The specified ImageAttributes. + /// Create ImageControlStyle by style customized by user. + /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes(ImageAttributes attributes) : base(attributes) + public ImageControlStyle(ImageControlStyle style) : base(style) { - if (attributes == null) + if(style == null) { return; } - if (attributes.ResourceURL != null) - { - ResourceURL = attributes.ResourceURL.Clone() as StringSelector; - } + InitSubStyle(); - if (attributes.Border != null) - { - Border = attributes.Border.Clone() as RectangleSelector; - } + Image.CopyFrom(style.Image); } + /// - /// Image URL. + /// Image's Style. /// + /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector ResourceURL + public ImageViewStyle Image { get; set; } - /// - /// Image border. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public RectangleSelector Border + public override void CopyFrom(BindableObject bindableObject) { - get; - set; + base.CopyFrom(bindableObject); + + ImageControlStyle imageControlStyle = bindableObject as ImageControlStyle; + + if (null != imageControlStyle) + { + if (null != imageControlStyle.Image) + { + Image.CopyFrom(imageControlStyle.Image); + } + } } - /// - /// Attributes's clone function. - /// - /// Return the attributes clone. - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + + private void InitSubStyle() { - return new ImageAttributes(this); + Image = new ImageViewStyle(); + Image.PropertyChanged += SubStyleCalledEvent; } + private void SubStyleCalledEvent(object sender, global::System.EventArgs e) + { + OnPropertyChanged(); + } } } diff --git a/src/Tizen.NUI.Components/Attributes/InputFieldAttributes.cs b/src/Tizen.NUI.Components/Attributes/InputFieldAttributes.cs index ea4e216..c5baf08 100755 --- a/src/Tizen.NUI.Components/Attributes/InputFieldAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/InputFieldAttributes.cs @@ -15,6 +15,8 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { @@ -24,7 +26,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class InputFieldAttributes : ViewAttributes + public class InputFieldStyle : ControlStyle { /// /// Creates a new instance of a InputFieldAttributes. @@ -32,28 +34,36 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public InputFieldAttributes() : base() { } + public InputFieldStyle() : base() + { + BackgroundImageAttributes = new ImageViewStyle(); + InputBoxAttributes = new TextFieldStyle(); + } /// - /// Creates a new instance of a InputFieldAttributes with attributes. + /// Creates a new instance of a InputFieldStyle with Style. /// - /// Create InputFieldAttributes by attributes customized by user. + /// Create InputFieldStyle by Style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public InputFieldAttributes(InputFieldAttributes attrs) : base(attrs) + public InputFieldStyle(InputFieldStyle attrs) : base(attrs) { if (null == attrs) { return; } + + BackgroundImageAttributes = new ImageViewStyle(); + InputBoxAttributes = new TextFieldStyle(); + if (null != attrs.BackgroundImageAttributes) { - BackgroundImageAttributes = attrs.BackgroundImageAttributes.Clone() as ImageAttributes; + BackgroundImageAttributes.CopyFrom(attrs.BackgroundImageAttributes); } if (null != attrs.InputBoxAttributes) { - InputBoxAttributes = attrs.InputBoxAttributes.Clone() as TextFieldAttributes; + InputBoxAttributes.CopyFrom(attrs.InputBoxAttributes); } if (null != attrs.Space) { @@ -67,7 +77,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes BackgroundImageAttributes + public ImageViewStyle BackgroundImageAttributes { get; set; @@ -79,7 +89,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextFieldAttributes InputBoxAttributes + public TextFieldStyle InputBoxAttributes { get; set; @@ -103,9 +113,24 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) { - return new InputFieldAttributes(this); + InputFieldStyle inputFieldAttributes = bindableObject as InputFieldStyle; + + if (null != inputFieldAttributes) + { + Space = inputFieldAttributes.Space; + + if (null != inputFieldAttributes.BackgroundImageAttributes) + { + BackgroundImageAttributes.CopyFrom(inputFieldAttributes.BackgroundImageAttributes); + } + + if (null != inputFieldAttributes.InputBoxAttributes) + { + InputBoxAttributes.CopyFrom(inputFieldAttributes.InputBoxAttributes); + } + } } } } diff --git a/src/Tizen.NUI.Components/Attributes/LoadingAttributes.cs b/src/Tizen.NUI.Components/Attributes/LoadingAttributes.cs index 0d8b874..a3bce97 100755 --- a/src/Tizen.NUI.Components/Attributes/LoadingAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/LoadingAttributes.cs @@ -15,60 +15,50 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// LoadingAttributes is a class which saves Loading's ux data. + /// LoadingStyle is a class which saves Loading's ux data. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class LoadingAttributes : ViewAttributes + public class LoadingStyle : ControlStyle { /// - /// Creates a new instance of a LoadingAttributes. + /// Creates a new instance of a LoadingStyle. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public LoadingAttributes() : base() { } + public LoadingStyle() : base() { } /// - /// Creates a new instance of a LoadingAttributes with attributes. + /// Creates a new instance of a LoadingStyle with style. /// - /// Create LoadingAttributes by attributes customized by user. + /// Create LoadingStyle by style customized by user. /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public LoadingAttributes(LoadingAttributes attributes) : base(attributes) + public LoadingStyle(LoadingStyle style) : base(style) { - if(null == attributes) + if(null == style) { return; } - - if (null != attributes.FrameRate) - { - FrameRate = attributes.FrameRate.Clone() as IntSelector; - } - if (null != attributes.LoadingSize) - { - LoadingSize = attributes.LoadingSize; - } - if (null != attributes.ImageArray) - { - ImageArray = attributes.ImageArray; - } + this.CopyFrom(style); } /// - /// Gets or sets loading image resource array. + /// Gets or sets loading image resources. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public string[] ImageArray + public string[] Images { get; set; @@ -78,7 +68,7 @@ namespace Tizen.NUI.Components /// Gets or sets loading image size. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Size LoadingSize { @@ -90,23 +80,41 @@ namespace Tizen.NUI.Components /// Gets or sets loading frame per second. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public IntSelector FrameRate + public Selector FrameRate { get; set; - } + } = new Selector(); /// /// Attributes's clone function. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) { - return new LoadingAttributes(this); + base.CopyFrom(bindableObject); + + LoadingStyle loadingStyle = bindableObject as LoadingStyle; + + if (null != loadingStyle) + { + if (null != loadingStyle.FrameRate) + { + FrameRate.Clone(loadingStyle.FrameRate); + } + if (null != loadingStyle.LoadingSize) + { + LoadingSize = loadingStyle.LoadingSize; + } + if (null != loadingStyle.Images) + { + Images = loadingStyle.Images; + } + } } } } diff --git a/src/Tizen.NUI.Components/Attributes/PaginationAttributes.cs b/src/Tizen.NUI.Components/Attributes/PaginationAttributes.cs index b984150..edfeb58 100755 --- a/src/Tizen.NUI.Components/Attributes/PaginationAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/PaginationAttributes.cs @@ -15,57 +15,45 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// PaginationAttributes used to config the pagination represent. + /// PaginationStyle used to config the pagination represent. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class PaginationAttributes : ViewAttributes + public class PaginationStyle : ControlStyle { /// - /// Creates a new instance of a PaginationAttributes. + /// Creates a new instance of a PaginationStyle. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public PaginationAttributes() : base() { } + public PaginationStyle() : base() { } + /// - /// Creates a new instance of a PaginationAttributes using attributes. + /// Creates a new instance of a PaginationStyle using style. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public PaginationAttributes(PaginationAttributes attributes) : base(attributes) + public PaginationStyle(PaginationStyle style) : base(style) { - if (attributes == null) - { - return; - } + if (null == style) return; - if (attributes.IndicatorSize != null) - { - IndicatorSize = new Size(attributes.IndicatorSize.Width, attributes.IndicatorSize.Height); - } - if (attributes.IndicatorBackgroundURL != null) - { - IndicatorBackgroundURL = attributes.IndicatorBackgroundURL.Clone() as string; - } - if (attributes.IndicatorSelectURL != null) - { - IndicatorSelectURL = attributes.IndicatorSelectURL.Clone() as string; - } - IndicatorSpacing = attributes.IndicatorSpacing; + this.CopyFrom(style); } /// /// Gets or sets the size of the indicator. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Size IndicatorSize { @@ -74,34 +62,22 @@ namespace Tizen.NUI.Components } /// - /// Gets or sets the background resource of indicator. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string IndicatorBackgroundURL - { - get; - set; - } - - /// - /// Gets or sets the resource of the select indicator. + /// Gets or sets the resource of indicator. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public string IndicatorSelectURL + public Selector IndicatorImageURL { get; set; - } + } = new Selector(); /// /// Gets or sets the space of the indicator. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public int IndicatorSpacing { @@ -109,17 +85,29 @@ namespace Tizen.NUI.Components set; } - /// - /// Retrieves a copy of PaginationAttributes. + /// Retrieves a copy of PaginationStyle. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) { - return new PaginationAttributes(this); - } + base.CopyFrom(bindableObject); + PaginationStyle paginationStyle = bindableObject as PaginationStyle; + if (null != paginationStyle) + { + if (null != paginationStyle.IndicatorSize) + { + IndicatorSize = new Size(paginationStyle.IndicatorSize.Width, paginationStyle.IndicatorSize.Height); + } + if (null != paginationStyle.IndicatorImageURL) + { + IndicatorImageURL.Clone(paginationStyle.IndicatorImageURL); + } + IndicatorSpacing = paginationStyle.IndicatorSpacing; + } + } } } diff --git a/src/Tizen.NUI.Components/Attributes/PopupAttributes.cs b/src/Tizen.NUI.Components/Attributes/PopupAttributes.cs index c857d5c..c483117 100755 --- a/src/Tizen.NUI.Components/Attributes/PopupAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/PopupAttributes.cs @@ -15,91 +15,50 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// PopupAttributes is a class which saves Popup's ux data. + /// PopupStyle is a class which saves Popup's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class PopupAttributes : ViewAttributes + public class PopupStyle : ControlStyle { /// - /// Creates a new instance of a PopupAttributes. + /// Creates a new instance of a PopupStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public PopupAttributes() : base() { } - /// - /// Creates a new instance of a PopupAttributes with attributes. - /// - /// Create PopupAttributes by attributes customized by user. - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public PopupAttributes(PopupAttributes attributes) : base(attributes) + public PopupStyle() : base() { - if (attributes.ShadowImageAttributes != null) - { - ShadowImageAttributes = attributes.ShadowImageAttributes.Clone() as ImageAttributes; - } - - if (attributes.BackgroundImageAttributes != null) - { - BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes; - } - - if (attributes.TitleTextAttributes != null) - { - TitleTextAttributes = attributes.TitleTextAttributes.Clone() as TextAttributes; - } - - if (attributes.ButtonAttributes != null) - { - ButtonAttributes = attributes.ButtonAttributes.Clone() as ButtonAttributes; - } - - if(attributes.ShadowOffset != null) - { - ShadowOffset = new Vector4(attributes.ShadowOffset.W, attributes.ShadowOffset.X, attributes.ShadowOffset.Y, attributes.ShadowOffset.Z); - } - + InitSubStyle(); } /// - /// Shadow image's attributes. + /// Creates a new instance of a PopupStyle with style. /// + /// Create PopupStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ShadowImageAttributes + public PopupStyle(PopupStyle style) : base(style) { - get; - set; + InitSubStyle(); + this.CopyFrom(style); } /// - /// Background image's attributes. + /// Title Text's Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes BackgroundImageAttributes - { - get; - set; - } - - /// - /// Title Text's attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes TitleTextAttributes + public TextLabelStyle Title { get; set; @@ -123,7 +82,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ButtonAttributes ButtonAttributes + public ButtonStyle Buttons { get; set; @@ -135,9 +94,83 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) + { + base.CopyFrom(bindableObject); + + PopupStyle popupAttributes = bindableObject as PopupStyle; + if (popupAttributes != null) + { + if (popupAttributes.Shadow != null) + { + Shadow.CopyFrom(popupAttributes.Shadow); + } + + if (popupAttributes.Background != null) + { + Background.CopyFrom(popupAttributes.Background); + } + + if (popupAttributes.Title != null) + { + Title.CopyFrom(popupAttributes.Title); + } + + if (popupAttributes.Buttons != null) + { + Buttons.CopyFrom(popupAttributes.Buttons); + } + + if (popupAttributes.ShadowOffset != null) + { + ShadowOffset = new Vector4(popupAttributes.ShadowOffset.W, popupAttributes.ShadowOffset.X, popupAttributes.ShadowOffset.Y, popupAttributes.ShadowOffset.Z); + } + } + } + + private void InitSubStyle() { - return new PopupAttributes(this); + Shadow = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center + }; + + Background = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent + }; + + Title = new TextLabelStyle() + { + Size = new Size(0, 0), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + HorizontalAlignment = HorizontalAlignment.Begin, + VerticalAlignment = VerticalAlignment.Bottom + }; + + Buttons = new ButtonStyle() + { + Size = new Size(0, 0), + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft, + PivotPoint = Tizen.NUI.PivotPoint.BottomLeft, + Text = new TextLabelStyle + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.Center, + PivotPoint = Tizen.NUI.PivotPoint.Center, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + } + }; } } } diff --git a/src/Tizen.NUI.Components/Attributes/ProgressAttributes.cs b/src/Tizen.NUI.Components/Attributes/ProgressAttributes.cs index fcc2d56..b65efe2 100755 --- a/src/Tizen.NUI.Components/Attributes/ProgressAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/ProgressAttributes.cs @@ -15,117 +15,141 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// ProgressAttributes is a class which saves Progress's ux data. + /// ProgressStyle is a class which saves Progress's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class ProgressAttributes : ViewAttributes + public class ProgressStyle : ControlStyle { /// - /// Creates a new instance of a ProgressAttributes. + /// Creates a new instance of a ProgressStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ProgressAttributes() : base() { } + public ProgressStyle() : base() + { + InitSubStyle(); + } /// - /// Creates a new instance of a ProgressAttributes with attributes. + /// Creates a new instance of a ProgressStyle with style. /// - /// Create ProgressAttributes by attributes customized by user. + /// Create ProgressStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ProgressAttributes(ProgressAttributes attributes) : base(attributes) + public ProgressStyle(ProgressStyle style) : base(style) { - if (null == attributes) - { - return; - } - - if (null != attributes.TrackImageAttributes) - { - TrackImageAttributes = attributes.TrackImageAttributes.Clone() as ImageAttributes; - } - - if (null != attributes.ProgressImageAttributes) - { - ProgressImageAttributes = attributes.ProgressImageAttributes.Clone() as ImageAttributes; - } + if (null == style) return; - if (null != attributes.BufferImageAttributes) - { - BufferImageAttributes = attributes.BufferImageAttributes.Clone() as ImageAttributes; - } + InitSubStyle(); - if (null != attributes.LoadingImageAttributes) - { - LoadingImageAttributes = attributes.LoadingImageAttributes.Clone() as ImageAttributes; - } + this.CopyFrom(style); } /// - /// Get or set Track Image Attributes. + /// Get or set track image. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes TrackImageAttributes + public ImageViewStyle Track { get; set; } /// - /// Get or set Progress Image Attributes. + /// Get or set progress image. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ProgressImageAttributes + public ImageViewStyle Progress { get; set; } /// - /// Get or set Buffer Image Attributes. + /// Get or set buffer image. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes BufferImageAttributes + public ImageViewStyle Buffer { get; set; } /// - /// Get or set LoadingImageAttributes. + /// Clone function. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes LoadingImageAttributes + public override void CopyFrom(BindableObject bindableObject) { - get; - set; + base.CopyFrom(bindableObject); + + ProgressStyle progressStyle = bindableObject as ProgressStyle; + + if (null != progressStyle) + { + if (null != progressStyle.Track) + { + Track.CopyFrom(progressStyle.Track); + } + + if (null != progressStyle.Progress) + { + Progress.CopyFrom(progressStyle.Progress); + } + + if (null != progressStyle.Buffer) + { + Buffer.CopyFrom(progressStyle.Buffer); + } + } } - /// - /// Attributes's clone function. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + private void InitSubStyle() { - return new ProgressAttributes(this); + Track = new ImageViewStyle() + { + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + PositionUsesPivotPoint = true, + ParentOrigin = NUI.ParentOrigin.TopLeft, + PivotPoint = NUI.PivotPoint.TopLeft + }; + + Progress = new ImageViewStyle() + { + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft + }; + + Buffer = new ImageViewStyle() + { + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent, + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft + }; } } } diff --git a/src/Tizen.NUI.Components/Attributes/ScrollbarAttributes.cs b/src/Tizen.NUI.Components/Attributes/ScrollbarAttributes.cs index 6cf714b..9d4a29a 100755 --- a/src/Tizen.NUI.Components/Attributes/ScrollbarAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/ScrollbarAttributes.cs @@ -15,75 +15,66 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// ScrollBarAttributes is a class which saves Scrollbar's ux data. + /// ScrollBarStyle is a class which saves Scrollbar's ux data. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class ScrollBarAttributes : ViewAttributes + public class ScrollBarStyle : ControlStyle { /// - /// Creates a new instance of a ScrollBarAttributes. + /// Creates a new instance of a ScrollBarStyle. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ScrollBarAttributes() : base() + public ScrollBarStyle() : base() { + InitSubStyle(); Direction = ScrollBar.DirectionType.Horizontal; } /// - /// Creates a new instance of a ScrollBarAttributes with attributes. + /// Creates a new instance of a ScrollBarStyle with style. /// - /// Create ScrollBarAttributes by attributes customized by user. + /// Create ScrollBarStyle by style customized by user. /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ScrollBarAttributes(ScrollBarAttributes attributes) : base(attributes) + public ScrollBarStyle(ScrollBarStyle style) : base(style) { - if(attributes == null) - { - return; - } + if (null == style) return; - if (attributes.TrackImageAttributes != null) - { - TrackImageAttributes = attributes.TrackImageAttributes.Clone() as ImageAttributes; - } + InitSubStyle(); - if (attributes.ThumbImageAttributes != null) - { - ThumbImageAttributes = attributes.ThumbImageAttributes.Clone() as ImageAttributes; - } - - Direction = attributes.Direction; - Duration = attributes.Duration; + this.CopyFrom(style); } /// - /// Get or set track image attributes + /// Get or set track image style /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes TrackImageAttributes + public ImageViewStyle Track { get; set; } /// - /// Get or set thumb image attributes + /// Get or set thumb image style /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ThumbImageAttributes + public ImageViewStyle Thumb { get; set; @@ -93,7 +84,7 @@ namespace Tizen.NUI.Components /// Get or set direction type /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ScrollBar.DirectionType? Direction { @@ -105,7 +96,7 @@ namespace Tizen.NUI.Components /// Get or set duration /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public uint Duration { @@ -117,12 +108,50 @@ namespace Tizen.NUI.Components /// Attributes's clone function. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) { - return new ScrollBarAttributes(this); + base.CopyFrom(bindableObject); + + ScrollBarStyle scrollBarStyle = bindableObject as ScrollBarStyle; + + if (null != scrollBarStyle) + { + if (null != scrollBarStyle.Track) + { + Track.CopyFrom(scrollBarStyle.Track); + } + + if (null != scrollBarStyle.Thumb) + { + Thumb.CopyFrom(scrollBarStyle.Thumb); + } + + Direction = scrollBarStyle.Direction; + Duration = scrollBarStyle.Duration; + } } + private void InitSubStyle() + { + Track = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft, + PivotPoint = Tizen.NUI.PivotPoint.CenterLeft, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent + }; + + Thumb = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft, + PivotPoint = Tizen.NUI.PivotPoint.CenterLeft, + WidthResizePolicy = ResizePolicyType.Fixed, + HeightResizePolicy = ResizePolicyType.Fixed + }; + } } } diff --git a/src/Tizen.NUI.Components/Attributes/SelectButtonAttributes.cs b/src/Tizen.NUI.Components/Attributes/SelectButtonAttributes.cs index 6019119..1c085ae 100755 --- a/src/Tizen.NUI.Components/Attributes/SelectButtonAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/SelectButtonAttributes.cs @@ -15,98 +15,78 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// SelectButtonAttributes is a class which saves SelectButton's ux data. + /// SelectButtonStyle is a class which saves SelectButton's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class SelectButtonAttributes : ButtonAttributes + public class SelectButtonStyle : ButtonStyle { /// - /// Creates a new instance of a SelectButtonAttributes. + /// Creates a new instance of a SelectButtonStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public SelectButtonAttributes() : base() { } + public SelectButtonStyle() : base() + { + IsSelectable = true; + CreateSubStyles(); + } /// - /// Creates a new instance of a SelectButtonAttributes with attributes. + /// Creates a new instance of a SelectButtonStyle with style. /// - /// Create SelectButtonAttributes by attributes customized by user. + /// Create SelectButtonStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public SelectButtonAttributes(SelectButtonAttributes attributes) : base(attributes) + public SelectButtonStyle(SelectButtonStyle style) : base(style) { - if(attributes == null) + if (style == null) { return; } - if (attributes.CheckImageAttributes != null) - { - CheckImageAttributes = attributes.CheckImageAttributes.Clone() as ImageAttributes; - } - if (attributes.CheckBackgroundImageAttributes != null) - { - CheckBackgroundImageAttributes = attributes.CheckBackgroundImageAttributes.Clone() as ImageAttributes; - } + CreateSubStyles(); - if (attributes.CheckShadowImageAttributes != null) - { - CheckShadowImageAttributes = attributes.CheckShadowImageAttributes.Clone() as ImageAttributes; - } + CopyFrom(style); } /// - /// Check image's attributes. + /// Selectable image's attributes. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes CheckImageAttributes + public ImageControlStyle SelectableImage { get; set; } - /// - /// Background image's attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes CheckBackgroundImageAttributes + public override void CopyFrom(BindableObject bindableObject) { - get; - set; - } + base.CopyFrom(bindableObject); - /// - /// Shadow image's attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes CheckShadowImageAttributes - { - get; - set; + SelectButtonStyle selectButtonStyle = bindableObject as SelectButtonStyle; + + if (null != selectButtonStyle && null != selectButtonStyle.SelectableImage) + { + SelectableImage.CopyFrom(selectButtonStyle.SelectableImage); + } } - /// - /// Attributes's clone function. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + private void CreateSubStyles() { - return new SelectButtonAttributes(this); + SelectableImage = new ImageControlStyle(); } } } diff --git a/src/Tizen.NUI.Components/Attributes/SliderAttributes.cs b/src/Tizen.NUI.Components/Attributes/SliderAttributes.cs index fe05413..e49aa72 100755 --- a/src/Tizen.NUI.Components/Attributes/SliderAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/SliderAttributes.cs @@ -15,175 +15,227 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; +using static Tizen.NUI.Components.Slider; namespace Tizen.NUI.Components { /// - /// SliderAttributes is a class which saves Slider's ux data. + /// SliderStyle is a class which saves Slider's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class SliderAttributes : ViewAttributes + public class SliderStyle : ControlStyle { + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IndicatorTypeProperty = BindableProperty.Create("IndicatorType", typeof(IndicatorType?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.SliderStyle)bindable; + if (newValue != null) + { + instance.privateIndicatorType = (IndicatorType)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (SliderStyle)bindable; + return instance.privateIndicatorType; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create("SpaceBetweenTrackAndIndicator", typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (SliderStyle)bindable; + if (newValue != null) + { + instance.privateSpaceBetweenTrackAndIndicator = (uint?)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (SliderStyle)bindable; + return instance.privateSpaceBetweenTrackAndIndicator; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create("TrackThickness", typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (SliderStyle)bindable; + if (newValue != null) + { + instance.privateTrackThickness = (uint?)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (SliderStyle)bindable; + return instance.privateTrackThickness; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create("TrackPadding", typeof(Extents), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (SliderStyle)bindable; + if (newValue != null) + { + instance.trackPadding.CopyFrom((Extents)newValue); + } + }, + defaultValueCreator: (bindable) => + { + var instance = (SliderStyle)bindable; + return instance.trackPadding; + }); /// - /// Creates a new instance of a SliderAttributes. + /// Creates a new instance of a SliderStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public SliderAttributes() : base() + public SliderStyle() : base() { IndicatorType = Slider.IndicatorType.None; + InitSubStyle(); } /// - /// Creates a new instance of a SliderAttributes with attributes. + /// Creates a new instance of a SliderStyle with style. /// - /// Create SliderAttributes by attributes customized by user. + /// Create SliderStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public SliderAttributes(SliderAttributes attributes) : base(attributes) + public SliderStyle(SliderStyle style) : base(style) { - if(attributes == null) + if(style == null) { return; } - if (attributes.BackgroundTrackAttributes != null) - { - BackgroundTrackAttributes = attributes.BackgroundTrackAttributes.Clone() as ImageAttributes; - } - if (attributes.SlidedTrackAttributes != null) - { - SlidedTrackAttributes = attributes.SlidedTrackAttributes.Clone() as ImageAttributes; - } - if (attributes.ThumbBackgroundAttributes != null) - { - ThumbBackgroundAttributes = attributes.ThumbBackgroundAttributes.Clone() as ImageAttributes; - } - if (attributes.ThumbAttributes != null) - { - ThumbAttributes = attributes.ThumbAttributes.Clone() as ImageAttributes; - } - if (attributes.LowIndicatorImageAttributes != null) - { - LowIndicatorImageAttributes = attributes.LowIndicatorImageAttributes.Clone() as ImageAttributes; - } - if (attributes.HighIndicatorImageAttributes != null) - { - HighIndicatorImageAttributes = attributes.HighIndicatorImageAttributes.Clone() as ImageAttributes; - } - if (attributes.LowIndicatorTextAttributes != null) - { - LowIndicatorTextAttributes = attributes.LowIndicatorTextAttributes.Clone() as TextAttributes; - } - if (attributes.HighIndicatorTextAttributes != null) - { - HighIndicatorTextAttributes = attributes.HighIndicatorTextAttributes.Clone() as TextAttributes; - } - if (attributes.TrackThickness != null) - { - TrackThickness = attributes.TrackThickness; - } - if (attributes.SpaceBetweenTrackAndIndicator != null) - { - SpaceBetweenTrackAndIndicator = attributes.SpaceBetweenTrackAndIndicator; - } - IndicatorType = attributes.IndicatorType; + + InitSubStyle(); + + this.CopyFrom(style); + + IndicatorType = style.IndicatorType; + } + + /// + /// Get or set background track. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageViewStyle Track + { + get; + set; } /// - /// Get or set background track attributes + /// Get or set slided track. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes BackgroundTrackAttributes + public ImageViewStyle Progress { get; set; } /// - /// Get or set slided track attributes + /// Get or set thumb. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes SlidedTrackAttributes + public ImageViewStyle Thumb { get; set; } /// - /// Get or set thumb attributes + /// Get or set thumb background. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ThumbAttributes + public ImageViewStyle ThumbBackground { get; set; } /// - /// Get or set thumb background attributes + /// Get or set low indicator image. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes ThumbBackgroundAttributes + public ImageViewStyle LowIndicatorImage { get; set; } /// - /// Get or set low indicator image attributes + /// Get or set high indicator image. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes LowIndicatorImageAttributes + public ImageViewStyle HighIndicatorImage { get; set; } /// - /// Get or set high indicator image attributes + /// Get or set low indicator text. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes HighIndicatorImageAttributes + public TextLabelStyle LowIndicator { get; set; } /// - /// Get or low indicator text attributes + /// Get or set high indicator text. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes LowIndicatorTextAttributes + public TextLabelStyle HighIndicator { get; set; } /// - /// Get or set high indicator text attributes + /// Get or set Indicator type /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes HighIndicatorTextAttributes + public IndicatorType? IndicatorType + { + get + { + return (IndicatorType?)GetValue(IndicatorTypeProperty); + } + set + { + SetValue(IndicatorTypeProperty, value); + } + } + private IndicatorType? privateIndicatorType { get; set; @@ -197,6 +249,17 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public uint? TrackThickness { + get + { + return (uint?)GetValue(TrackThicknessProperty); + } + set + { + SetValue(TrackThicknessProperty, value); + } + } + private uint? privateTrackThickness + { get; set; } @@ -209,20 +272,53 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public uint? SpaceBetweenTrackAndIndicator { + get + { + return (uint?)GetValue(SpaceBetweenTrackAndIndicatorProperty); + } + set + { + SetValue(SpaceBetweenTrackAndIndicatorProperty, value); + } + } + private uint? privateSpaceBetweenTrackAndIndicator + { get; set; } /// - /// Get or set Indicator type + /// Get or set space between track and indicator /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Slider.IndicatorType IndicatorType + public Extents TrackPadding { - get; - set; + get + { + return (Extents)GetValue(TrackPaddingProperty); + } + set + { + SetValue(TrackPaddingProperty, value); + } + } + private Extents _trackPadding; + private Extents trackPadding + { + get + { + if (null == _trackPadding) + { + _trackPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom)=> + { + Extents extents = new Extents(start, end, top, bottom); + _trackPadding.CopyFrom(extents); + }, 0, 0, 0, 0); + } + return _trackPadding; + } } /// @@ -231,9 +327,108 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) + { + base.CopyFrom(bindableObject); + + SliderStyle sliderAttributes = bindableObject as SliderStyle; + + if (null != sliderAttributes) + { + if (sliderAttributes.Track != null) + { + if (null == Track) + { + Track = new ImageViewStyle(); + } + Track.CopyFrom(sliderAttributes.Track); + } + + if (sliderAttributes.Progress != null) + { + if (null == Progress) + { + Progress = new ImageViewStyle(); + } + Progress.CopyFrom(sliderAttributes.Progress); + } + + if (sliderAttributes.Thumb != null) + { + if (null == Thumb) + { + Thumb = new ImageViewStyle(); + } + Thumb.CopyFrom(sliderAttributes.Thumb); + } + + if (sliderAttributes.ThumbBackground != null) + { + if (null == ThumbBackground) + { + ThumbBackground = new ImageViewStyle(); + } + ThumbBackground.CopyFrom(sliderAttributes.ThumbBackground); + } + + if (sliderAttributes.LowIndicatorImage != null) + { + if (null == LowIndicatorImage) + { + LowIndicatorImage = new ImageViewStyle(); + } + LowIndicatorImage.CopyFrom(sliderAttributes.LowIndicatorImage); + } + + if (sliderAttributes.HighIndicatorImage != null) + { + if (null == HighIndicatorImage) + { + HighIndicatorImage = new ImageViewStyle(); + } + HighIndicatorImage.CopyFrom(sliderAttributes.HighIndicatorImage); + } + + if (sliderAttributes.LowIndicator != null) + { + if (null == LowIndicator) + { + LowIndicator = new TextLabelStyle(); + } + LowIndicator.CopyFrom(sliderAttributes.LowIndicator); + } + + if (sliderAttributes.HighIndicator != null) + { + if (null == HighIndicator) + { + HighIndicator = new TextLabelStyle(); + } + HighIndicator.CopyFrom(sliderAttributes.HighIndicator); + } + + if (sliderAttributes.TrackThickness != null) + { + TrackThickness = sliderAttributes.TrackThickness; + } + + if (sliderAttributes.TrackPadding != null) + { + TrackPadding = sliderAttributes.TrackPadding; + } + } + } + + private void InitSubStyle() { - return new SliderAttributes(this); + Track = new ImageViewStyle(); + Progress = new ImageViewStyle(); + Thumb = new ImageViewStyle(); + ThumbBackground = new ImageViewStyle(); + LowIndicatorImage = new ImageViewStyle(); + HighIndicatorImage = new ImageViewStyle(); + LowIndicator = new TextLabelStyle(); + HighIndicator = new TextLabelStyle(); } } } diff --git a/src/Tizen.NUI.Components/Attributes/SwitchAttributes.cs b/src/Tizen.NUI.Components/Attributes/SwitchAttributes.cs index 18b02dd..a2aff40 100755 --- a/src/Tizen.NUI.Components/Attributes/SwitchAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/SwitchAttributes.cs @@ -15,81 +15,118 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// SwitchAttributes is a class which saves Switch's ux data. + /// SwitchStyle is a class which saves Switch's ux data. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class SwitchAttributes : ButtonAttributes + public class SwitchStyle : ButtonStyle { /// - /// Creates a new instance of a SwitchAttributes. + /// Creates a new instance of a SwitchStyle. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public SwitchAttributes() : base() { } + public SwitchStyle() : base() + { + InitSubStyle(); + } + /// - /// Creates a new instance of a SwitchAttributes with attributes. + /// Creates a new instance of a SwitchStyle with style. /// - /// Create SwitchAttributes by attributes customized by user. + /// Create SwitchStyle by style customized by user. /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public SwitchAttributes(SwitchAttributes attributes) : base(attributes) + public SwitchStyle(SwitchStyle style) : base(style) { - if(attributes == null) + if(null == style) { return; } - if (attributes.SwitchHandlerImageAttributes != null) - { - SwitchHandlerImageAttributes = attributes.SwitchHandlerImageAttributes.Clone() as ImageAttributes; - } - if (attributes.SwitchBackgroundImageAttributes != null) - { - SwitchBackgroundImageAttributes = attributes.SwitchBackgroundImageAttributes.Clone() as ImageAttributes; - } + InitSubStyle(); + + this.CopyFrom(style); } /// - /// Handler image's attributes. + /// Thumb image's style. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes SwitchHandlerImageAttributes + public ImageViewStyle Thumb { get; set; } /// - /// Background image's attributes. + /// Track image's style. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes SwitchBackgroundImageAttributes + public ImageViewStyle Track { get; set; } /// - /// Attributes's clone function. + /// Style's clone function. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) { - return new SwitchAttributes(this); + base.CopyFrom(bindableObject); + + SwitchStyle switchStyle = bindableObject as SwitchStyle; + + if (null != switchStyle) + { + if (null != switchStyle.Track) + { + Track.CopyFrom(switchStyle.Track); + } + + if (null != switchStyle.Thumb) + { + Thumb.CopyFrom(switchStyle.Thumb); + } + } + } + + private void InitSubStyle() + { + Track = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft, + PivotPoint = Tizen.NUI.PivotPoint.CenterLeft, + WidthResizePolicy = ResizePolicyType.FillToParent, + HeightResizePolicy = ResizePolicyType.FillToParent + }; + + Thumb = new ImageViewStyle() + { + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft, + PivotPoint = Tizen.NUI.PivotPoint.CenterLeft, + WidthResizePolicy = ResizePolicyType.Fixed, + HeightResizePolicy = ResizePolicyType.Fixed + }; } } } diff --git a/src/Tizen.NUI.Components/Attributes/TabAttributes.cs b/src/Tizen.NUI.Components/Attributes/TabAttributes.cs index bab29ff..4c61733 100755 --- a/src/Tizen.NUI.Components/Attributes/TabAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/TabAttributes.cs @@ -15,64 +15,82 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// TabAttributes is a class which saves Tab's ux data. + /// TabStyle is a class which saves Tab's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class TabAttributes : ViewAttributes + public class TabStyle : ControlStyle { /// - /// Creates a new instance of a TabAttributes. + /// Creates a new instance of a TabStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TabAttributes() : base() + public TabStyle() : base() { - Space = new Vector4(0, 0, 0, 0); + ItemPadding = new Extents(0, 0, 0, 0); UseTextNaturalSize = false; ItemSpace = 0; + + UnderLine = new ViewStyle(); + Text = new TextLabelStyle(); } /// - /// Creates a new instance of a TabAttributes with attributes. + /// Creates a new instance of a TabStyle with style. /// - /// Create TabAttributes by attributes customized by user. + /// Create TabStyle by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TabAttributes(TabAttributes attributes) : base(attributes) + public TabStyle(TabStyle style) : base(style) { - if (null == attributes) + UnderLine = new ViewStyle(); + Text = new TextLabelStyle(); + + if (null == style) { return; } - if (attributes.UnderLineAttributes != null) + if (style.UnderLine != null) { - UnderLineAttributes = attributes.UnderLineAttributes.Clone() as ViewAttributes; + UnderLine.CopyFrom(style.UnderLine); } - if (attributes.TextAttributes != null) + if (style.Text != null) { - TextAttributes = attributes.TextAttributes.Clone() as TextAttributes; + Text.CopyFrom(style.Text); } - if (attributes.Space != null) + if (style.ItemPadding != null) { - Space = new Vector4(attributes.Space.X, attributes.Space.Y, attributes.Space.Z, attributes.Space.W); + ItemPadding = new Extents(style.ItemPadding.Start, style.ItemPadding.End, style.ItemPadding.Top, style.ItemPadding.Bottom); } else { - Space = new Vector4(0, 0, 0, 0); + ItemPadding = new Extents(0, 0, 0, 0); + } + ItemSpace = style.ItemSpace; + UseTextNaturalSize = style.UseTextNaturalSize; + + if (null != style.UnderLine) + { + UnderLine.CopyFrom(style.UnderLine); + } + + if (null != style.Text) + { + Text.CopyFrom(style.Text); } - ItemSpace = attributes.ItemSpace; - UseTextNaturalSize = attributes.UseTextNaturalSize; } /// @@ -81,7 +99,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ViewAttributes UnderLineAttributes + public ViewStyle UnderLine { get; set; @@ -93,7 +111,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes TextAttributes + public TextLabelStyle Text { get; set; @@ -129,7 +147,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Vector4 Space + public Extents ItemPadding { get; set; @@ -141,9 +159,31 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + public override void CopyFrom(BindableObject bindableObject) { - return new TabAttributes(this); + base.CopyFrom(bindableObject); + TabStyle tabStyle = bindableObject as TabStyle; + + if (null != tabStyle) + { + if (null != tabStyle.ItemPadding) + { + ItemPadding.CopyFrom(tabStyle.ItemPadding); + } + + ItemSpace = tabStyle.ItemSpace; + UseTextNaturalSize = tabStyle.UseTextNaturalSize; + + if (null != tabStyle.UnderLine) + { + UnderLine.CopyFrom(tabStyle.UnderLine); + } + + if (null != tabStyle.Text) + { + Text.CopyFrom(tabStyle.Text); + } + } } } } diff --git a/src/Tizen.NUI.Components/Attributes/TextAttributes.cs b/src/Tizen.NUI.Components/Attributes/TextAttributes.cs deleted file mode 100755 index b263d38..0000000 --- a/src/Tizen.NUI.Components/Attributes/TextAttributes.cs +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright(c) 2019 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.Components -{ - /// - /// The Text Attributes class. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public class TextAttributes : ViewAttributes - { - /// - /// Construct TextAttributes. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes() : base() { } - /// - /// Construct with specified attribute. - /// - /// The specified TextAttributes. - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes(TextAttributes attributes) : base(attributes) - { - if(attributes == null) - { - return; - } - if (attributes.Text != null) - { - Text = attributes.Text.Clone() as StringSelector; - } - - if (attributes.TranslatableText != null) - { - TranslatableText = attributes.TranslatableText.Clone() as StringSelector; - } - - if (attributes.MultiLine != null) - { - MultiLine = attributes.MultiLine; - } - - if (attributes.HorizontalAlignment != null) - { - HorizontalAlignment = attributes.HorizontalAlignment; - } - - if (attributes.VerticalAlignment != null) - { - VerticalAlignment = attributes.VerticalAlignment; - } - - if (attributes.EnableMarkup != null) - { - EnableMarkup = attributes.EnableMarkup; - } - - if (attributes.EnableAutoScroll != null) - { - EnableAutoScroll = attributes.EnableAutoScroll; - } - - if (attributes.AutoScrollSpeed != null) - { - AutoScrollSpeed = attributes.AutoScrollSpeed; - } - - if (attributes.AutoScrollLoopCount != null) - { - AutoScrollLoopCount = attributes.AutoScrollLoopCount; - } - - if (attributes.AutoScrollGap != null) - { - AutoScrollGap = attributes.AutoScrollGap; - } - - if (attributes.AutoScrollLoopDelay != null) - { - AutoScrollLoopDelay = attributes.AutoScrollLoopDelay; - } - - if (attributes.AutoScrollStopMode != null) - { - AutoScrollStopMode = attributes.AutoScrollStopMode; - } - - if (attributes.LineSpacing != null) - { - LineSpacing = attributes.LineSpacing; - } - - if (attributes.TextColor != null) - { - TextColor = attributes.TextColor.Clone() as ColorSelector; - } - - if (attributes.FontFamily != null) - { - FontFamily = attributes.FontFamily; - } - - if (attributes.PointSize != null) - { - PointSize = attributes.PointSize.Clone() as FloatSelector; - } - - if (attributes.ShadowOffset != null) - { - ShadowOffset = attributes.ShadowOffset.Clone() as Vector2Selector; - } - - if (attributes.ShadowColor != null) - { - ShadowColor = attributes.ShadowColor.Clone() as ColorSelector; - } - - if (attributes.OutstrokeColor != null) - { - OutstrokeColor = attributes.OutstrokeColor.Clone() as ColorSelector; - } - if (attributes.OutstrokeThickness != null) - { - OutstrokeThickness = attributes.OutstrokeThickness.Clone() as IntSelector; - } - } - /// - /// TextLabel Text - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector Text - { - get; - set; - } - /// - /// The TranslatableText property - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector TranslatableText - { - get; - set; - } - /// - /// TextLabel MultiLine - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? MultiLine - { - get; - set; - } - /// - /// TextLabel HorizontalAlignment - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public HorizontalAlignment? HorizontalAlignment - { - get; - set; - } - /// - /// TextLabel VerticalAlignment - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public VerticalAlignment? VerticalAlignment - { - get; - set; - } - /// - /// TextLabel EnableMarkup - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? EnableMarkup - { - get; - set; - } - /// - /// TextLabel EnableAutoScroll - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? EnableAutoScroll - { - get; - set; - } - /// - /// TextLabel AutoScrollSpeed - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int? AutoScrollSpeed - { - get; - set; - } - /// - /// TextLabel AutoScrollLoopCount - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int? AutoScrollLoopCount -{ - get; - set; - } - /// - /// TextLabel AutoScrollGap - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public float? AutoScrollGap - { - get; - set; - } - /// - /// TextLabel AutoScrollLoopDelay - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public float? AutoScrollLoopDelay - { - get; - set; - } - /// - /// TextLabel AutoScrollStopMode - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public AutoScrollStopMode? AutoScrollStopMode - { - get; - set; - } - /// - /// TextLabel LineSpacing - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public float? LineSpacing - { - get; - set; - } - /// - /// TextLabel TextColor - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector TextColor - { - get; - set; - } - /// - /// TextLabel FontFamily - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string FontFamily - { - get; - set; - } - /// - /// TextLabel PointSize - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public FloatSelector PointSize - { - get; - set; - } - /// - /// TextLabel ShadowOffset - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Vector2Selector ShadowOffset - { - get; - set; - } - /// - /// TextLabel ShadowColor - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector ShadowColor - { - get; - set; - } - /// - /// TextLabel OutstrokeColor - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector OutstrokeColor - { - get; - set; - } - /// - /// TextLabel OutstrokeThickness - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public IntSelector OutstrokeThickness - { - get; - set; - } - /// - /// Attributes's clone function. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() - { - return new TextAttributes(this); - } - } -} diff --git a/src/Tizen.NUI.Components/Attributes/TextFieldAttributes.cs b/src/Tizen.NUI.Components/Attributes/TextFieldAttributes.cs deleted file mode 100755 index b45ed30..0000000 --- a/src/Tizen.NUI.Components/Attributes/TextFieldAttributes.cs +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright(c) 2019 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.Components -{ - /// - /// TextFieldAttributes is a class which saves TextField's ux data. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public class TextFieldAttributes : ViewAttributes - { - /// - /// Creates a new instance of a TextField. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public TextFieldAttributes() : base() { } - - /// - /// Creates a new instance of a TextField with style. - /// - /// Create TextField by special style defined in UX. - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public TextFieldAttributes(TextFieldAttributes attributes) : base(attributes) - { - if(null == attributes) - { - return; - } - if (null != attributes.Text) - { - Text = attributes.Text.Clone() as StringSelector; - } - if (null != attributes.PlaceholderText) - { - PlaceholderText = attributes.PlaceholderText.Clone() as StringSelector; - } - if (null != attributes.TranslatablePlaceholderText) - { - TranslatablePlaceholderText = attributes.TranslatablePlaceholderText.Clone() as StringSelector; - } - if (null != attributes.HorizontalAlignment) - { - HorizontalAlignment = attributes.HorizontalAlignment; - } - if (null != attributes.VerticalAlignment) - { - VerticalAlignment = attributes.VerticalAlignment; - } - if (null != attributes.EnableMarkup) - { - EnableMarkup = attributes.EnableMarkup; - } - if (null != attributes.TextColor) - { - TextColor = attributes.TextColor.Clone() as ColorSelector; - } - if (null != attributes.PlaceholderTextColor) - { - PlaceholderTextColor = attributes.PlaceholderTextColor.Clone() as ColorSelector; - } - if (null != attributes.PrimaryCursorColor) - { - PrimaryCursorColor = attributes.PrimaryCursorColor.Clone() as ColorSelector; - } - if (null != attributes.SecondaryCursorColor) - { - SecondaryCursorColor = attributes.SecondaryCursorColor.Clone() as ColorSelector; - } - if (null != attributes.FontFamily) - { - FontFamily = attributes.FontFamily; - } - if (null != attributes.PointSize) - { - PointSize = attributes.PointSize.Clone() as FloatSelector; - } - if (null != attributes.EnableCursorBlink) - { - EnableCursorBlink = attributes.EnableCursorBlink; - } - if (null != attributes.EnableSelection) - { - EnableSelection = attributes.EnableSelection; - } - if (null != attributes.CursorWidth) - { - CursorWidth = attributes.CursorWidth; - } - if (null != attributes.EnableEllipsis) - { - EnableEllipsis = attributes.EnableEllipsis; - } - } - - /// - /// Gets or sets text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector Text - { - get; - set; - } - - /// - /// Gets or sets place holder text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector PlaceholderText - { - get; - set; - } - - /// - /// Gets or sets translatable place holder text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector TranslatablePlaceholderText - { - get; - set; - } - - /// - /// Gets or sets horizontal alignment of text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public HorizontalAlignment? HorizontalAlignment - { - get; - set; - } - - /// - /// Gets or sets vertical alignment of text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public VerticalAlignment? VerticalAlignment - { - get; - set; - } - - /// - /// Gets or sets enable mark up. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? EnableMarkup - { - get; - set; - } - - /// - /// Gets or sets text color. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector TextColor - { - get; - set; - } - - /// - /// Gets or sets place holder text color. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector PlaceholderTextColor - { - get; - set; - } - - /// - /// Gets or sets primary cursor color. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector PrimaryCursorColor - { - get; - set; - } - - /// - /// Gets or sets secondary cursor color. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector SecondaryCursorColor - { - get; - set; - } - - /// - /// Gets or sets font family of text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string FontFamily - { - get; - set; - } - - /// - /// Gets or sets point size of text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public FloatSelector PointSize - { - get; - set; - } - - /// - /// Gets or sets enable cursor blink. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? EnableCursorBlink - { - get; - set; - } - - /// - /// Gets or sets enable selection. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? EnableSelection - { - get; - set; - } - - /// - /// Gets or sets cursor width. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int? CursorWidth - { - get; - set; - } - - /// - /// Gets or sets if enable ellipsis. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? EnableEllipsis - { - get; - set; - } - - /// - /// Attributes's clone function. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() - { - return new TextFieldAttributes(this); - } - } -} diff --git a/src/Tizen.NUI.Components/Attributes/ToastAttributes.cs b/src/Tizen.NUI.Components/Attributes/ToastAttributes.cs index 481f12d..ec1ca60 100755 --- a/src/Tizen.NUI.Components/Attributes/ToastAttributes.cs +++ b/src/Tizen.NUI.Components/Attributes/ToastAttributes.cs @@ -15,120 +15,115 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { /// - /// ToastAttributes is a class which saves Toast's ux data. + /// ToastStyle is a class which saves Toast's ux data. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public class ToastAttributes : ViewAttributes + public class ToastStyle : ControlStyle { /// - /// Creates a new instance of a ToastAttributes. + /// Creates a new instance of a ToastStyle. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ToastAttributes() : base() { } - - /// - /// Creates a new instance of a ToastAttributes with attributes. - /// - /// Create ToastAttributes by attributes customized by user. - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ToastAttributes(ToastAttributes attributes) : base(attributes) + public ToastStyle() : base() { - if(null == attributes) - { - return; - } - if(null != attributes.BackgroundImageAttributes) - { - BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes; - } - if(null != attributes.TextAttributes) - { - TextAttributes = attributes.TextAttributes.Clone() as TextAttributes; - } - TextLineHeight = attributes.TextLineHeight; - TextLineSpace = attributes.TextLineSpace; - Duration = attributes.Duration; + InitSubStyle(); } /// - /// Gets or sets background image attributes. + /// Creates a new instance of a ToastStyle with Style. /// + /// Create ToastStyle by Style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ImageAttributes BackgroundImageAttributes + public ToastStyle(ToastStyle style) : base(style) { - get; - set; + InitSubStyle(); + this.CopyFrom(style); } /// - /// Gets or sets text attributes. + /// Gets or sets background image Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public TextAttributes TextAttributes + public ImageViewStyle Background { get; set; } /// - /// Gets or sets toast text line height. + /// Gets or sets text Style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public uint? TextLineHeight + public TextLabelStyle Text { get; set; } /// - /// Gets or sets toast text line space. + /// Gets or sets toast show duration time. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public uint? TextLineSpace + public uint? Duration { get; set; } /// - /// Gets or sets toast show duration time. + /// Style's clone function. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public uint? Duration + public override void CopyFrom(BindableObject bindableObject) { - get; - set; + base.CopyFrom(bindableObject); + ToastStyle toastStyle = bindableObject as ToastStyle; + if (toastStyle != null) + { + if (toastStyle.Background!= null) + { + Background.CopyFrom(toastStyle.Background); + } + + if (toastStyle.Text!= null) + { + Text.CopyFrom(toastStyle.Text); + } + Duration = toastStyle.Duration; + } } - /// - /// Attributes's clone function. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() + private void InitSubStyle() { - return new ToastAttributes(this); + if (Background== null) + { + Background= new ImageViewStyle(); + } + + if (Text== null) + { + Text= new TextLabelStyle(); + } } } } diff --git a/src/Tizen.NUI.Components/Attributes/ViewAttributes.cs b/src/Tizen.NUI.Components/Attributes/ViewAttributes.cs deleted file mode 100755 index 4bfd671..0000000 --- a/src/Tizen.NUI.Components/Attributes/ViewAttributes.cs +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright(c) 2019 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.Components -{ - /// - /// The base class for Children attributes in Components. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public class ViewAttributes : Attributes - { - /// - /// Construct ViewAttributes. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ViewAttributes() : base() { } - /// - /// Constructs a ViewAttributes that is a copy of attrs. - /// - /// Construct Attributes - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ViewAttributes(ViewAttributes attributes) - { - if (attributes == null) - { - return; - } - - if (attributes.Position != null) - { - Position = new Position(attributes.Position.X, attributes.Position.Y, attributes.Position.Z); - } - - if (attributes.Size != null) - { - Size = new Size(attributes.Size.Width, attributes.Size.Height, attributes.Size.Depth); - } - - if (attributes.BackgroundColor != null) - { - BackgroundColor = attributes.BackgroundColor.Clone() as ColorSelector; - } - - if (attributes.PositionUsesPivotPoint != null) - { - PositionUsesPivotPoint = attributes.PositionUsesPivotPoint; - } - - if (attributes.ParentOrigin != null) - { - ParentOrigin = new Position(attributes.ParentOrigin.X, attributes.ParentOrigin.Y, attributes.ParentOrigin.Z); - } - - if (attributes.PivotPoint != null) - { - PivotPoint = new Position(attributes.PivotPoint.X, attributes.PivotPoint.Y, attributes.PivotPoint.Z); - } - - if (attributes.WidthResizePolicy != null) - { - WidthResizePolicy = attributes.WidthResizePolicy; - } - - if (attributes.HeightResizePolicy != null) - { - HeightResizePolicy = attributes.HeightResizePolicy; - } - - if (attributes.MinimumSize != null) - { - MinimumSize = new Size2D(attributes.MinimumSize.Width, attributes.MinimumSize.Height); - } - - if (attributes.SizeModeFactor != null) - { - SizeModeFactor = new Vector3(attributes.SizeModeFactor.X, attributes.SizeModeFactor.Y, attributes.SizeModeFactor.Z); - } - - if (attributes.Opacity != null) - { - Opacity = attributes.Opacity.Clone() as FloatSelector; - } - - PaddingLeft = attributes.PaddingLeft; - PaddingRight = attributes.PaddingRight; - PaddingTop = attributes.PaddingTop; - PaddingBottom = attributes.PaddingBottom; - } - /// - /// View Position - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Position Position - { - get; - set; - } - /// - /// View Size - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Size Size - { - get; - set; - } - /// - /// View BackgroundColor - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector BackgroundColor - { - get; - set; - } - /// - /// View PositionUsesPivotPoint - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public bool? PositionUsesPivotPoint - { - get; - set; - } - /// - /// View ParentOrigin - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Position ParentOrigin - { - get; - set; - } - /// - /// View PivotPoint - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Position PivotPoint - { - get; - set; - } - /// - /// View WidthResizePolicy - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ResizePolicyType? WidthResizePolicy - { - get; - set; - } - /// - /// View HeightResizePolicy - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ResizePolicyType? HeightResizePolicy - { - get; - set; - } - /// - /// View MinimumSize - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Size2D MinimumSize - { - get; - set; - } - /// - /// View SizeModeFactor - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Vector3 SizeModeFactor - { - get; - set; - } - /// - /// View Opacity - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public FloatSelector Opacity - { - get; - set; - } - /// - /// View left padding - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int PaddingLeft - { - get; - set; - } - /// - /// View right padding - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int PaddingRight - { - get; - set; - } - /// - /// View top padding - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int PaddingTop - { - get; - set; - } - /// - /// View bottom padding - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int PaddingBottom - { - get; - set; - } - /// - /// Attributes's clone function. - /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public override Attributes Clone() - { - return new ViewAttributes(this); - } - - } -} diff --git a/src/Tizen.NUI.Components/Controls/Button.cs b/src/Tizen.NUI.Components/Controls/Button.cs index f6340ba..719dea2 100755 --- a/src/Tizen.NUI.Components/Controls/Button.cs +++ b/src/Tizen.NUI.Components/Controls/Button.cs @@ -17,6 +17,7 @@ using System; using System.ComponentModel; using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { @@ -27,19 +28,78 @@ namespace Tizen.NUI.Components /// 6 public class Button : Control { - private ImageView backgroundImage; - private ImageView shadowImage; + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create("IconRelativeOrientation", typeof(IconOrientation?), typeof(Tizen.NUI.Components.Button), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + if (newValue != null) + { + instance.privateIconRelativeOrientation = (IconOrientation?)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + return instance.privateIconRelativeOrientation; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool), typeof(Tizen.NUI.Components.Button), true, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + if (newValue != null) + { + instance.privateIsEnabled = (bool)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + return instance.privateIsEnabled; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create("IsSelected", typeof(bool), typeof(Tizen.NUI.Components.Button), true, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + if (newValue != null) + { + instance.privateIsSelected = (bool)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + return instance.privateIsSelected; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create("IsSelectable", typeof(bool), typeof(Tizen.NUI.Components.Button), true, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + if (newValue != null) + { + instance.privateIsSelectable = (bool)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.Button)bindable; + return instance.privateIsSelectable; + }); + private ImageView overlayImage; private TextLabel buttonText; private ImageView buttonIcon; - private ButtonAttributes buttonAttributes; private EventHandler stateChangeHander; private bool isSelected = false; private bool isEnabled = true; private bool isPressed = false; + /// /// Creates a new instance of a Button. /// @@ -48,6 +108,7 @@ namespace Tizen.NUI.Components { Initialize(); } + /// /// Creates a new instance of a Button with style. /// @@ -59,17 +120,19 @@ namespace Tizen.NUI.Components { Initialize(); } + /// /// Creates a new instance of a Button with attributes. /// - /// Create Button by attributes customized by user. + /// Create Button by attributes customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Button(ButtonAttributes attributes) : base(attributes) + public Button(ButtonStyle controlStyle) : base(controlStyle) { Initialize(); } + /// /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
///
@@ -117,202 +180,55 @@ namespace Tizen.NUI.Components /// 6 Right, } - /// - /// Flag to decide Button can be selected or not. - /// - /// 6 - public bool IsSelectable - { - get - { - return buttonAttributes?.IsSelectable ?? false; - } - set - { - buttonAttributes.IsSelectable = value; - } - } - /// - /// Background image's resource url in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string BackgroundImageURL - { - get - { - return buttonAttributes?.BackgroundImageAttributes?.ResourceURL?.All; - } - set - { - if (value != null) - { - CreateBackgroundAttributes(); - if (buttonAttributes.BackgroundImageAttributes.ResourceURL == null) - { - buttonAttributes.BackgroundImageAttributes.ResourceURL = new StringSelector(); - } - buttonAttributes.BackgroundImageAttributes.ResourceURL.All = value; - RelayoutRequest(); - } - } - } - /// - /// Background image's border in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Rectangle BackgroundImageBorder - { - get - { - return buttonAttributes?.BackgroundImageAttributes?.Border?.All; - } - set - { - if (value != null) - { - CreateBackgroundAttributes(); - if (buttonAttributes.BackgroundImageAttributes.Border == null) - { - buttonAttributes.BackgroundImageAttributes.Border = new RectangleSelector(); - } - buttonAttributes.BackgroundImageAttributes.Border.All = value; - RelayoutRequest(); - } - } - } - /// - /// Shadow image's resource url in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public string ShadowImageURL - { - get - { - return buttonAttributes?.ShadowImageAttributes?.ResourceURL?.All; - } - set - { - if (value != null) - { - CreateShadowAttributes(); - if (buttonAttributes.ShadowImageAttributes.ResourceURL == null) - { - buttonAttributes.ShadowImageAttributes.ResourceURL = new StringSelector(); - } - buttonAttributes.ShadowImageAttributes.ResourceURL.All = value; - RelayoutRequest(); - } - } - } + public new ButtonStyle Style => ViewStyle as ButtonStyle; + /// - /// Shadow image's border in Button. + /// The text of Button. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Rectangle ShadowImageBorder + public string Text { get { - return buttonAttributes?.ShadowImageAttributes?.Border?.All; + return Style.Text.Text.GetValue(ControlState); } set { - if (value != null) - { - CreateShadowAttributes(); - if (buttonAttributes.ShadowImageAttributes.Border == null) - { - buttonAttributes.ShadowImageAttributes.Border = new RectangleSelector(); - } - buttonAttributes.ShadowImageAttributes.Border.All = value; - RelayoutRequest(); - } + Style.Text.Text = value; } } + /// - /// Overlay image's resource url in Button. + /// Flag to decide Button can be selected or not. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string OverlayImageURL + public bool IsSelectable { get { - return buttonAttributes?.OverlayImageAttributes?.ResourceURL?.All; + return (bool)GetValue(IsSelectableProperty); } set { - if (value != null) - { - CreateOverlayAttributes(); - if (buttonAttributes.OverlayImageAttributes.ResourceURL == null) - { - buttonAttributes.OverlayImageAttributes.ResourceURL = new StringSelector(); - } - buttonAttributes.OverlayImageAttributes.ResourceURL.All = value; - RelayoutRequest(); - } + SetValue(IsSelectableProperty, value); } } - /// - /// Overlay image's border in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Rectangle OverlayImageBorder + + private bool privateIsSelectable { get { - return buttonAttributes?.OverlayImageAttributes?.Border?.All; + return Style?.IsSelectable ?? false; } set { - if (value != null) - { - CreateOverlayAttributes(); - if (buttonAttributes.OverlayImageAttributes.Border == null) - { - buttonAttributes.OverlayImageAttributes.Border = new RectangleSelector(); - } - buttonAttributes.OverlayImageAttributes.Border.All = value; - RelayoutRequest(); - } + Style.IsSelectable = value; } } - /// - /// Text string in Button. - /// - /// 6 - public string Text - { - get - { - return buttonAttributes?.TextAttributes?.Text?.All; - } - set - { - if (value != null) - { - CreateTextAttributes(); - if(buttonAttributes.TextAttributes.Text == null) - { - buttonAttributes.TextAttributes.Text = new StringSelector(); - } - buttonAttributes.TextAttributes.Text.All = value; - RelayoutRequest(); - } - } - } /// /// Translate text string in Button. /// @@ -321,23 +237,21 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.TranslatableText?.All; + return Style?.Text?.TranslatableText?.All; } set { if (value != null) { - CreateTextAttributes(); - if (buttonAttributes.TextAttributes.TranslatableText == null) + if (Style.Text.TranslatableText == null) { - buttonAttributes.TextAttributes.TranslatableText = new StringSelector(); + Style.Text.TranslatableText = new Selector(); } - buttonAttributes.TextAttributes.TranslatableText.All = value; - - RelayoutRequest(); + Style.Text.TranslatableText.All = value; } } } + /// /// Text point size in Button. /// @@ -346,19 +260,18 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.PointSize?.All ?? 0; + return Style?.Text?.PointSize?.All ?? 0; } set { - CreateTextAttributes(); - if (buttonAttributes.TextAttributes.PointSize == null) + if (Style.Text.PointSize == null) { - buttonAttributes.TextAttributes.PointSize = new FloatSelector(); + Style.Text.PointSize = new Selector(); } - buttonAttributes.TextAttributes.PointSize.All = value; - RelayoutRequest(); + Style.Text.PointSize.All = value; } } + /// /// Text font family in Button. /// @@ -367,13 +280,11 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.FontFamily; + return Style?.Text?.FontFamily.All; } set { - CreateTextAttributes(); - buttonAttributes.TextAttributes.FontFamily = value; - RelayoutRequest(); + Style.Text.FontFamily = value; } } /// @@ -384,17 +295,15 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.TextColor?.All; + return Style?.Text?.TextColor?.All; } set { - CreateTextAttributes(); - if (buttonAttributes.TextAttributes.TextColor == null) + if (Style.Text.TextColor == null) { - buttonAttributes.TextAttributes.TextColor = new ColorSelector(); + Style.Text.TextColor = new Selector(); } - buttonAttributes.TextAttributes.TextColor.All = value; - RelayoutRequest(); + Style.Text.TextColor.All = value; } } /// @@ -405,13 +314,11 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center; + return Style?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center; } set { - CreateTextAttributes(); - buttonAttributes.TextAttributes.HorizontalAlignment = value; - RelayoutRequest(); + Style.Text.HorizontalAlignment = value; } } /// @@ -422,19 +329,17 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.IconAttributes?.ResourceURL?.All; + return Style?.Icon?.ResourceUrl?.All; } set { if (value != null) { - CreateIconAttributes(); - if (buttonAttributes.IconAttributes.ResourceURL == null) + if (Style.Icon.ResourceUrl == null) { - buttonAttributes.IconAttributes.ResourceURL = new StringSelector(); + Style.Icon.ResourceUrl = new Selector(); } - buttonAttributes.IconAttributes.ResourceURL.All = value; - RelayoutRequest(); + Style.Icon.ResourceUrl.All = value; } } } @@ -446,15 +351,13 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.Text; + return (StringSelector)Style?.Text?.Text; } set { if (value != null) { - CreateTextAttributes(); - buttonAttributes.TextAttributes.Text = value.Clone() as StringSelector; - RelayoutRequest(); + Style.Text.Text = value.Clone() as StringSelector; } } } @@ -466,18 +369,17 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.TranslatableText; + return (StringSelector)Style?.Text?.TranslatableText; } set { if (value != null) { - CreateTextAttributes(); - buttonAttributes.TextAttributes.TranslatableText = value.Clone() as StringSelector; - RelayoutRequest(); + Style.Text.TranslatableText = value.Clone() as StringSelector; } } } + /// /// Text color selector in Button. /// @@ -486,18 +388,17 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.TextColor; + return (ColorSelector)Style?.Text?.TextColor; } set { if(value != null) { - CreateTextAttributes(); - buttonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector; - RelayoutRequest(); + Style.Text.TextColor = value.Clone() as ColorSelector; } } } + /// /// Text font size selector in Button. /// @@ -506,18 +407,17 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.TextAttributes?.PointSize; + return (FloatSelector)Style?.Text?.PointSize; } set { if (value != null) { - CreateTextAttributes(); - buttonAttributes.TextAttributes.PointSize = value.Clone() as FloatSelector; - RelayoutRequest(); + Style.Text.PointSize = value.Clone() as FloatSelector; } } } + /// /// Icon image's resource url selector in Button. /// @@ -526,201 +426,101 @@ namespace Tizen.NUI.Components { get { - return buttonAttributes?.IconAttributes?.ResourceURL; + return (StringSelector)Style?.Icon?.ResourceUrl; } set { if (value != null) { - CreateIconAttributes(); - buttonAttributes.IconAttributes.ResourceURL = value.Clone() as StringSelector; - RelayoutRequest(); - } - } - } - /// - /// Background image's resource url selector in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector BackgroundImageURLSelector - { - get - { - return buttonAttributes?.BackgroundImageAttributes?.ResourceURL; - } - set - { - if (value != null) - { - CreateBackgroundAttributes(); - buttonAttributes.BackgroundImageAttributes.ResourceURL = value.Clone() as StringSelector; - RelayoutRequest(); + Style.Icon.ResourceUrl = value.Clone() as StringSelector; } } } + /// - /// Background image's border selector in Button. + /// Flag to decide selected state in Button. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public RectangleSelector BackgroundImageBorderSelector + public bool IsSelected { get { - return buttonAttributes?.BackgroundImageAttributes?.Border; + return (bool)GetValue(IsSelectedProperty); } set { - if (value != null) - { - CreateBackgroundAttributes(); - buttonAttributes.BackgroundImageAttributes.Border = value.Clone() as RectangleSelector; - RelayoutRequest(); - } + SetValue(IsSelectedProperty, value); } } - /// - /// Shadow image's resource url selector in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector ShadowImageURLSelector + private bool privateIsSelected { get { - return buttonAttributes?.ShadowImageAttributes?.ResourceURL; + return isSelected; } set { - if (value != null) - { - CreateShadowAttributes(); - buttonAttributes.ShadowImageAttributes.ResourceURL = value.Clone() as StringSelector; - RelayoutRequest(); - } + isSelected = value; + UpdateState(); } } /// - /// Shadow image's border selector in Button. + /// Flag to decide enable or disable in Button. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public RectangleSelector ShadowImageBorderSelector + public bool IsEnabled { get { - return buttonAttributes?.ShadowImageAttributes?.Border; + return (bool)GetValue(IsEnabledProperty); } set { - if (value != null) - { - CreateShadowAttributes(); - buttonAttributes.ShadowImageAttributes.Border = value.Clone() as RectangleSelector; - RelayoutRequest(); - } + SetValue(IsEnabledProperty, value); } } - /// - /// Overlay image's resource url selector in Button. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public StringSelector OverlayImageURLSelector + private bool privateIsEnabled { get { - return buttonAttributes?.OverlayImageAttributes?.ResourceURL; + return isEnabled; } set { - if (value != null) - { - CreateOverlayAttributes(); - buttonAttributes.OverlayImageAttributes.ResourceURL = value.Clone() as StringSelector; - RelayoutRequest(); - } + isEnabled = value; + UpdateState(); } } + /// - /// Overlay image's border selector in Button. + /// Icon relative orientation in Button, work only when show icon and text. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public RectangleSelector OverlayImageBorderSelector - { - get - { - return buttonAttributes?.OverlayImageAttributes?.Border; - } - set - { - if (value != null) - { - CreateOverlayAttributes(); - buttonAttributes.OverlayImageAttributes.Border = value.Clone() as RectangleSelector; - RelayoutRequest(); - } - } - } - /// - /// Flag to decide selected state in Button. - /// - /// 6 - public bool IsSelected - { - get - { - return isSelected; - } - set - { - isSelected = value; - UpdateState(); - } - } - /// - /// Flag to decide enable or disable in Button. - /// - /// 6 - public bool IsEnabled + public IconOrientation? IconRelativeOrientation { get { - return isEnabled; + return (IconOrientation?)GetValue(IconRelativeOrientationProperty); } set { - isEnabled = value; - UpdateState(); + SetValue(IconRelativeOrientationProperty, value); } } - - /// - /// Icon relative orientation in Button, work only when show icon and text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public IconOrientation? IconRelativeOrientation + private IconOrientation? privateIconRelativeOrientation { get { - return buttonAttributes?.IconRelativeOrientation; + return Style?.IconRelativeOrientation; } set { - if(buttonAttributes != null && buttonAttributes.IconRelativeOrientation != value) + if(Style != null && Style.IconRelativeOrientation != value) { - buttonAttributes.IconRelativeOrientation = value; - RelayoutRequest(); + Style.IconRelativeOrientation = value; + UpdateUIContent(); } } } @@ -733,25 +533,13 @@ namespace Tizen.NUI.Components { get { - if (null == buttonAttributes || null == buttonAttributes.IconAttributes) - { - return null; - } - else - { - return new Extents((ushort)buttonAttributes.IconAttributes.PaddingLeft, (ushort)buttonAttributes.IconAttributes.PaddingRight, (ushort)buttonAttributes.IconAttributes.PaddingTop, (ushort)buttonAttributes.IconAttributes.PaddingBottom); - } + return Style.Icon.Padding; } set { if (null != value) { - CreateIconAttributes(); - buttonAttributes.IconAttributes.PaddingLeft = value.Start; - buttonAttributes.IconAttributes.PaddingRight = value.End; - buttonAttributes.IconAttributes.PaddingTop = value.Top; - buttonAttributes.IconAttributes.PaddingBottom = value.Bottom; - RelayoutRequest(); + Style.Icon.Padding.CopyFrom(value); } } } @@ -764,25 +552,13 @@ namespace Tizen.NUI.Components { get { - if (null == buttonAttributes || null == buttonAttributes.TextAttributes) - { - return null; - } - else - { - return new Extents((ushort)buttonAttributes.TextAttributes.PaddingLeft, (ushort)buttonAttributes.TextAttributes.PaddingRight, (ushort)buttonAttributes.TextAttributes.PaddingTop, (ushort)buttonAttributes.TextAttributes.PaddingBottom); - } + return Style.Text.Padding; } set { if (null != value) { - CreateTextAttributes(); - buttonAttributes.TextAttributes.PaddingLeft = value.Start; - buttonAttributes.TextAttributes.PaddingRight = value.End; - buttonAttributes.TextAttributes.PaddingTop = value.Top; - buttonAttributes.TextAttributes.PaddingBottom = value.Bottom; - RelayoutRequest(); + Style.Text.Padding.CopyFrom(value); } } } @@ -814,14 +590,6 @@ namespace Tizen.NUI.Components { Utility.Dispose(overlayImage); } - if (backgroundImage != null) - { - Utility.Dispose(backgroundImage); - } - if (shadowImage != null) - { - Utility.Dispose(shadowImage); - } } base.Dispose(type); @@ -852,7 +620,7 @@ namespace Tizen.NUI.Components if (key.KeyPressedName == "Return") { isPressed = false; - if (buttonAttributes.IsSelectable != null && buttonAttributes.IsSelectable == true) + if (Style.IsSelectable != null && Style.IsSelectable == true) { isSelected = !isSelected; } @@ -914,7 +682,7 @@ namespace Tizen.NUI.Components public override bool OnTouch(Touch touch) { PointStateType state = touch.GetState(0); - + switch(state) { case PointStateType.Down: @@ -927,7 +695,7 @@ namespace Tizen.NUI.Components return true; case PointStateType.Up: isPressed = false; - if (buttonAttributes.IsSelectable != null && buttonAttributes.IsSelectable == true) + if (Style.IsSelectable != null && Style.IsSelectable == true) { isSelected = !isSelected; } @@ -938,55 +706,18 @@ namespace Tizen.NUI.Components } return base.OnTouch(touch); } - /// - /// Get Button attribues. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() - { - return new ButtonAttributes(); - } - /// - /// Update Button by attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override void OnUpdate() + public override void ApplyStyle(ViewStyle viewStyle) { - if (buttonAttributes.ShadowImageAttributes != null) - { - if(shadowImage == null) - { - shadowImage = new ImageView() - { - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent - }; - this.Add(shadowImage); - } - ApplyAttributes(shadowImage, buttonAttributes.ShadowImageAttributes); - } + base.ApplyStyle(viewStyle); - if (buttonAttributes.BackgroundImageAttributes != null) - { - if(backgroundImage == null) - { - backgroundImage = new ImageView() - { - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent - }; - this.Add(backgroundImage); - } - ApplyAttributes(backgroundImage, buttonAttributes.BackgroundImageAttributes); - } + ButtonStyle buttonStyle = viewStyle as ButtonStyle; - if (buttonAttributes.OverlayImageAttributes != null) + if (null != buttonStyle) { - if(overlayImage == null) + if (null == overlayImage) { overlayImage = new ImageView() { @@ -995,34 +726,35 @@ namespace Tizen.NUI.Components }; this.Add(overlayImage); } - ApplyAttributes(overlayImage, buttonAttributes.OverlayImageAttributes); - } - if (buttonAttributes.TextAttributes != null) - { - if(buttonText == null) + if (null == buttonText) { buttonText = new TextLabel(); this.Add(buttonText); } - ApplyAttributes(buttonText, buttonAttributes.TextAttributes); - } - if (buttonAttributes.IconAttributes != null) - { - if(buttonIcon == null) + if (null == buttonIcon) { buttonIcon = new ImageView(); buttonIcon.Relayout += OnIconRelayout; this.Add(buttonIcon); } - ApplyAttributes(buttonIcon, buttonAttributes.IconAttributes); - } - MeasureText(); - LayoutChild(); + overlayImage.ApplyStyle(buttonStyle.Overlay); + buttonText.ApplyStyle(buttonStyle.Text); + buttonIcon.ApplyStyle(buttonStyle.Icon); + } + } - Sensitive = isEnabled ? true : false; + /// + /// Get Button attribues. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override ViewStyle GetViewStyle() + { + return new ButtonStyle(); } /// @@ -1033,7 +765,7 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected void UpdateState() { - ControlStates sourceState = State; + ControlStates sourceState = ControlState; ControlStates targetState; if(isEnabled) @@ -1044,9 +776,10 @@ namespace Tizen.NUI.Components { targetState = IsSelected ? ControlStates.DisabledSelected : (IsFocused ? ControlStates.DisabledFocused : ControlStates.Disabled); } + if(sourceState != targetState) { - State = targetState; + ControlState = targetState; OnUpdate(); @@ -1058,19 +791,14 @@ namespace Tizen.NUI.Components stateChangeHander?.Invoke(this, e); } } + /// /// It is hijack by using protected, attributes copy problem when class inherited from Button. /// /// 6 private void Initialize() { - buttonAttributes = attributes as ButtonAttributes; - if (buttonAttributes == null) - { - throw new Exception("Button attribute parse error."); - } - - ApplyAttributes(this, buttonAttributes); + UpdateState(); LayoutDirectionChanged += OnLayoutDirectionChanged; } @@ -1082,30 +810,30 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void MeasureText() { - if (buttonAttributes.IconRelativeOrientation == null || buttonIcon == null || buttonText == null) + if (Style.IconRelativeOrientation == null || buttonIcon == null || buttonText == null) { return; } buttonText.WidthResizePolicy = ResizePolicyType.Fixed; buttonText.HeightResizePolicy = ResizePolicyType.Fixed; - int textPaddingLeft = buttonAttributes.TextAttributes.PaddingLeft; - int textPaddingRight = buttonAttributes.TextAttributes.PaddingRight; - int textPaddingTop = buttonAttributes.TextAttributes.PaddingTop; - int textPaddingBottom = buttonAttributes.TextAttributes.PaddingBottom; + int textPaddingStart = Style.Text.Padding.Start; + int textPaddingEnd = Style.Text.Padding.End; + int textPaddingTop = Style.Text.Padding.Top; + int textPaddingBottom = Style.Text.Padding.Bottom; - int iconPaddingLeft = buttonAttributes.IconAttributes.PaddingLeft; - int iconPaddingRight = buttonAttributes.IconAttributes.PaddingRight; - int iconPaddingTop = buttonAttributes.IconAttributes.PaddingTop; - int iconPaddingBottom = buttonAttributes.IconAttributes.PaddingBottom; + int iconPaddingStart = Style.Icon.Padding.Start; + int iconPaddingEnd = Style.Icon.Padding.End; + int iconPaddingTop = Style.Icon.Padding.Top; + int iconPaddingBottom = Style.Icon.Padding.Bottom; if (IconRelativeOrientation == IconOrientation.Top || IconRelativeOrientation == IconOrientation.Bottom) { - buttonText.SizeWidth = SizeWidth - textPaddingLeft - textPaddingRight; + buttonText.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd; buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom - iconPaddingTop - iconPaddingBottom - buttonIcon.SizeHeight; } else { - buttonText.SizeWidth = SizeWidth - textPaddingLeft - textPaddingRight - iconPaddingLeft - iconPaddingRight - buttonIcon.SizeWidth; + buttonText.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd - iconPaddingStart - iconPaddingEnd - buttonIcon.SizeWidth; buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom; } } @@ -1117,20 +845,20 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void LayoutChild() { - if (buttonAttributes.IconRelativeOrientation == null || buttonIcon == null || buttonText == null) + if (Style.IconRelativeOrientation == null || buttonIcon == null || buttonText == null) { return; } - int textPaddingLeft = buttonAttributes.TextAttributes.PaddingLeft; - int textPaddingRight = buttonAttributes.TextAttributes.PaddingRight; - int textPaddingTop = buttonAttributes.TextAttributes.PaddingTop; - int textPaddingBottom = buttonAttributes.TextAttributes.PaddingBottom; + int textPaddingStart = Style.Text.Padding.Start; + int textPaddingEnd = Style.Text.Padding.End; + int textPaddingTop = Style.Text.Padding.Top; + int textPaddingBottom = Style.Text.Padding.Bottom; - int iconPaddingLeft = buttonAttributes.IconAttributes.PaddingLeft; - int iconPaddingRight = buttonAttributes.IconAttributes.PaddingRight; - int iconPaddingTop = buttonAttributes.IconAttributes.PaddingTop; - int iconPaddingBottom = buttonAttributes.IconAttributes.PaddingBottom; + int iconPaddingStart = Style.Icon.Padding.Start; + int iconPaddingEnd = Style.Icon.Padding.End; + int iconPaddingTop = Style.Icon.Padding.Top; + int iconPaddingBottom = Style.Icon.Padding.Bottom; switch (IconRelativeOrientation) { @@ -1162,24 +890,24 @@ namespace Tizen.NUI.Components buttonIcon.PositionUsesPivotPoint = true; buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft; buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft; - buttonIcon.Position2D = new Position2D(iconPaddingLeft, 0); + buttonIcon.Position2D = new Position2D(iconPaddingStart, 0); buttonText.PositionUsesPivotPoint = true; buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight; buttonText.PivotPoint = NUI.PivotPoint.CenterRight; - buttonText.Position2D = new Position2D(-textPaddingRight, 0); + buttonText.Position2D = new Position2D(-textPaddingEnd, 0); } else { buttonIcon.PositionUsesPivotPoint = true; buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight; buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight; - buttonIcon.Position2D = new Position2D(-iconPaddingLeft, 0); + buttonIcon.Position2D = new Position2D(-iconPaddingStart, 0); buttonText.PositionUsesPivotPoint = true; buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft; buttonText.PivotPoint = NUI.PivotPoint.CenterLeft; - buttonText.Position2D = new Position2D(textPaddingRight, 0); + buttonText.Position2D = new Position2D(textPaddingEnd, 0); } break; @@ -1189,24 +917,24 @@ namespace Tizen.NUI.Components buttonIcon.PositionUsesPivotPoint = true; buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft; buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft; - buttonIcon.Position2D = new Position2D(iconPaddingRight, 0); + buttonIcon.Position2D = new Position2D(iconPaddingEnd, 0); buttonText.PositionUsesPivotPoint = true; buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight; buttonText.PivotPoint = NUI.PivotPoint.CenterRight; - buttonText.Position2D = new Position2D(-textPaddingLeft, 0); + buttonText.Position2D = new Position2D(-textPaddingStart, 0); } else { buttonIcon.PositionUsesPivotPoint = true; buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight; buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight; - buttonIcon.Position2D = new Position2D(-iconPaddingRight, 0); + buttonIcon.Position2D = new Position2D(-iconPaddingEnd, 0); buttonText.PositionUsesPivotPoint = true; buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft; buttonText.PivotPoint = NUI.PivotPoint.CenterLeft; - buttonText.Position2D = new Position2D(textPaddingLeft, 0); + buttonText.Position2D = new Position2D(textPaddingStart, 0); } break; default: @@ -1221,107 +949,39 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) { - ButtonAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as ButtonAttributes; - if(tempAttributes != null) + ButtonStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as ButtonStyle; + if (tempAttributes != null) { - attributes = buttonAttributes = tempAttributes; - RelayoutRequest(); + Style.CopyFrom(tempAttributes); + UpdateUIContent(); } } - private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e) + private void UpdateUIContent() { MeasureText(); LayoutChild(); - } - private void OnClick(ClickEventArgs eventArgs) - { - ClickEvent?.Invoke(this, eventArgs); + Sensitive = isEnabled; } - private void OnIconRelayout(object sender, EventArgs e) + private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e) { MeasureText(); LayoutChild(); } - private void CreateBackgroundAttributes() - { - if (buttonAttributes.BackgroundImageAttributes == null) - { - buttonAttributes.BackgroundImageAttributes = new ImageAttributes() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.Center, - PivotPoint = Tizen.NUI.PivotPoint.Center, - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent - }; - } - } - - private void CreateShadowAttributes() - { - if (buttonAttributes.ShadowImageAttributes == null) - { - buttonAttributes.ShadowImageAttributes = new ImageAttributes() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.Center, - PivotPoint = Tizen.NUI.PivotPoint.Center, - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent - }; - } - } - - private void CreateOverlayAttributes() + private void OnClick(ClickEventArgs eventArgs) { - if (buttonAttributes.OverlayImageAttributes == null) - { - buttonAttributes.OverlayImageAttributes = new ImageAttributes() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.Center, - PivotPoint = Tizen.NUI.PivotPoint.Center, - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent - }; - } + ClickEvent?.Invoke(this, eventArgs); } - private void CreateTextAttributes() + private void OnIconRelayout(object sender, EventArgs e) { - if (buttonAttributes.TextAttributes == null) - { - buttonAttributes.TextAttributes = new TextAttributes() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.Center, - PivotPoint = Tizen.NUI.PivotPoint.Center, - WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent, - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center - }; - } + MeasureText(); + LayoutChild(); } - private void CreateIconAttributes() - { - if (buttonAttributes.IconAttributes == null) - { - buttonAttributes.IconAttributes = new ImageAttributes() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.Center, - PivotPoint = Tizen.NUI.PivotPoint.Center, - WidthResizePolicy = ResizePolicyType.UseNaturalSize, - HeightResizePolicy = ResizePolicyType.UseNaturalSize, - }; - } - } /// /// ClickEventArgs is a class to record button click event arguments which will sent to user. /// diff --git a/src/Tizen.NUI.Components/Controls/CheckBox.cs b/src/Tizen.NUI.Components/Controls/CheckBox.cs index d798689..7418756 100755 --- a/src/Tizen.NUI.Components/Controls/CheckBox.cs +++ b/src/Tizen.NUI.Components/Controls/CheckBox.cs @@ -43,7 +43,7 @@ namespace Tizen.NUI.Components /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public CheckBox(SelectButtonAttributes attrs) : base(attrs) { } + public CheckBox(SelectButtonStyle attrs) : base(attrs) { } /// /// Get CheckBoxGroup to which this CheckBox belong. diff --git a/src/Tizen.NUI.Components/Controls/Control.cs b/src/Tizen.NUI.Components/Controls/Control.cs index 287db8e..0f361d5 100755 --- a/src/Tizen.NUI.Components/Controls/Control.cs +++ b/src/Tizen.NUI.Components/Controls/Control.cs @@ -27,7 +27,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public abstract class Control : VisualView + public class Control : VisualView { /// /// Control style. @@ -36,17 +36,17 @@ namespace Tizen.NUI.Components /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] protected string style; - /// - /// Control attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected Attributes attributes; private TapGestureDetector tapGestureDetector = new TapGestureDetector(); private bool isFocused = false; + internal ImageView backgroundImage; + internal ImageView shadowImage; + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ControlStyle Style => ViewStyle as ControlStyle; + /// /// Construct an empty Control. /// @@ -65,10 +65,9 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Control(Attributes attributes) : base() + public Control(ControlStyle controlStyle) : base(controlStyle) { Initialize(null); - this.attributes = attributes.Clone(); } /// @@ -83,264 +82,77 @@ namespace Tizen.NUI.Components Initialize(style); } - /// - /// Get/Set the control state. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public new ControlStates State - { - get; - set; - } - /// - /// Whether focusable when touch - /// - /// 6 - internal bool StateFocusableOnTouchMode - { - get; - set; - } - - internal bool IsFocused + public new Selector BackgroundImage { get { - return isFocused || HasFocus(); + return Style.Background.ResourceUrl; } - } - /// - /// Apply attributes for View, Image or TextLabel. - /// - /// View which will be applied attrs - /// Attributes for View, Image or TextLabel - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected void ApplyAttributes(View view, ViewAttributes attrs) - { - if (view == null || attrs == null) + set { - return; + Style.Background.ResourceUrl = value; } + } - if (attrs.Position != null) - { - view.Position = attrs.Position; - } - if (attrs.Size != null) - { - view.Size = attrs.Size; - } - if (attrs.MinimumSize != null) - { - view.MinimumSize = attrs.MinimumSize; - } - if (attrs.BackgroundColor?.GetValue(State) != null) - { - view.BackgroundColor = attrs.BackgroundColor.GetValue(State); - } - if (attrs.PositionUsesPivotPoint != null) - { - view.PositionUsesPivotPoint = attrs.PositionUsesPivotPoint.Value; - } - if (attrs.ParentOrigin != null) - { - view.ParentOrigin = attrs.ParentOrigin; - } - if (attrs.PivotPoint != null) - { - view.PivotPoint = attrs.PivotPoint; - } - if (attrs.WidthResizePolicy!= null) + public Selector BackgroundBorder + { + get { - view.WidthResizePolicy = attrs.WidthResizePolicy.Value; + return Style.Background.Border; } - if (attrs.HeightResizePolicy != null) + set { - view.HeightResizePolicy = attrs.HeightResizePolicy.Value; + Style.Background.Border = value; } - if (attrs.SizeModeFactor != null) + } + + public Selector ShadowImage + { + get { - view.SizeModeFactor = attrs.SizeModeFactor; + return Style.Shadow.ResourceUrl; } - if (attrs.Opacity?.GetValue(State) != null) + set { - view.Opacity = attrs.Opacity.GetValue(State).Value; + Style.Shadow.ResourceUrl = value; } + } - ImageView image = view as ImageView; - ImageAttributes imageAttrs = attrs as ImageAttributes; - if (image != null && imageAttrs != null) + public Selector ShadowImageBorder + { + get { - if (imageAttrs.ResourceURL?.GetValue(State) != null) - { - image.ResourceUrl = imageAttrs.ResourceURL.GetValue(State); - } - if (imageAttrs.Border?.GetValue(State) != null) - { - image.Border = imageAttrs.Border.GetValue(State); - } - + return Style.Shadow.Border; } - - TextLabel text = view as TextLabel; - TextAttributes textAttrs = attrs as TextAttributes; - if (text != null && textAttrs != null) + set { - if (textAttrs.Text?.GetValue(State) != null ) - { - text.Text = textAttrs.Text.GetValue(State); - } - if (textAttrs.TranslatableText?.GetValue(State) != null) - { - text.TranslatableText = textAttrs.TranslatableText.GetValue(State); - } - if (textAttrs.MultiLine != null) - { - text.MultiLine = textAttrs.MultiLine.Value; - } - if (textAttrs.HorizontalAlignment != null) - { - text.HorizontalAlignment = textAttrs.HorizontalAlignment.Value; - } - if (textAttrs.VerticalAlignment != null) - { - text.VerticalAlignment = textAttrs.VerticalAlignment.Value; - } - if (textAttrs.EnableMarkup != null) - { - text.EnableMarkup = textAttrs.EnableMarkup.Value; - } - if (textAttrs.AutoScrollLoopCount != null) - { - text.AutoScrollLoopCount = textAttrs.AutoScrollLoopCount.Value; - } - if (textAttrs.AutoScrollSpeed != null) - { - text.AutoScrollSpeed = textAttrs.AutoScrollSpeed.Value; - } - if (textAttrs.AutoScrollGap != null) - { - text.AutoScrollGap = textAttrs.AutoScrollGap.Value; - } - if (textAttrs.AutoScrollLoopDelay != null) - { - text.AutoScrollLoopDelay = textAttrs.AutoScrollLoopDelay.Value; - } - if (textAttrs.AutoScrollStopMode != null) - { - text.AutoScrollStopMode = textAttrs.AutoScrollStopMode.Value; - } - if (textAttrs.LineSpacing != null) - { - text.LineSpacing = textAttrs.LineSpacing.Value; - } - if (textAttrs.TextColor?.GetValue(State) != null) - { - text.TextColor = textAttrs.TextColor.GetValue(State); - } - if (textAttrs.FontFamily != null) - { - text.FontFamily = textAttrs.FontFamily; - } - if (textAttrs.PointSize?.GetValue(State) != null) - { - text.PointSize = textAttrs.PointSize.GetValue(State).Value; - } + Style.Shadow.Border = value; + } + } - int thickness = 0; + internal void ApplyAttributes(View view, ViewStyle viewStyle) + { + view.CopyFrom(viewStyle); + } - if (textAttrs.OutstrokeThickness?.GetValue(State) != null) - { - thickness = textAttrs.OutstrokeThickness.GetValue(State).Value; - } - if (textAttrs.OutstrokeColor?.GetValue(State) != null) - { - Color outstrokeColor = textAttrs.OutstrokeColor.GetValue(State); - PropertyMap outlineMap = new PropertyMap(); - outlineMap.Add("color", new PropertyValue(new Color(outstrokeColor.R, outstrokeColor.G, outstrokeColor.B, outstrokeColor.A))); - outlineMap.Add("width", new PropertyValue(thickness)); - text.Outline = outlineMap; - } - else - { - text.Outline = new PropertyMap(); - } - } + /// + /// Whether focusable when touch + /// + /// 6 + internal bool StateFocusableOnTouchMode + { + get; + set; + } - TextField textField = view as TextField; - TextFieldAttributes textFieldAttrs = attrs as TextFieldAttributes; - if (textField != null && textFieldAttrs != null) + internal bool IsFocused + { + get { - if (textFieldAttrs.Text?.GetValue(State) != null) - { - textField.Text = textFieldAttrs.Text.GetValue(State); - } - if (textFieldAttrs.PlaceholderText?.GetValue(State) != null) - { - textField.PlaceholderText = textFieldAttrs.PlaceholderText.GetValue(State); - } - if (textFieldAttrs.TranslatablePlaceholderText?.GetValue(State) != null) - { - textField.TranslatablePlaceholderText = textFieldAttrs.TranslatablePlaceholderText.GetValue(State); - } - if (textFieldAttrs.HorizontalAlignment != null) - { - textField.HorizontalAlignment = textFieldAttrs.HorizontalAlignment.Value; - } - if (textFieldAttrs.VerticalAlignment != null) - { - textField.VerticalAlignment = textFieldAttrs.VerticalAlignment.Value; - } - if (textFieldAttrs.EnableMarkup != null) - { - textField.EnableMarkup = textFieldAttrs.EnableMarkup.Value; - } - if (textFieldAttrs.TextColor?.GetValue(State) != null) - { - textField.TextColor = textFieldAttrs.TextColor.GetValue(State); - } - if (textFieldAttrs.PlaceholderTextColor?.GetValue(State) != null) - { - textField.PlaceholderTextColor = textFieldAttrs.PlaceholderTextColor.GetValue(State); - } - if (textFieldAttrs.PrimaryCursorColor?.GetValue(State) != null) - { - textField.PrimaryCursorColor = textFieldAttrs.PrimaryCursorColor.GetValue(State); - } - if (textFieldAttrs.SecondaryCursorColor?.GetValue(State) != null) - { - textField.SecondaryCursorColor = textFieldAttrs.SecondaryCursorColor.GetValue(State); - } - if (textFieldAttrs.FontFamily != null) - { - textField.FontFamily = textFieldAttrs.FontFamily; - } - if (textFieldAttrs.PointSize?.GetValue(State) != null) - { - textField.PointSize = textFieldAttrs.PointSize.GetValue(State).Value; - } - if (textFieldAttrs.EnableCursorBlink != null) - { - textField.EnableCursorBlink = textFieldAttrs.EnableCursorBlink.Value; - } - if (textFieldAttrs.EnableSelection != null) - { - textField.EnableSelection = textFieldAttrs.EnableSelection.Value; - } - if (textFieldAttrs.CursorWidth != null) - { - textField.CursorWidth = textFieldAttrs.CursorWidth.Value; - } - if (textFieldAttrs.EnableEllipsis != null) - { - textField.Ellipsis = textFieldAttrs.EnableEllipsis.Value; - } + return isFocused || HasFocus(); } } + /// /// Dispose Control and all children on it. /// @@ -361,15 +173,19 @@ namespace Tizen.NUI.Components tapGestureDetector.Detected -= OnTapGestureDetected; tapGestureDetector.Detach(this); } + + if (backgroundImage != null) + { + Utility.Dispose(backgroundImage); + } + if (shadowImage != null) + { + Utility.Dispose(shadowImage); + } + base.Dispose(type); } - /// - /// Get attribues, it is abstract function and must be override. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected abstract Attributes GetAttributes(); + /// /// Called after a key event is received by the view that has had its focus set. /// @@ -421,6 +237,36 @@ namespace Tizen.NUI.Components isFocused = false; } + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override void ApplyStyle(ViewStyle viewStyle) + { + base.ApplyStyle(viewStyle); + + ControlStyle controlStyle = viewStyle as ControlStyle; + + if (null != controlStyle?.Shadow) + { + if (null == shadowImage) + { + shadowImage = new ImageView(); + this.Add(shadowImage); + } + + shadowImage.ApplyStyle(controlStyle.Shadow); + } + + if (null != controlStyle?.Background) + { + if (null == backgroundImage) + { + backgroundImage = new ImageView(); + this.Add(backgroundImage); + } + backgroundImage.ApplyStyle(controlStyle.Background); + } + } + /// /// Tap gesture callback. /// @@ -467,10 +313,25 @@ namespace Tizen.NUI.Components { } + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual void RegisterDetectionOfSubstyleChanges() + { + + } + + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override ViewStyle GetViewStyle() + { + return new ControlStyle(); + } + private void Initialize(string style) { - attributes = (style == null) ? GetAttributes() : GetAttributes(style); - State = ControlStates.Normal; + ControlState = ControlStates.Normal; + + RegisterDetectionOfSubstyleChanges(); LeaveRequired = true; @@ -482,9 +343,9 @@ namespace Tizen.NUI.Components StyleManager.Instance.ThemeChangedEvent += OnThemeChangedEvent; } - private Attributes GetAttributes(string style) + private ViewStyle GetAttributes(string style) { - Attributes attributes = StyleManager.Instance.GetAttributes(style); + ViewStyle attributes = StyleManager.Instance.GetAttributes(style); if(attributes == null) { throw new InvalidOperationException($"There is no style {style}"); @@ -492,6 +353,5 @@ namespace Tizen.NUI.Components this.style = style; return attributes; } - } } diff --git a/src/Tizen.NUI.Components/Controls/DropDown.cs b/src/Tizen.NUI.Components/Controls/DropDown.cs index bb08a03..71e21f0 100755 --- a/src/Tizen.NUI.Components/Controls/DropDown.cs +++ b/src/Tizen.NUI.Components/Controls/DropDown.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using Tizen.NUI.BaseComponents; using System.ComponentModel; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { @@ -29,6 +30,128 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public class DropDown : Control { + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListPaddingProperty = BindableProperty.Create("ListPadding", typeof(Extents), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateListPadding = (Extents)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateListPadding; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListSizeProperty = BindableProperty.Create("ListSize", typeof(Size), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateListSize = (Size)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateListSize; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create("SelectedItemIndex", typeof(int), typeof(Tizen.NUI.Components.DropDown), 0, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateSelectedItemIndex = (int)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateSelectedItemIndex; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty FocusedItemIndexProperty = BindableProperty.Create("FocusedItemIndex", typeof(int), typeof(Tizen.NUI.Components.DropDown), 0, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateFocusedItemIndex = (int)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateFocusedItemIndex; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListMarginProperty = BindableProperty.Create("ListMargin", typeof(Extents), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateListMargin = (Extents)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateListMargin; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ListRelativeOrientationProperty = BindableProperty.Create("ListRelativeOrientation", typeof(ListOrientation), typeof(Tizen.NUI.Components.DropDown), ListOrientation.Left, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateListRelativeOrientation = (ListOrientation)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateListRelativeOrientation; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SpaceProperty = BindableProperty.Create("Space", typeof(Extents), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateSpace = (Extents)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateSpace; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty SpaceBetweenButtonTextAndIconProperty = BindableProperty.Create("SpaceBetweenButtonTextAndIcon", typeof(int), typeof(Tizen.NUI.Components.DropDown), 0, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + if (newValue != null) + { + instance.privateSpaceBetweenButtonTextAndIcon = (int)newValue; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Tizen.NUI.Components.DropDown)bindable; + return instance.privateSpaceBetweenButtonTextAndIcon; + }); + + #region DropDown private Button button = null; private TextLabel headerText = null; @@ -36,10 +159,15 @@ namespace Tizen.NUI.Components private ImageView listBackgroundImage = null; private FlexibleView list = null; private DropDownListBridge adapter = new DropDownListBridge(); - private DropDownAttributes dropDownAttributes = null; private DropDownItemView touchedView = null; private int selectedItemIndex = -1; + private Extents listPadding = null; + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public new DropDownStyle Style => ViewStyle as DropDownStyle; + /// /// Creates a new instance of a DropDown. /// @@ -48,8 +176,8 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public DropDown() : base() { - Initialize(); } + /// /// Creates a new instance of a DropDown with style. /// @@ -59,8 +187,8 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public DropDown(string style) : base(style) { - Initialize(); } + /// /// Creates a new instance of a DropDown with attributes. /// @@ -68,9 +196,8 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDown(DropDownAttributes attributes) : base(attributes) + public DropDown(DropDownStyle attributes) : base(attributes) { - Initialize(); } /// @@ -114,572 +241,253 @@ namespace Tizen.NUI.Components } /// - /// Header text string in DropDown. + /// Space between button text and button icon in DropDown. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string HeaderText + public int SpaceBetweenButtonTextAndIcon { get { - return dropDownAttributes.HeaderTextAttributes?.Text.All; + return (int)GetValue(SpaceBetweenButtonTextAndIconProperty); } set { - if (value != null) - { - CreateHeaderTextAttributes(); - if (dropDownAttributes.HeaderTextAttributes.Text == null) - { - dropDownAttributes.HeaderTextAttributes.Text = new StringSelector(); - } - dropDownAttributes.HeaderTextAttributes.Text.All = value; - RelayoutRequest(); - } + SetValue(SpaceBetweenButtonTextAndIconProperty, value); } } - - /// - /// Header text point size in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public float HeaderTextPointSize + private int privateSpaceBetweenButtonTextAndIcon { get { - return dropDownAttributes.HeaderTextAttributes?.PointSize?.All ?? 0; + return (int)Style.SpaceBetweenButtonTextAndIcon; } set { - CreateHeaderTextAttributes(); - if (dropDownAttributes.HeaderTextAttributes.PointSize == null) - { - dropDownAttributes.HeaderTextAttributes.PointSize = new FloatSelector(); - } - dropDownAttributes.HeaderTextAttributes.PointSize.All = value; + Style.SpaceBetweenButtonTextAndIcon = value; RelayoutRequest(); } } /// - /// Header text font family in DropDown. + /// Left space in DropDown. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string HeaderTextFontFamily + public Extents Space { get { - return dropDownAttributes.HeaderTextAttributes?.FontFamily; + return (Extents)GetValue(SpaceProperty); } set { - CreateHeaderTextAttributes(); - dropDownAttributes.HeaderTextAttributes.FontFamily = value; - RelayoutRequest(); + SetValue(SpaceProperty, value); } } - - /// - /// Header text color in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Color HeaderTextColor + private Extents privateSpace { get { - return dropDownAttributes.HeaderTextAttributes?.TextColor?.All; + return (Extents)Style.Space; } set { - CreateHeaderTextAttributes(); - if (dropDownAttributes.HeaderTextAttributes.TextColor == null) - { - dropDownAttributes.HeaderTextAttributes.TextColor = new ColorSelector(); - } - dropDownAttributes.HeaderTextAttributes.TextColor.All = value; + Style.Space = value; RelayoutRequest(); } } /// - /// Header text color selector in DropDown. + /// List relative orientation in DropDown. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector HeaderTextColorSelector + public ListOrientation ListRelativeOrientation { get { - return dropDownAttributes.HeaderTextAttributes?.TextColor; + return (ListOrientation)GetValue(ListRelativeOrientationProperty); } set { - CreateHeaderTextAttributes(); - if (value != null) - { - dropDownAttributes.HeaderTextAttributes.TextColor = value.Clone() as ColorSelector; - RelayoutRequest(); - } + SetValue(ListRelativeOrientationProperty, value); } } - - /// - /// Button text string in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string ButtonText + private ListOrientation privateListRelativeOrientation { get { - return dropDownAttributes.ButtonAttributes?.TextAttributes?.Text.All; + return (ListOrientation)Style.ListRelativeOrientation; } set { - if (value != null) - { - CreateButtonTextAttributes(); - if (dropDownAttributes.ButtonAttributes.TextAttributes.Text == null) - { - dropDownAttributes.ButtonAttributes.TextAttributes.Text = new StringSelector(); - } - dropDownAttributes.ButtonAttributes.TextAttributes.Text.All = value; - RelayoutRequest(); - } + Style.ListRelativeOrientation = value; + RelayoutRequest(); } } /// - /// Button text point size in DropDown. + /// Space in list. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public float ButtonTextPointSize + public Extents ListMargin { get { - return dropDownAttributes.ButtonAttributes?.TextAttributes?.PointSize?.All ?? 0; + return (Extents)GetValue(ListMarginProperty); } set { - CreateButtonTextAttributes(); - if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize == null) - { - dropDownAttributes.ButtonAttributes.TextAttributes.PointSize = new FloatSelector(); - } - dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All = value; - RelayoutRequest(); + SetValue(ListMarginProperty, value); } } - - /// - /// Button text font family in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string ButtonTextFontFamily + private Extents privateListMargin { get { - return dropDownAttributes.ButtonAttributes?.TextAttributes?.FontFamily; + return Style.ListMargin; } set { - CreateButtonTextAttributes(); - dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily = value; + Style.ListMargin = value; RelayoutRequest(); } } /// - /// Button text color in DropDown. + /// Focused item index in list. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Color ButtonTextColor + public int FocusedItemIndex { get { - return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor?.All; + return (int)GetValue(FocusedItemIndexProperty); } set { - CreateButtonTextAttributes(); - if (dropDownAttributes.ButtonAttributes.TextAttributes.TextColor == null) - { - dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = new ColorSelector(); - } - dropDownAttributes.ButtonAttributes.TextAttributes.TextColor.All = value; - RelayoutRequest(); + SetValue(FocusedItemIndexProperty, value); } } - - /// - /// Button text color selector in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector ButtonTextColorSelector + private int privateFocusedItemIndex { get { - return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor; + return (int)Style.FocusedItemIndex; } set { - CreateButtonTextAttributes(); - if (value != null) - { - dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector; - RelayoutRequest(); - } + Style.FocusedItemIndex = value; + RelayoutRequest(); } } /// - /// Button icon image's resource url in DropDown. + /// Selected item index in list. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string ButtonIconImageURL + public int SelectedItemIndex { get { - return dropDownAttributes.ButtonAttributes?.IconAttributes?.ResourceURL.All; + return (int)GetValue(SelectedItemIndexProperty); } set { - if (value != null) - { - CreateButtonIconAttributes(); - if (dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL == null) - { - dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL = new StringSelector(); - } - dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL.All = value; - RelayoutRequest(); - } + SetValue(SelectedItemIndexProperty, value); } } - - /// - /// Button icon image's size in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Size ButtonIconSize + private int privateSelectedItemIndex { get { - return dropDownAttributes.ButtonAttributes?.IconAttributes?.Size; + return selectedItemIndex; } set { - if (value != null) + if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount()) { - CreateButtonIconAttributes(); - dropDownAttributes.ButtonAttributes.IconAttributes.Size = value; - RelayoutRequest(); + return; } + UpdateSelectedItem(value); } } /// - /// Space between button text and button icon in DropDown. + /// List size in DropDown. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int SpaceBetweenButtonTextAndIcon + public Size ListSize { get { - return dropDownAttributes.SpaceBetweenButtonTextAndIcon; + return (Size)GetValue(ListSizeProperty); } set { - dropDownAttributes.SpaceBetweenButtonTextAndIcon = value; - RelayoutRequest(); + SetValue(ListSizeProperty, value); } } - - /// - /// Left space in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int LeftSpace + private Size privateListSize { get { - return (int)dropDownAttributes.Space.X; + return Style.ListSize; } set { - dropDownAttributes.Space.X = value; + Style.ListSize = value; RelayoutRequest(); } } /// - /// Right space in DropDown. + /// List padding in DropDown. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int RightSpace + public Extents ListPadding { get { - return (int)dropDownAttributes.Space.Y; + return (Extents)GetValue(ListPaddingProperty); } set { - dropDownAttributes.Space.Y = value; - RelayoutRequest(); + SetValue(ListPaddingProperty, value); } } - - /// - /// List background image's resource url in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string ListBackgroundImageURL + private Extents privateListPadding { get { - return dropDownAttributes.ListBackgroundImageAttributes?.ResourceURL?.All; + return listPadding; } set { - if (value != null) - { - CreateListBackgroundAttributes(); - if (dropDownAttributes.ListBackgroundImageAttributes.ResourceURL == null) - { - dropDownAttributes.ListBackgroundImageAttributes.ResourceURL = new StringSelector(); - } - dropDownAttributes.ListBackgroundImageAttributes.ResourceURL.All = value; - RelayoutRequest(); - } - } - } + Style.ListPadding.CopyFrom(value); - /// - /// List background image's border in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Rectangle ListBackgroundImageBorder - { - get - { - return dropDownAttributes.ListBackgroundImageAttributes?.Border?.All; - } - set - { - if (value != null) + if (null == listPadding) { - CreateListBackgroundAttributes(); - if (dropDownAttributes.ListBackgroundImageAttributes.Border == null) + listPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom) => { - dropDownAttributes.ListBackgroundImageAttributes.Border = new RectangleSelector(); - } - dropDownAttributes.ListBackgroundImageAttributes.Border.All = value; - RelayoutRequest(); + Style.ListPadding.Start = start; + Style.ListPadding.End = end; + Style.ListPadding.Top = top; + Style.ListPadding.Bottom = bottom; + RelayoutRequest(); + }, value.Start, value.End, value.Top, value.Bottom); } - } - } - - /// - /// List relative orientation in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public ListOrientation ListRelativeOrientation - { - get - { - return dropDownAttributes.ListRelativeOrientation; - } - set - { - dropDownAttributes.ListRelativeOrientation = value; - RelayoutRequest(); - } - } - - /// - /// Left space in list. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int ListLeftMargin - { - get - { - return (int)dropDownAttributes.ListMargin.X; - } - set - { - dropDownAttributes.ListMargin.X = value; - RelayoutRequest(); - } - } - - /// - /// Right space in list. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int ListRigthMargin - { - get - { - return (int)dropDownAttributes.ListMargin.Y; - } - set - { - dropDownAttributes.ListMargin.Y = value; - RelayoutRequest(); - } - } - - /// - /// Top space in list. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int ListTopMargin - { - get - { - return (int)dropDownAttributes.ListMargin.Z; - } - set - { - dropDownAttributes.ListMargin.Z = value; - RelayoutRequest(); - } - } - - /// - /// Bottom space in list. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int ListBottomMargin - { - get - { - return (int)dropDownAttributes.ListMargin.W; - } - set - { - dropDownAttributes.ListMargin.W = value; - RelayoutRequest(); - } - } - - /// - /// Focused item index in list. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int FocusedItemIndex - { - get - { - return dropDownAttributes.FocusedItemIndex; - } - set - { - dropDownAttributes.FocusedItemIndex = value; - RelayoutRequest(); - } - } - - /// - /// Selected item index in list. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public int SelectedItemIndex - { - get - { - return selectedItemIndex; - } - set - { - if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount()) + else { - return; + listPadding.CopyFrom(value); } - UpdateSelectedItem(value); - } - } - /// - /// List size in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Size ListSize - { - get - { - return dropDownAttributes.ListSize; - } - set - { - dropDownAttributes.ListSize = value; - RelayoutRequest(); - } - } - - /// - /// List padding in DropDown. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Extents ListPadding - { - get - { - return dropDownAttributes.ListPadding; - } - set - { - dropDownAttributes.ListPadding = value; RelayoutRequest(); } } @@ -691,7 +499,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public void AddItem(DropDownItemData itemData) + public void AddItem(DropDownDataItem itemData) { adapter.InsertData(-1, itemData); } @@ -730,7 +538,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public void InsertItem(DropDownItemData item, int index) + public void InsertItem(DropDownDataItem item, int index) { if (index < 0 || index >= adapter.GetItemCount()) { @@ -776,96 +584,131 @@ namespace Tizen.NUI.Components list.DetachScrollBar(); } - /// - /// Update DropDown by attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected override void OnUpdate() + protected override void RegisterDetectionOfSubstyleChanges() { - if (dropDownAttributes.HeaderTextAttributes != null) + base.RegisterDetectionOfSubstyleChanges(); + + Style.PropertyChanged += DropDownAttributesPropertyChanged; + Style.HeaderText.PropertyChanged += HeaderTextAttributesPropertyChanged; + Style.Button.PropertyChanged += ButtonAttributesPropertyChanged; + + Style.Button.Icon.PropertyChanged += IconStylePropertyChanged; + } + + private void IconStylePropertyChanged(object sender, PropertyChangedEventArgs e) + { + int iconWidth = 0; + int buttonTextWidth = 0; + if (e.PropertyName.Equals(ImageViewStyle.SizeProperty.PropertyName)) { - if (headerText == null) - { - CreateHeaderText(); - } - ApplyAttributes(headerText, dropDownAttributes.HeaderTextAttributes); + iconWidth = (int)Style.Button.Icon.Size.Width; } + if (buttonText.NaturalSize2D != null) + { + buttonTextWidth = buttonText.NaturalSize2D.Width; + } + + button.SizeWidth = iconWidth + (int)Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth; + } - if (dropDownAttributes.ButtonAttributes != null) + private void DropDownAttributesPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName.Equals("Space")) { - if (button == null) - { - CreateButton(); - } - if (dropDownAttributes.Space != null) - { - button.Position2D.X = (int)dropDownAttributes.Space.X; - } + button.Position2D.X = (int)Style.Space.Start; + } + } - if (dropDownAttributes.ButtonAttributes.TextAttributes != null) + private void ButtonAttributesPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (null == button) + { + button = new Button() { - ApplyAttributes(buttonText, dropDownAttributes.ButtonAttributes.TextAttributes); - button.TextSelector = dropDownAttributes.ButtonAttributes.TextAttributes.Text; - if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize != null) - { - button.PointSize = dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All.Value; - } - button.FontFamily = dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily; - button.TextColorSelector = dropDownAttributes.ButtonAttributes.TextAttributes.TextColor; - } - if (dropDownAttributes.ButtonAttributes.IconAttributes != null) + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + HeightResizePolicy = ResizePolicyType.FillToParent, + IconRelativeOrientation = Components.Button.IconOrientation.Right, + }; + button.Name = "DropDownButton"; + button.ClickEvent += ButtonClickEvent; + Add(button); + + button.ApplyStyle(Style.Button); + } + + if (null == buttonText) + { + buttonText = new TextLabel() { - button.IconURLSelector = dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL; - int iconWidth = 0; - int buttonTextWidth = 0; - if (dropDownAttributes.ButtonAttributes.IconAttributes.Size != null) - { - iconWidth = (int)dropDownAttributes.ButtonAttributes.IconAttributes.Size.Width; - } - if (buttonText.NaturalSize2D != null) - { - buttonTextWidth = buttonText.NaturalSize2D.Width; - } - button.SizeWidth = iconWidth + dropDownAttributes.SpaceBetweenButtonTextAndIcon + buttonTextWidth; - } + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.UseNaturalSize, + HeightResizePolicy = ResizePolicyType.FillToParent, + }; + buttonText.Name = "DropDownButtonText"; + Add(buttonText); + buttonText.Hide(); } + } - if (dropDownAttributes.ListBackgroundImageAttributes != null) + private void HeaderTextAttributesPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (null == headerText) + { + headerText = new TextLabel(); + headerText.Name = "DropDownHeaderText"; + Add(headerText); + + headerText.ApplyStyle(Style.HeaderText); + } + } + + /// + /// Update DropDown by attributes. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void OnUpdate() + { + if (Style.ListBackgroundImage != null) { if (listBackgroundImage == null) { CreateListBackgroundImage(); CreateList(); } - ApplyAttributes(listBackgroundImage, dropDownAttributes.ListBackgroundImageAttributes); - list.FocusedItemIndex = dropDownAttributes.FocusedItemIndex; - list.Size = dropDownAttributes.ListSize; - list.Padding = dropDownAttributes.ListPadding; + + int temp = (int)Style.FocusedItemIndex; + list.FocusedItemIndex = temp; + list.Size = Style.ListSize; + list.Padding = Style.ListPadding; int listBackgroundImageX = 0; int listBackgroundImageY = 0; - if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Left) + if (Style.ListRelativeOrientation == ListOrientation.Left) { - if (dropDownAttributes.ListMargin != null) + if (Style.ListMargin != null) { - listBackgroundImageX = (int)dropDownAttributes.ListMargin.X; - listBackgroundImageY = (int)dropDownAttributes.ListMargin.Z; + listBackgroundImageX = (int)Style.ListMargin.Start; + listBackgroundImageY = (int)Style.ListMargin.Top; } } - else if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Right) + else if (Style.ListRelativeOrientation == ListOrientation.Right) { - if (dropDownAttributes.ListMargin != null) + if (Style.ListMargin != null) { int listWidth = 0; if (list.Size2D != null) { listWidth = list.Size2D.Width; } - listBackgroundImageX = Size2D.Width - listWidth - (int)dropDownAttributes.ListMargin.Y; - listBackgroundImageY = (int)dropDownAttributes.ListMargin.Z; + listBackgroundImageX = Size2D.Width - listWidth - (int)Style.ListMargin.End; + listBackgroundImageY = (int)Style.ListMargin.Top; } } listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY); @@ -923,19 +766,9 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() + protected override ViewStyle GetViewStyle() { - return new DropDownAttributes(); - } - - private void Initialize() - { - dropDownAttributes = attributes as DropDownAttributes; - if (dropDownAttributes == null) - { - throw new Exception("DropDown attribute parse error."); - } - ApplyAttributes(this, dropDownAttributes); + return new DropDownStyle(); } private void OnClickEvent(object sender, ItemClickEventArgs e) @@ -943,40 +776,6 @@ namespace Tizen.NUI.Components ItemClickEvent?.Invoke(sender, e); } - private void CreateHeaderText() - { - headerText = new TextLabel(); - headerText.Name = "DropDownHeaderText"; - Add(headerText); - } - - private void CreateButton() - { - button = new Button() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, - PivotPoint = Tizen.NUI.PivotPoint.TopLeft, - HeightResizePolicy = ResizePolicyType.FillToParent, - IconRelativeOrientation = Button.IconOrientation.Right, - }; - button.Name = "DropDownButton"; - button.ClickEvent += ButtonClickEvent; - Add(button); - - buttonText = new TextLabel() - { - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, - PivotPoint = Tizen.NUI.PivotPoint.TopLeft, - WidthResizePolicy = ResizePolicyType.UseNaturalSize, - HeightResizePolicy = ResizePolicyType.FillToParent, - }; - buttonText.Name = "DropDownButtonText"; - Add(buttonText); - buttonText.Hide(); - } - private void CreateList() { list = new FlexibleView(); @@ -1042,7 +841,7 @@ namespace Tizen.NUI.Components { if (selectedItemIndex != -1) { - DropDownItemData data = adapter.GetData(selectedItemIndex); + DropDownDataItem data = adapter.GetData(selectedItemIndex); if(data != null) { data.IsSelected = false; @@ -1056,7 +855,7 @@ namespace Tizen.NUI.Components if (index != -1) { - DropDownItemData data = adapter.GetData(index); + DropDownDataItem data = adapter.GetData(index); if (data != null) { data.IsSelected = true; @@ -1065,7 +864,7 @@ namespace Tizen.NUI.Components if (view != null) { view.IsSelected = true; - button.Text = view.Text; + button.Style.Text.Text = view.Text; } } @@ -1074,16 +873,19 @@ namespace Tizen.NUI.Components private void CreateListBackgroundImage() { - listBackgroundImage = new ImageView + if (null == listBackgroundImage) { - Name = "ListBackgroundImage", - PositionUsesPivotPoint = true, - ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, - PivotPoint = Tizen.NUI.PivotPoint.TopLeft, - WidthResizePolicy = ResizePolicyType.FitToChildren, - HeightResizePolicy = ResizePolicyType.FitToChildren, - }; - Add(listBackgroundImage); + listBackgroundImage = new ImageView + { + Name = "ListBackgroundImage", + PositionUsesPivotPoint = true, + ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, + PivotPoint = Tizen.NUI.PivotPoint.TopLeft, + WidthResizePolicy = ResizePolicyType.FitToChildren, + HeightResizePolicy = ResizePolicyType.FitToChildren, + }; + Add(listBackgroundImage); + } } private void ButtonClickEvent(object sender, Button.ClickEventArgs e) @@ -1093,9 +895,9 @@ namespace Tizen.NUI.Components private void CreateHeaderTextAttributes() { - if (dropDownAttributes.HeaderTextAttributes == null) + if (Style.HeaderText == null) { - dropDownAttributes.HeaderTextAttributes = new TextAttributes() + Style.HeaderText = new TextLabelStyle() { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, @@ -1110,9 +912,9 @@ namespace Tizen.NUI.Components private void CreateButtonAttributes() { - if (dropDownAttributes.ButtonAttributes == null) + if (Style.Button == null) { - dropDownAttributes.ButtonAttributes = new ButtonAttributes(); + Style.Button = new ButtonStyle(); } } @@ -1120,9 +922,9 @@ namespace Tizen.NUI.Components { CreateButtonAttributes(); - if (dropDownAttributes.ButtonAttributes.TextAttributes == null) + if (Style.Button.Text== null) { - dropDownAttributes.ButtonAttributes.TextAttributes = new TextAttributes + Style.Button.Text= new TextLabelStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, @@ -1140,9 +942,9 @@ namespace Tizen.NUI.Components { CreateButtonAttributes(); - if (dropDownAttributes.ButtonAttributes.IconAttributes == null) + if (Style.Button.Icon== null) { - dropDownAttributes.ButtonAttributes.IconAttributes = new ImageAttributes + Style.Button.Icon= new ImageViewStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight, @@ -1153,9 +955,9 @@ namespace Tizen.NUI.Components private void CreateListBackgroundAttributes() { - if (dropDownAttributes.ListBackgroundImageAttributes == null) + if (Style.ListBackgroundImage == null) { - dropDownAttributes.ListBackgroundImageAttributes = new ImageAttributes + Style.ListBackgroundImage = new ImageViewStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, @@ -1187,16 +989,16 @@ namespace Tizen.NUI.Components } #endregion - #region DropDownItemData + #region DropDownDataItem /// - /// DropDownItemData is a class to record all data which will be applied to DropDown item. + /// DropDownDataItem is a class to record all data which will be applied to DropDown item. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public class DropDownItemData + //[EditorBrowsable(EditorBrowsableState.Never)] + public class DropDownDataItem { - private DropDownItemAttributes itemDataAttributes = new DropDownItemAttributes(); + private DropDownItemStyle itemDataStyle = new DropDownItemStyle(); /// /// Creates a new instance of a DropDownItemData. @@ -1204,7 +1006,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownItemData() + public DropDownDataItem() { Initalize(); } @@ -1216,30 +1018,30 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownItemData(string style) + public DropDownDataItem(string style) { if(style != null) { - Attributes attributes = StyleManager.Instance.GetAttributes(style); + ViewStyle attributes = StyleManager.Instance.GetAttributes(style); if(attributes == null) { throw new InvalidOperationException($"There is no style {style}"); } - itemDataAttributes = attributes as DropDownItemAttributes; + itemDataStyle = attributes as DropDownItemStyle; } Initalize(); } /// - /// Creates a new instance of a DropDownItemData with attributes. + /// Creates a new instance of a DropDownItemData with style. /// - /// Create DropDownItemData by attributes customized by user. + /// Create DropDownItemData by style customized by user. /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownItemData(DropDownItemAttributes attributes) + public DropDownDataItem(DropDownItemStyle style) { - itemDataAttributes = attributes.Clone() as DropDownItemAttributes; + itemDataStyle.CopyFrom(style); Initalize(); } @@ -1253,11 +1055,11 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.Size; + return itemDataStyle.Size; } set { - itemDataAttributes.Size = value; + itemDataStyle.Size = value; } } @@ -1267,23 +1069,20 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector BackgroundColorSelector + public Selector BackgroundColorSelector { get { - return itemDataAttributes.BackgroundColor; + return itemDataStyle.BackgroundColor; } set { - if (itemDataAttributes.BackgroundColor == null) - { - itemDataAttributes.BackgroundColor = value.Clone() as ColorSelector; - } - else + if (itemDataStyle.BackgroundColor == null) { - itemDataAttributes.BackgroundColor = value.Clone(); + itemDataStyle.BackgroundColor = new Selector(); } - + + itemDataStyle.BackgroundColor.Clone(value); } } @@ -1297,18 +1096,18 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.TextAttributes?.Text?.All; + return itemDataStyle.Text?.Text?.All; } set { CreateTextAttributes(); - if (itemDataAttributes.TextAttributes.Text == null) + if (itemDataStyle.Text.Text == null) { - itemDataAttributes.TextAttributes.Text = new StringSelector { All = value }; + itemDataStyle.Text.Text = new Selector { All = value }; } else { - itemDataAttributes.TextAttributes.Text.All = value; + itemDataStyle.Text.Text.All = value; } } } @@ -1323,18 +1122,18 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.TextAttributes?.PointSize?.All ?? 0; + return itemDataStyle.Text?.PointSize?.All ?? 0; } set { CreateTextAttributes(); - if (itemDataAttributes.TextAttributes.PointSize == null) + if (itemDataStyle.Text.PointSize == null) { - itemDataAttributes.TextAttributes.PointSize = new FloatSelector { All = value }; + itemDataStyle.Text.PointSize = new Selector { All = value }; } else { - itemDataAttributes.TextAttributes.PointSize.All = value; + itemDataStyle.Text.PointSize.All = value; } } } @@ -1349,12 +1148,13 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.TextAttributes?.FontFamily; + return ""; + //return itemDataAttributes.TextAttributes?.FontFamily?.GetValue(State); } set { CreateTextAttributes(); - itemDataAttributes.TextAttributes.FontFamily = value; + itemDataStyle.Text.FontFamily = value; } } @@ -1368,12 +1168,12 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.TextAttributes?.Position; + return itemDataStyle.Text?.Position; } set { CreateTextAttributes(); - itemDataAttributes.TextAttributes.Position = value; + itemDataStyle.Text.Position = value; } } @@ -1387,18 +1187,18 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.IconAttributes?.ResourceURL?.All; + return itemDataStyle.Icon?.ResourceUrl?.All; } set { CreateIconAttributes(); - if (itemDataAttributes.IconAttributes.ResourceURL == null) + if (itemDataStyle.Icon.ResourceUrl == null) { - itemDataAttributes.IconAttributes.ResourceURL = new StringSelector { All = value }; + itemDataStyle.Icon.ResourceUrl = new Selector { All = value }; } else { - itemDataAttributes.IconAttributes.ResourceURL.All = value; + itemDataStyle.Icon.ResourceUrl.All = value; } } } @@ -1413,12 +1213,12 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.IconAttributes?.Size; + return itemDataStyle.Icon?.Size; } set { CreateIconAttributes(); - itemDataAttributes.IconAttributes.Size = value; + itemDataStyle.Icon.Size = value; } } @@ -1432,12 +1232,12 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.IconAttributes.Position; + return itemDataStyle.Icon.Position; } set { CreateIconAttributes(); - itemDataAttributes.IconAttributes.Position = value; + itemDataStyle.Icon.Position = value; } } @@ -1451,18 +1251,18 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.CheckImageAttributes?.ResourceURL?.All; + return itemDataStyle.CheckImage?.ResourceUrl?.All; } set { CreateCheckImageAttributes(); - if (itemDataAttributes.CheckImageAttributes.ResourceURL == null) + if (itemDataStyle.CheckImage.ResourceUrl == null) { - itemDataAttributes.CheckImageAttributes.ResourceURL = new StringSelector { All = value }; + itemDataStyle.CheckImage.ResourceUrl = new Selector { All = value }; } else { - itemDataAttributes.CheckImageAttributes.ResourceURL.All = value; + itemDataStyle.CheckImage.ResourceUrl.All = value; } } } @@ -1477,12 +1277,12 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.CheckImageAttributes?.Size; + return itemDataStyle.CheckImage?.Size; } set { CreateCheckImageAttributes(); - itemDataAttributes.CheckImageAttributes.Size = value; + itemDataStyle.CheckImage.Size = value; } } @@ -1492,15 +1292,15 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public int CheckImageRightSpace + public int CheckImageGapToBoundary { get { - return itemDataAttributes.CheckImageRightSpace; + return itemDataStyle.CheckImageGapToBoundary; } set { - itemDataAttributes.CheckImageRightSpace = value; + itemDataStyle.CheckImageGapToBoundary = value; } } @@ -1514,17 +1314,17 @@ namespace Tizen.NUI.Components { get { - return itemDataAttributes.IsSelected; + return itemDataStyle.IsSelected; } set { - itemDataAttributes.IsSelected = value; + itemDataStyle.IsSelected = value; } } private void Initalize() { - if (itemDataAttributes == null) + if (itemDataStyle == null) { throw new Exception("Button attribute parse error."); } @@ -1532,9 +1332,9 @@ namespace Tizen.NUI.Components private void CreateTextAttributes() { - if(itemDataAttributes.TextAttributes == null) + if(itemDataStyle.Text== null) { - itemDataAttributes.TextAttributes = new TextAttributes + itemDataStyle.Text= new TextLabelStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, @@ -1549,9 +1349,9 @@ namespace Tizen.NUI.Components private void CreateIconAttributes() { - if (itemDataAttributes.IconAttributes == null) + if (itemDataStyle.Icon== null) { - itemDataAttributes.IconAttributes = new ImageAttributes + itemDataStyle.Icon= new ImageViewStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, @@ -1562,9 +1362,9 @@ namespace Tizen.NUI.Components private void CreateCheckImageAttributes() { - if (itemDataAttributes.CheckImageAttributes == null) + if (itemDataStyle.CheckImage== null) { - itemDataAttributes.CheckImageAttributes = new ImageAttributes + itemDataStyle.CheckImage= new ImageViewStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, @@ -1592,7 +1392,7 @@ namespace Tizen.NUI.Components /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public ColorSelector BackgroundColorSelector + public Selector BackgroundColorSelector { get; set; @@ -1638,7 +1438,7 @@ namespace Tizen.NUI.Components /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public float PointSize + public float? PointSize { get { @@ -1651,7 +1451,7 @@ namespace Tizen.NUI.Components set { CreateText(); - mText.PointSize = value; + mText.PointSize = (float)value; } } @@ -1870,7 +1670,7 @@ namespace Tizen.NUI.Components /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() + protected override ViewStyle GetViewStyle() { return null; } @@ -1934,7 +1734,7 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public class DropDownListBridge : FlexibleView.Adapter { - private List mDatas = new List(); + private List mDatas = new List(); /// /// Creates a new instance of a DropDownListBridge. @@ -1954,7 +1754,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public void InsertData(int position, DropDownItemData data) + public void InsertData(int position, DropDownDataItem data) { if(position == -1) { @@ -1984,7 +1784,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public DropDownItemData GetData(int position) + public DropDownDataItem GetData(int position) { return mDatas[position]; } @@ -2013,7 +1813,7 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position) { - DropDownItemData listItemData = mDatas[position]; + DropDownDataItem listItemData = mDatas[position]; if(listItemData == null) { return; @@ -2052,7 +1852,7 @@ namespace Tizen.NUI.Components listItemView.CheckImageSize = listItemData.CheckImageSize; if (listItemView.CheckImageSize != null) { - listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2); + listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageGapToBoundary - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2); } } diff --git a/src/Tizen.NUI.Components/Controls/FlexibleView/FlexibleView.cs b/src/Tizen.NUI.Components/Controls/FlexibleView/FlexibleView.cs index 4fb7a9f..804be0e 100755 --- a/src/Tizen.NUI.Components/Controls/FlexibleView/FlexibleView.cs +++ b/src/Tizen.NUI.Components/Controls/FlexibleView/FlexibleView.cs @@ -145,6 +145,7 @@ namespace Tizen.NUI.Components } } + private new Extents padding; /// /// overwrite the Padding. /// @@ -153,8 +154,36 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public new Extents Padding { - get; - set; + get + { + if (null == padding) + { + padding = new Extents((ushort start, ushort end, ushort top, ushort bottom) => + { + padding.Start = start; + padding.End = end; + padding.Top = top; + padding.Bottom = bottom; + }, 0, 0, 0, 0); + } + + return padding; + } + set + { + if (null == padding) + { + padding = new Extents((ushort start, ushort end, ushort top, ushort bottom) => + { + padding.Start = start; + padding.End = end; + padding.Top = top; + padding.Bottom = bottom; + }, 0, 0, 0, 0); + } + + padding.CopyFrom(value); + } } /// @@ -398,7 +427,7 @@ namespace Tizen.NUI.Components { if (mLayout != null) { - mLayout.StopScroll(); + mLayout.StopScroll(false); } if (mAdapter != null) @@ -440,9 +469,9 @@ namespace Tizen.NUI.Components /// you can override it to create your own default attributes. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() + protected override ViewStyle GetViewStyle() { return null; } @@ -618,13 +647,17 @@ namespace Tizen.NUI.Components { offset = range - extent; } + if (offset < 0) + { + offset = 0; + } if (mScrollBar.Direction == ScrollBar.DirectionType.Vertical) { - mScrollBar.ThumbSize = new Size(thickness, length); + mScrollBar.Style.Thumb.Size = new Size(thickness, length); } else { - mScrollBar.ThumbSize = new Size(length, thickness); + mScrollBar.Style.Thumb.Size = new Size(length, thickness); } mScrollBar.MinValue = 0; mScrollBar.MaxValue = (int)(range - extent); @@ -704,7 +737,7 @@ namespace Tizen.NUI.Components { if (e.PanGesture.State == Gesture.StateType.Started) { - mLayout.StopScroll(); + mLayout.StopScroll(true); } else if (e.PanGesture.State == Gesture.StateType.Continuing) { @@ -1127,6 +1160,8 @@ namespace Tizen.NUI.Components Down } + private readonly int SCROLL_ANIMATION_DURATION = 500; + private FlexibleView mFlexibleView; private ChildHelper mChildHelper; @@ -1450,20 +1485,10 @@ namespace Tizen.NUI.Components return; } - if (mScrollAni == null) - { - mScrollAni = new Animation(); - mScrollAni.Finished += OnScrollAnimationFinished; - } - else if (mScrollAni.State == Animation.States.Playing) + if (dx == 0) { - //StopScroll(); - mScrollAni.Stop(Animation.EndActions.StopFinal); + return; } - mScrollAni.Duration = 500; - mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare); - - mScrollAni.Clear(); int childCount = mChildHelper.GetChildCount(); if (immediate == true) @@ -1476,9 +1501,52 @@ namespace Tizen.NUI.Components } else { + if (mScrollAni == null) + { + mScrollAni = new Animation(); + mScrollAni.Duration = SCROLL_ANIMATION_DURATION; + mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare); + } + + // avoid out of boundary of flexibleview. delta value might be used for shadow. + // this must be done before animation clear. + if (childCount > 0) + { + ViewHolder vh = mChildHelper.GetChildAt(0); + if (vh.LayoutPosition == 0) + { + if ((int)(vh.Left + dx) > 0) + { + dx = 0 - vh.Left; + } + } + + vh = mChildHelper.GetChildAt(childCount - 1); + if (vh.LayoutPosition == ItemCount - 1) + { + if ((int)(vh.Right + dx) < (int)Width + PaddingRight) + { + dx = Width + PaddingRight - vh.Right; + } + } + } + + // save position before animation clear. + float[] childrenPositon = new float[childCount]; for (int i = childCount - 1; i >= 0; i--) { ViewHolder v = mChildHelper.GetChildAt(i); + childrenPositon[i] = v.ItemView.PositionX; + } + + mScrollAni.Clear(); + mScrollAni.Finished += OnScrollAnimationFinished; + + for (int i = childCount - 1; i >= 0; i--) + { + ViewHolder v = mChildHelper.GetChildAt(i); + // set position again because position might be changed after animation clear. + v.ItemView.PositionX = childrenPositon[i]; mScrollAni.AnimateTo(v.ItemView, "PositionX", v.ItemView.PositionX + dx); } mScrollAni.Play(); @@ -1500,20 +1568,10 @@ namespace Tizen.NUI.Components return; } - if (mScrollAni == null) - { - mScrollAni = new Animation(); - mScrollAni.Finished += OnScrollAnimationFinished; - } - else if (mScrollAni.State == Animation.States.Playing) + if (dy == 0) { - //StopScroll(); - mScrollAni.Stop(Animation.EndActions.StopFinal); + return; } - mScrollAni.Duration = 500; - mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare); - - mScrollAni.Clear(); int childCount = mChildHelper.GetChildCount(); if (immediate == true) @@ -1526,9 +1584,52 @@ namespace Tizen.NUI.Components } else { + if (mScrollAni == null) + { + mScrollAni = new Animation(); + mScrollAni.Duration = SCROLL_ANIMATION_DURATION; + mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare); + } + + // avoid out of boundary of flexibleview. delta value might be used for shadow. + // this must be done before animation clear. + if (childCount > 0) + { + ViewHolder vh = mChildHelper.GetChildAt(0); + if (vh.LayoutPosition == 0) + { + if ((int)(vh.Top + dy) > 0) + { + dy = 0 - vh.Top; + } + } + + vh = mChildHelper.GetChildAt(childCount - 1); + if (vh.LayoutPosition == ItemCount - 1) + { + if ((int)(vh.Bottom + dy) < (int)Height + PaddingBottom) + { + dy = Height + PaddingBottom - vh.Bottom; + } + } + } + + // save position before animation clear. + float[] childPositon = new float[childCount]; + for (int i = childCount - 1; i >= 0; i--) + { + ViewHolder v = mChildHelper.GetChildAt(i); + childPositon[i] = v.ItemView.PositionY; + } + + mScrollAni.Clear(); + mScrollAni.Finished += OnScrollAnimationFinished; + for (int i = childCount - 1; i >= 0; i--) { ViewHolder v = mChildHelper.GetChildAt(i); + // set position again because position might be changed after animation clear. + v.ItemView.PositionY = childPositon[i]; mScrollAni.AnimateTo(v.ItemView, "PositionY", v.ItemView.PositionY + dy); } mScrollAni.Play(); @@ -1738,6 +1839,28 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected abstract int GetNextPosition(int position, FlexibleView.LayoutManager.Direction direction); + /// + /// Retrieves the first visible item view. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual ViewHolder FindFirstVisibleItemView() + { + return null; + } + + /// + /// Retrieves the last visible item view. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual ViewHolder FindLastVisibleItemView() + { + return null; + } + internal virtual ViewHolder OnFocusSearchFailed(FlexibleView.ViewHolder focused, LayoutManager.Direction direction, Recycler recycler) { return null; @@ -1749,13 +1872,17 @@ namespace Tizen.NUI.Components mChildHelper = recyclerView.mChildHelper; } - internal void StopScroll() + internal void StopScroll(bool doSomethingAfterAnimationStopped) { if (mScrollAni != null && mScrollAni.State == Animation.States.Playing) { - mScrollAni.Stop(Animation.EndActions.StopFinal); - mScrollAni.Clear(); - OnScrollAnimationFinished(mScrollAni, null); + mScrollAni.Finished -= OnScrollAnimationFinished; + mScrollAni.Stop(); + + if (doSomethingAfterAnimationStopped) + { + OnScrollAnimationFinished(mScrollAni, null); + } } } @@ -1807,7 +1934,49 @@ namespace Tizen.NUI.Components private void OnScrollAnimationFinished(object sender, EventArgs e) { - RecycleChildrenInt(mFlexibleView.mRecycler); + foreach (ViewHolder holder in mPendingRecycleViews) + { + holder.PendingRecycle = false; + } + mPendingRecycleViews.Clear(); + + int start = NO_POSITION; + ViewHolder firstItemView = FindFirstVisibleItemView(); + if (firstItemView != null) + start = firstItemView.LayoutPosition; + else + start = 0; + + int itemCount = ChildCount; + + int end = NO_POSITION; + ViewHolder lastItemView = FindLastVisibleItemView(); + if (lastItemView != null) + end = lastItemView.LayoutPosition; + else + end = itemCount - 1; + + List removedViewList = new List(); + for (int i = 0; i < itemCount; i++) + { + ViewHolder v = GetChildAt(i); + + //if item view of holder is visible, it should not be recycled. + if (v.LayoutPosition >= start && v.LayoutPosition <= end) + continue; + + removedViewList.Add(v); + } + + for (int i = 0; i < removedViewList.Count; i++) + { + ViewHolder v = removedViewList[i]; + v.PendingRecycle = false; + mFlexibleView.mRecycler.RecycleView(v); + mChildHelper.RemoveView(v); + } + + // relayout } private void AddViewInternal(ViewHolder holder, int index, bool disappearing) diff --git a/src/Tizen.NUI.Components/Controls/FlexibleView/GridLayoutManager.cs b/src/Tizen.NUI.Components/Controls/FlexibleView/GridLayoutManager.cs index 3100256..e746be5 100755 --- a/src/Tizen.NUI.Components/Controls/FlexibleView/GridLayoutManager.cs +++ b/src/Tizen.NUI.Components/Controls/FlexibleView/GridLayoutManager.cs @@ -46,7 +46,7 @@ namespace Tizen.NUI.Components internal override void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, int itemDirection) { bool layingOutInPrimaryDirection = (itemDirection == LayoutState.ITEM_DIRECTION_TAIL); - int span = anchorInfo.Position; + int span = anchorInfo.Position % mSpanCount; if (layingOutInPrimaryDirection) { // choose span 0 @@ -64,7 +64,7 @@ namespace Tizen.NUI.Components int bestSpan = span; while (pos < indexLimit) { - int next = (pos + 1); + int next = (pos + 1) % mSpanCount; if (next > bestSpan) { pos += 1; diff --git a/src/Tizen.NUI.Components/Controls/FlexibleView/LinearLayoutManager.cs b/src/Tizen.NUI.Components/Controls/FlexibleView/LinearLayoutManager.cs index 9315aeb..0323ad9 100755 --- a/src/Tizen.NUI.Components/Controls/FlexibleView/LinearLayoutManager.cs +++ b/src/Tizen.NUI.Components/Controls/FlexibleView/LinearLayoutManager.cs @@ -451,6 +451,78 @@ namespace Tizen.NUI.Components return NO_POSITION; } + /// + /// Retrieves the first visible item view. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override FlexibleView.ViewHolder FindFirstVisibleItemView() + { + int childCount = ChildCount; + if (mShouldReverseLayout == false) + { + for (int i = 0; i < childCount; i++) + { + FlexibleView.ViewHolder child = GetChildAt(i); + int end = (int)mOrientationHelper.GetViewHolderEnd(child); + if (end >= 0 && end < (int)mOrientationHelper.GetEnd()) + { + return child; + } + } + } + else + { + for (int i = childCount - 1; i >= 0; i--) + { + FlexibleView.ViewHolder child = GetChildAt(i); + int end = (int)mOrientationHelper.GetViewHolderEnd(child); + if (end >= 0 && end < (int)mOrientationHelper.GetEnd()) + { + return child; + } + } + } + return null; + } + + /// + /// Retrieves the last visible item view. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override FlexibleView.ViewHolder FindLastVisibleItemView() + { + int childCount = ChildCount; + if (mShouldReverseLayout == false) + { + for (int i = childCount - 1; i >= 0; i--) + { + FlexibleView.ViewHolder child = GetChildAt(i); + int start = (int)mOrientationHelper.GetViewHolderStart(child); + if (start > 0 && start < (int)mOrientationHelper.GetEnd()) + { + return child; + } + } + } + else + { + for (int i = 0; i < childCount; i++) + { + FlexibleView.ViewHolder child = GetChildAt(i); + int start = (int)mOrientationHelper.GetViewHolderStart(child); + if (start > 0 && start < (int)mOrientationHelper.GetEnd()) + { + return child; + } + } + } + return null; + } + internal virtual void LayoutChunk(FlexibleView.Recycler recycler, LayoutState layoutState, LayoutChunkResult result) { @@ -601,10 +673,11 @@ namespace Tizen.NUI.Components return false; } - FlexibleView.ViewHolder anchorChild = FindFirstCompleteVisibleItemView(); + FlexibleView.ViewHolder anchorChild = FindFirstVisibleItemView(); if (anchorChild == null) { - return false; + Log.Error("flexibleview", $"exception occurs when updating anchor information!"); + anchorChild = GetChildAt(0); } anchorInfo.Position = anchorChild.LayoutPosition; anchorInfo.Coordinate = mOrientationHelper.GetViewHolderStart(anchorChild); @@ -946,34 +1019,6 @@ namespace Tizen.NUI.Components mLayoutState.Extra = mOrientationHelper.GetStartAfterPadding(); } - private FlexibleView.ViewHolder FindFirstVisibleItemView() - { - int childCount = ChildCount; - if (mShouldReverseLayout == false) - { - for (int i = 0; i < childCount; i++) - { - FlexibleView.ViewHolder child = GetChildAt(i); - if ((int)mOrientationHelper.GetViewHolderEnd(child) > 0) - { - return child; - } - } - } - else - { - for (int i = childCount - 1; i >= 0; i--) - { - FlexibleView.ViewHolder child = GetChildAt(i); - if ((int)mOrientationHelper.GetViewHolderEnd(child) > 0) - { - return child; - } - } - } - return null; - } - private FlexibleView.ViewHolder FindFirstCompleteVisibleItemView() { int childCount = ChildCount; @@ -982,7 +1027,8 @@ namespace Tizen.NUI.Components for (int i = 0; i < childCount; i++) { FlexibleView.ViewHolder child = GetChildAt(i); - if ((int)mOrientationHelper.GetViewHolderStart(child) > 0) + int start = (int)mOrientationHelper.GetViewHolderStart(child); + if (start > 0 && start < (int)mOrientationHelper.GetEnd()) { return child; } @@ -993,35 +1039,8 @@ namespace Tizen.NUI.Components for (int i = childCount - 1; i >= 0; i--) { FlexibleView.ViewHolder child = GetChildAt(i); - if ((int)mOrientationHelper.GetViewHolderStart(child) > 0) - { - return child; - } - } - } - return null; - } - - private FlexibleView.ViewHolder FindLastVisibleItemView() - { - int childCount = ChildCount; - if (mShouldReverseLayout == false) - { - for (int i = childCount - 1; i >= 0; i--) - { - FlexibleView.ViewHolder child = GetChildAt(i); - if ((int)mOrientationHelper.GetViewHolderStart(child) < (int)mOrientationHelper.GetEnd()) - { - return child; - } - } - } - else - { - for (int i = 0; i < childCount; i++) - { - FlexibleView.ViewHolder child = GetChildAt(i); - if ((int)mOrientationHelper.GetViewHolderStart(child) < (int)mOrientationHelper.GetEnd()) + int start = (int)mOrientationHelper.GetViewHolderStart(child); + if (start > 0 && start < (int)mOrientationHelper.GetEnd()) { return child; } diff --git a/src/Tizen.NUI.Components/Controls/ImageControl.cs b/src/Tizen.NUI.Components/Controls/ImageControl.cs new file mode 100755 index 0000000..16093ba --- /dev/null +++ b/src/Tizen.NUI.Components/Controls/ImageControl.cs @@ -0,0 +1,127 @@ +/* + * Copyright(c) 2019 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.Collections.Generic; +using System.ComponentModel; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Components +{ + /// + /// The control component is class of image. Temporarily for SelectButton. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class ImageControl : Control + { + /// + /// Control style. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + private ImageControlStyle imageControlStyle; + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public new ImageControlStyle Style => imageControlStyle; + + internal ImageView imageView; + + /// + /// Construct an empty Control. + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageControl() : base() + { + } + + /// + /// Construct with style. + /// + /// Create style customized by user + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageControl(ImageControlStyle style) : base(style) + { + } + + /// + /// Construct with style + /// + /// Style to be applied + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageControl(string style) : base(style) + { + } + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override void ApplyStyle(ViewStyle viewStyle) + { + base.ApplyStyle(viewStyle); + + ImageControlStyle imageControlStyle = viewStyle as ImageControlStyle; + if (null != imageControlStyle) + { + if (null == imageView) + { + imageView = new ImageView(); + this.Add(imageView); + } + } + + imageView.ApplyStyle(imageControlStyle.Image); + } + + /// + /// Dispose Control and all children on it. + /// + /// Dispose type. + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (imageView != null) + { + Utility.Dispose(imageView); + } + + base.Dispose(type); + } + + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override ViewStyle GetViewStyle() + { + imageControlStyle = new ImageControlStyle(); + return imageControlStyle; + } + } +} diff --git a/src/Tizen.NUI.Components/Controls/InputField.cs b/src/Tizen.NUI.Components/Controls/InputField.cs index 72abda3..3b67ce2 100755 --- a/src/Tizen.NUI.Components/Controls/InputField.cs +++ b/src/Tizen.NUI.Components/Controls/InputField.cs @@ -33,7 +33,7 @@ namespace Tizen.NUI.Components // the textField private TextField textField = null; // the attributes of the inputField - private InputFieldAttributes inputFieldAttrs = null; + private InputFieldStyle inputFieldAttrs = null; // the flag indicate should relayout the textField in base class private bool relayoutTextField = true; @@ -62,7 +62,7 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public InputField(InputFieldAttributes attributes) : base(attributes) + public InputField(InputFieldStyle attributes) : base(attributes) { Initialize(); } @@ -138,7 +138,7 @@ namespace Tizen.NUI.Components CreateTextFieldAttributes(); if (null == inputFieldAttrs.InputBoxAttributes.TextColor) { - inputFieldAttrs.InputBoxAttributes.TextColor = new ColorSelector(); + inputFieldAttrs.InputBoxAttributes.TextColor = new Selector(); } inputFieldAttrs.InputBoxAttributes.TextColor.All = value; textField.TextColor = value; @@ -162,7 +162,7 @@ namespace Tizen.NUI.Components CreateTextFieldAttributes(); if (null == inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor) { - inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = new ColorSelector(); + inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = new Selector(); } inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor.All = value; textField.PlaceholderTextColor = value; @@ -186,7 +186,7 @@ namespace Tizen.NUI.Components CreateTextFieldAttributes(); if (null == inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor) { - inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = new ColorSelector(); + inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = new Selector(); } inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor.All = value; textField.PrimaryCursorColor = value; @@ -194,30 +194,6 @@ namespace Tizen.NUI.Components } /// - /// Gets or sets secondary cursor color. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public Color SecondaryCursorColor - { - get - { - return textField.SecondaryCursorColor; - } - set - { - CreateTextFieldAttributes(); - if (null == inputFieldAttrs.InputBoxAttributes.SecondaryCursorColor) - { - inputFieldAttrs.InputBoxAttributes.SecondaryCursorColor = new ColorSelector(); - } - inputFieldAttrs.InputBoxAttributes.SecondaryCursorColor.All = value; - textField.SecondaryCursorColor = value; - } - } - - /// /// Gets or sets font family of text. /// /// 6 @@ -238,30 +214,6 @@ namespace Tizen.NUI.Components } /// - /// Gets or sets point size of text. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public float PointSize - { - get - { - return textField.PointSize; - } - set - { - CreateTextFieldAttributes(); - if (null == inputFieldAttrs.InputBoxAttributes.PointSize) - { - inputFieldAttrs.InputBoxAttributes.PointSize = new FloatSelector(); - } - inputFieldAttrs.InputBoxAttributes.PointSize.All = value; - textField.PointSize = value; - } - } - - /// /// Gets or sets enable cursor blink. /// /// 6 @@ -336,7 +288,7 @@ namespace Tizen.NUI.Components set { CreateTextFieldAttributes(); - inputFieldAttrs.InputBoxAttributes.EnableEllipsis = value; + inputFieldAttrs.InputBoxAttributes.Ellipsis = value; textField.Ellipsis = value; } } @@ -351,18 +303,18 @@ namespace Tizen.NUI.Components { get { - return inputFieldAttrs.BackgroundImageAttributes?.ResourceURL?.All; + return inputFieldAttrs.BackgroundImageAttributes?.ResourceUrl?.All; } set { if (value != null) { CreateBackgroundAttributes(); - if (inputFieldAttrs.BackgroundImageAttributes.ResourceURL == null) + if (inputFieldAttrs.BackgroundImageAttributes.ResourceUrl == null) { - inputFieldAttrs.BackgroundImageAttributes.ResourceURL = new StringSelector(); + inputFieldAttrs.BackgroundImageAttributes.ResourceUrl = new Selector(); } - inputFieldAttrs.BackgroundImageAttributes.ResourceURL.All = value; + inputFieldAttrs.BackgroundImageAttributes.ResourceUrl.All = value; RelayoutRequest(); } } @@ -387,7 +339,7 @@ namespace Tizen.NUI.Components CreateBackgroundAttributes(); if (inputFieldAttrs.BackgroundImageAttributes.Border == null) { - inputFieldAttrs.BackgroundImageAttributes.Border = new RectangleSelector(); + inputFieldAttrs.BackgroundImageAttributes.Border = new Selector(); } inputFieldAttrs.BackgroundImageAttributes.Border.All = value; RelayoutRequest(); @@ -417,9 +369,9 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() + protected override ViewStyle GetViewStyle() { - return new InputFieldAttributes(); + return new InputFieldStyle(); } /// @@ -466,9 +418,6 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected override void OnUpdate() { - ApplyAttributes(this, inputFieldAttrs); - ApplyAttributes(bgImage, inputFieldAttrs.BackgroundImageAttributes); - ApplyAttributes(textField, inputFieldAttrs.InputBoxAttributes); RelayoutComponent(); OnLayoutDirectionChanged(); } @@ -481,10 +430,10 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e) { - InputFieldAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as InputFieldAttributes; - if (tempAttributes != null) + InputFieldStyle tempStyle = StyleManager.Instance.GetAttributes(style) as InputFieldStyle; + if (tempStyle != null) { - attributes = inputFieldAttrs = tempAttributes; + Style.CopyFrom(tempStyle); RelayoutRequest(); } } @@ -590,7 +539,7 @@ namespace Tizen.NUI.Components private void Initialize() { - inputFieldAttrs = attributes as InputFieldAttributes; + inputFieldAttrs = Style as InputFieldStyle; if (null == inputFieldAttrs) { throw new Exception("Fail to get the InputField attributes."); @@ -688,7 +637,7 @@ namespace Tizen.NUI.Components { if (null == inputFieldAttrs.BackgroundImageAttributes) { - inputFieldAttrs.BackgroundImageAttributes = new ImageAttributes(); + inputFieldAttrs.BackgroundImageAttributes = new ImageViewStyle(); } } @@ -696,7 +645,7 @@ namespace Tizen.NUI.Components { if (null == inputFieldAttrs.InputBoxAttributes) { - inputFieldAttrs.InputBoxAttributes = new TextFieldAttributes(); + inputFieldAttrs.InputBoxAttributes = new TextFieldStyle(); } } } diff --git a/src/Tizen.NUI.Components/Controls/Loading.cs b/src/Tizen.NUI.Components/Controls/Loading.cs index f6bacc1..683261a 100755 --- a/src/Tizen.NUI.Components/Controls/Loading.cs +++ b/src/Tizen.NUI.Components/Controls/Loading.cs @@ -17,6 +17,8 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { @@ -26,11 +28,65 @@ namespace Tizen.NUI.Components /// 6 public class Loading : Control { - private LoadingAttributes loadingAttrs = null; // Loading Attributes + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ImagesProperty = BindableProperty.Create("Images", typeof(string[]), typeof(Loading), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Loading)bindable; + if (newValue != null) + { + instance.Style.Images = (string[])newValue; + instance.imageVisual.URLS = new List((string[])newValue); + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Loading)bindable; + return instance.Style.Images; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public new static readonly BindableProperty SizeProperty = BindableProperty.Create("Size", typeof(Size), typeof(Loading), new Size(0,0), propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Loading)bindable; + if (newValue != null) + { + Size size = (Size)newValue; + instance.Style.Size = size; + //insbase.Size = value; + instance.imageVisual.Size = new Size2D((int)size.Width, (int)size.Height); + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Loading)bindable; + return instance.Style.Size; + }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty FrameRateProperty = BindableProperty.Create("FrameRate", typeof(int), typeof(Loading), (int)(1000/16.6f), propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (Loading)bindable; + if (newValue != null) + { + int frameRate = (int)newValue; + if (0 != frameRate) //It will crash if 0 + { + instance.Style.FrameRate.All = frameRate; + instance.imageVisual.FrameDelay = 1000.0f / frameRate; + } + } + }, + defaultValueCreator: (bindable) => + { + var instance = (Loading)bindable; + return instance.Style.FrameRate?.All ?? (int)(1000/16.6f); + }); + private AnimatedImageVisual imageVisual = null; /// - /// The constructor of Loading + /// The constructor of Loading. /// /// 6 public Loading() : base() @@ -43,7 +99,7 @@ namespace Tizen.NUI.Components /// /// The string to initialize the Loading. /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Loading(string style) : base(style) { @@ -51,17 +107,21 @@ namespace Tizen.NUI.Components } /// - /// The constructor of the Loading class with specific Attributes. + /// The constructor of the Loading class with specific style. /// - /// The Attributes object to initialize the Loading. + /// The style object to initialize the Loading. /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Loading(LoadingAttributes attributes) : base(attributes) + public Loading(LoadingStyle style) : base(style) { Initialize(); } + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public new LoadingStyle Style => ViewStyle as LoadingStyle; + /// /// Gets or sets loading image resource array. /// @@ -70,15 +130,29 @@ namespace Tizen.NUI.Components { get { - return loadingAttrs.ImageArray; + return Images; } set { - if (null != value) - { - loadingAttrs.ImageArray = value; - imageVisual.URLS = new List(value); - } + Images = value; + } + } + + /// + /// Gets or sets loading image resources. + /// + /// 6 + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public string[] Images + { + get + { + return (string[])GetValue(ImagesProperty); + } + set + { + SetValue(ImagesProperty, value); } } @@ -90,49 +164,39 @@ namespace Tizen.NUI.Components { get { - return loadingAttrs.Size ?? new Size(100, 100); + return (Size)GetValue(SizeProperty); } set { - loadingAttrs.Size = value; - base.Size = value; - imageVisual.Size = new Size2D((int)value.Width, (int)value.Height); + SetValue(SizeProperty, value); } } /// - /// Gets or sets FPS of loading. + /// Gets or sets frame rate of loading. /// /// 6 public int FrameRate { get { - return loadingAttrs?.FrameRate?.All ?? (int)(1000.0f / 16.6f); + return (int)GetValue(FrameRateProperty); } set { - if (value != 0) //It will crash if 0 - { - if (null == loadingAttrs.FrameRate) - { - loadingAttrs.FrameRate = new IntSelector(); - } - loadingAttrs.FrameRate.All = value; - imageVisual.FrameDelay = 1000.0f / value; - } + SetValue(FrameRateProperty, value); } } /// - /// Get Loading attribues. + /// Get Loading style. /// /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() + protected override ViewStyle GetViewStyle() { - return new LoadingAttributes(); + return new LoadingStyle(); } /// @@ -155,34 +219,12 @@ namespace Tizen.NUI.Components RemoveVisual("loadingImageVisual"); } - //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. - //Unreference this from if a static instance refer to this. - //You must call base.Dispose(type) just before exit. base.Dispose(type); } - /// - /// Update Loading by attributes. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected override void OnUpdate() - { - } - private void Initialize() { - loadingAttrs = attributes as LoadingAttributes; - if (null == loadingAttrs) - { - throw new Exception("Loading attribute parse error."); - } - ApplyAttributes(this, loadingAttrs); - imageVisual = new AnimatedImageVisual() { URLS = new List(), @@ -201,17 +243,17 @@ namespace Tizen.NUI.Components private void UpdateVisual() { - if (null != loadingAttrs.ImageArray) + if (null != Style.Images) { - imageVisual.URLS = new List(loadingAttrs.ImageArray); + imageVisual.URLS = new List(Style.Images); } - if (null != loadingAttrs.FrameRate) + if (null != Style.FrameRate?.All && 0 != Style.FrameRate.All.Value) { - imageVisual.FrameDelay = 1000.0f / (float)loadingAttrs.FrameRate.All; + imageVisual.FrameDelay = 1000.0f / (float)Style.FrameRate.All.Value; } - if (null != loadingAttrs.LoadingSize) + if (null != Style.LoadingSize) { - imageVisual.Size = new Size2D((int)loadingAttrs.LoadingSize.Width, (int)loadingAttrs.LoadingSize.Height); + imageVisual.Size = new Size2D((int)Style.LoadingSize.Width, (int)Style.LoadingSize.Height); } } } diff --git a/src/Tizen.NUI.Components/Controls/Pagination.cs b/src/Tizen.NUI.Components/Controls/Pagination.cs index d8190b3..3ced1e6 100755 --- a/src/Tizen.NUI.Components/Controls/Pagination.cs +++ b/src/Tizen.NUI.Components/Controls/Pagination.cs @@ -29,7 +29,7 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] public class Pagination: Control { - private PaginationAttributes paginationAttributes; + private PaginationStyle paginationStyle; private VisualView container; @@ -62,12 +62,12 @@ namespace Tizen.NUI.Components } /// - /// Creates a new instance of a Pagination using attributes. + /// Creates a new instance of a Pagination using style. /// /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Pagination(PaginationAttributes attributes) : base(attributes) + public Pagination(PaginationStyle style) : base(style) { Initialize(); } @@ -82,16 +82,16 @@ namespace Tizen.NUI.Components { get { - return paginationAttributes?.IndicatorSize; + return paginationStyle?.IndicatorSize; } set { - if (value == null || paginationAttributes == null) + if (value == null || paginationStyle == null) { return; } - paginationAttributes.IndicatorSize = value; - RelayoutRequest(); + paginationStyle.IndicatorSize = value; + UpdateVisual(); } } @@ -101,43 +101,20 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public string IndicatorBackgroundURL - { - get - { - return paginationAttributes?.IndicatorBackgroundURL; - } - set - { - if (value == null || paginationAttributes == null) - { - return; - } - paginationAttributes.IndicatorBackgroundURL = value; - RelayoutRequest(); - } - } - - /// - /// Gets or sets the resource of the select indicator. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public string IndicatorSelectURL + public Selector IndicatorImageURL { get { - return paginationAttributes?.IndicatorSelectURL; + return paginationStyle?.IndicatorImageURL; } set { - if (value == null || paginationAttributes == null) + if (value == null || paginationStyle == null) { return; } - paginationAttributes.IndicatorSelectURL = value; - RelayoutRequest(); + paginationStyle.IndicatorImageURL = value; + UpdateVisual(); } } @@ -151,16 +128,16 @@ namespace Tizen.NUI.Components { get { - return (int)paginationAttributes?.IndicatorSpacing; + return (int)paginationStyle?.IndicatorSpacing; } set { - if (paginationAttributes == null) + if (paginationStyle == null) { return; } - paginationAttributes.IndicatorSpacing = value; - RelayoutRequest(); + paginationStyle.IndicatorSpacing = value; + UpdateVisual(); } } @@ -198,11 +175,12 @@ namespace Tizen.NUI.Components container.RemoveVisual("Indicator" + i); } indicatorList.RemoveRange(value, indicatorCount - value); - if(value <= 0) - { - container.RemoveVisual("SelectIndicator"); - } - else if(selectedIndex >= value) + //if(value <= 0) + //{ + // container.RemoveVisual("SelectIndicator"); + //} + //else + if (selectedIndex >= value) { selectedIndex = 0; SelectIn(indicatorList[selectedIndex]); @@ -251,13 +229,13 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public Position2D GetIndicatorPosition(int index) + public Position GetIndicatorPosition(int index) { if (index < 0 || index >= indicatorList.Count) { return null; } - return new Vector2(indicatorList[index].Position.X + container.PositionX, indicatorList[index].Position.Y + container.PositionY); + return new Position(indicatorList[index].Position.X + container.PositionX, indicatorList[index].Position.Y + container.PositionY); } /// @@ -269,7 +247,8 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void SelectOut(VisualMap selectOutIndicator) { - + ImageVisual visual = selectOutIndicator as ImageVisual; + visual.URL = paginationStyle.IndicatorImageURL.Normal; } /// @@ -281,7 +260,9 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void SelectIn(VisualMap selectInIndicator) { - selectIndicator.Position = selectInIndicator.Position; + //selectIndicator.Position = selectInIndicator.Position; + ImageVisual visual = selectInIndicator as ImageVisual; + visual.URL = paginationStyle.IndicatorImageURL.Selected; } /// @@ -290,9 +271,9 @@ namespace Tizen.NUI.Components /// 6 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - protected override Attributes GetAttributes() + protected override ViewStyle GetViewStyle() { - return new PaginationAttributes(); + return new PaginationStyle(); } /// @@ -322,33 +303,10 @@ namespace Tizen.NUI.Components base.Dispose(type); } - /// - /// you can override it to update your own resources. - /// - /// 6 - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - protected override void OnUpdate() - { - - for (int i = 0; i < indicatorList.Count; i++) - { - ImageVisual indicator = indicatorList[i]; - indicator.URL = paginationAttributes.IndicatorBackgroundURL; - indicator.Size = new Size2D((int)paginationAttributes.IndicatorSize.Width, (int)paginationAttributes.IndicatorSize.Height); - indicator.Position = new Position2D((int)(paginationAttributes.IndicatorSize.Width + paginationAttributes.IndicatorSpacing) * i, 0); - } - - selectIndicator.URL = paginationAttributes.IndicatorSelectURL; - selectIndicator.Size = new Size2D((int)paginationAttributes.IndicatorSize.Width, (int)paginationAttributes.IndicatorSize.Height); - - //UpdateContainer(); - } - private void Initialize() { - paginationAttributes = attributes as PaginationAttributes; - if (paginationAttributes == null) + paginationStyle = Style as PaginationStyle; + if (paginationStyle == null) { throw new Exception("Pagination attributes is null."); } @@ -363,45 +321,63 @@ namespace Tizen.NUI.Components }; this.Add(container); - selectIndicator = new ImageVisual() - { - URL = " " - }; - container.AddVisual("SelectIndicator", selectIndicator); + //selectIndicator = new ImageVisual() + //{ + // URL = " " + //}; + //container.AddVisual("SelectIndicator", selectIndicator); } private void CreateIndicator() { - if (paginationAttributes == null) + if (paginationStyle == null) { return; } ImageVisual indicator = new ImageVisual { - URL = paginationAttributes.IndicatorBackgroundURL, - Size = new Size2D((int)paginationAttributes.IndicatorSize.Width, (int)paginationAttributes.IndicatorSize.Height) + URL = paginationStyle.IndicatorImageURL.Normal, + Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height) }; - indicator.Position = new Position2D((int)(paginationAttributes.IndicatorSize.Width + paginationAttributes.IndicatorSpacing) * indicatorList.Count, 0); + indicator.Position = new Position2D((int)(paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * indicatorList.Count, 0); container.AddVisual("Indicator" + indicatorList.Count, indicator); indicatorList.Add(indicator); } private void UpdateContainer() { - if (paginationAttributes == null) + if (paginationStyle == null) { return; } if (indicatorList.Count > 0) { - container.SizeWidth = (paginationAttributes.IndicatorSize.Width + paginationAttributes.IndicatorSpacing) * indicatorList.Count - paginationAttributes.IndicatorSpacing; + container.SizeWidth = (paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * indicatorList.Count - paginationStyle.IndicatorSpacing; } else { container.SizeWidth = 0; } - container.SizeHeight = paginationAttributes.IndicatorSize.Height; + container.SizeHeight = paginationStyle.IndicatorSize.Height; container.PositionX = (int)((this.SizeWidth - container.SizeWidth) / 2); } + + private void UpdateVisual() + { + if (null == paginationStyle.IndicatorSize) return; + if (null == paginationStyle.IndicatorImageURL) return; + if (indicatorCount < 0) return; + + for (int i = 0; i < indicatorList.Count; i++) + { + ImageVisual indicator = indicatorList[i]; + indicator.URL = paginationStyle.IndicatorImageURL.Normal; + indicator.Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height); + indicator.Position = new Position2D((int)(paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * i, 0); + } + + //selectIndicator.URL = paginationStyle.IndicatorSelectURL; + //selectIndicator.Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height); + } } } diff --git a/src/Tizen.NUI.Components/Controls/Popup.cs b/src/Tizen.NUI.Components/Controls/Popup.cs index 232dfac..bc77658 100755 --- a/src/Tizen.NUI.Components/Controls/Popup.cs +++ b/src/Tizen.NUI.Components/Controls/Popup.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; using System.ComponentModel; namespace Tizen.NUI.Components @@ -28,333 +29,392 @@ namespace Tizen.NUI.Components /// 6 public class Popup : Control { - private ImageView backgroundImage; - private ImageView shadowImage; - private TextLabel titleText; - private List