From 36c5a71bb3ada7ca35a4846cb255187724e88f55 Mon Sep 17 00:00:00 2001
From: zhouleonlei <56956725+zhouleonlei@users.noreply.github.com>
Date: Wed, 18 Dec 2019 18:13:33 +0800
Subject: [PATCH] [NUI] Merge mater#1206 to API6 (#1208)
---
src/Tizen.NUI.Components/Controls/Button.cs | 2 +-
src/Tizen.NUI.Components/Controls/ButtonGroup.cs | 526 +++++++++++++++++++++
src/Tizen.NUI.Components/Controls/Control.cs | 13 +-
src/Tizen.NUI.Components/Controls/DropDown.cs | 2 +-
.../Controls/FlexibleView/FlexibleView.cs | 14 +
.../Controls/FlexibleView/GridLayoutManager.cs | 24 +-
.../Controls/FlexibleView/LinearLayoutManager.cs | 343 +++++---------
.../Controls/FlexibleView/OrientationHelper.cs | 34 +-
src/Tizen.NUI.Components/Controls/InputField.cs | 2 +-
src/Tizen.NUI.Components/Controls/Popup.cs | 456 +++++++++---------
src/Tizen.NUI.Components/Controls/Progress.cs | 2 +-
src/Tizen.NUI.Components/Controls/Scrollbar.cs | 2 +-
src/Tizen.NUI.Components/Controls/Slider.cs | 2 +-
src/Tizen.NUI.Components/Controls/Switch.cs | 2 +-
src/Tizen.NUI.Components/Controls/Tab.cs | 2 +-
src/Tizen.NUI.Components/Style/PopupStyle.cs | 32 +-
src/Tizen.NUI.Components/Utils/StyleManager.cs | 2 +-
.../src/public/XamlBinding/BindableProperty.cs | 39 +-
18 files changed, 955 insertions(+), 544 deletions(-)
create mode 100755 src/Tizen.NUI.Components/Controls/ButtonGroup.cs
diff --git a/src/Tizen.NUI.Components/Controls/Button.cs b/src/Tizen.NUI.Components/Controls/Button.cs
index c9efa03..d8d3eab 100755
--- a/src/Tizen.NUI.Components/Controls/Button.cs
+++ b/src/Tizen.NUI.Components/Controls/Button.cs
@@ -967,7 +967,7 @@ namespace Tizen.NUI.Components
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- ButtonStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as ButtonStyle;
+ ButtonStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as ButtonStyle;
if (tempAttributes != null)
{
Style.CopyFrom(tempAttributes);
diff --git a/src/Tizen.NUI.Components/Controls/ButtonGroup.cs b/src/Tizen.NUI.Components/Controls/ButtonGroup.cs
new file mode 100755
index 0000000..8a8eed4
--- /dev/null
+++ b/src/Tizen.NUI.Components/Controls/ButtonGroup.cs
@@ -0,0 +1,526 @@
+/*
+* 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.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ ///
+ /// ButtonGroup is a group of buttons which can be set common property
+ ///
+ /// 3
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ButtonGroup : BindableObject, global::System.IDisposable
+ {
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemheightProperty = BindableProperty.Create(nameof(Itemheight), typeof(float), typeof(ButtonGroup), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.SizeHeight = (float)newValue;
+ }
+ btGroup.itemheight = (float)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemheight;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemPointSizeProperty = BindableProperty.Create(nameof(ItemPointSize), typeof(float), typeof(ButtonGroup), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.PointSize = (float)newValue;
+ }
+ btGroup.itemPointSize = (float)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemPointSize;
+ });
+
+ /// 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 ItemFontFamilyProperty = BindableProperty.Create(nameof(ItemFontFamily), typeof(string), typeof(ButtonGroup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.FontFamily = (string)newValue;
+ }
+ btGroup.itemFontFamily = (string)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemFontFamily;
+ });
+
+ /// 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 ItemTextColorProperty = BindableProperty.Create(nameof(ItemTextColor), typeof(Color), typeof(ButtonGroup), Color.Black, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.TextColor = (Color)newValue;
+ }
+ btGroup.itemTextColor = (Color)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemTextColor;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemTextAlignmentProperty = BindableProperty.Create(nameof(ItemTextAlignment), typeof(HorizontalAlignment), typeof(ButtonGroup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ }
+ btGroup.itemTextAlignment = (HorizontalAlignment)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemTextAlignment;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OverLayBackgroundColorSelectorProperty = BindableProperty.Create(nameof(OverLayBackgroundColorSelector), typeof(Selector), typeof(ButtonGroup), new Selector(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Overlay.BackgroundColor = (Selector)newValue;
+ }
+ btGroup.overLayBackgroundColorSelector = (Selector)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.overLayBackgroundColorSelector;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemBackgroundImageUrlProperty = BindableProperty.Create(nameof(ItemBackgroundImageUrl), typeof(string), typeof(ButtonGroup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ if (btn.Style.BackgroundImage == null)
+ {
+ btn.Style.BackgroundImage = new Selector();
+ }
+ btn.Style.BackgroundImage = (string)newValue;
+ }
+ btGroup.itemBackgroundImageUrl = (string)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemBackgroundImageUrl;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemBackgroundBorderProperty = BindableProperty.Create(nameof(ItemBackgroundBorder), typeof(Rectangle), typeof(ButtonGroup), new Rectangle(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.BackgroundImageBorder = (Rectangle)newValue;
+ }
+ btGroup.itemBackgroundBorder = (Rectangle)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemBackgroundBorder;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemShadowUrlProperty = BindableProperty.Create(nameof(ItemShadowUrl), typeof(string), typeof(ButtonGroup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ if (btn.Style.Shadow.ResourceUrl == null)
+ {
+ btn.Style.Shadow.ResourceUrl = new Selector();
+ }
+ btn.Style.Shadow.ResourceUrl = (string)newValue;
+ }
+ btGroup.itemShadowUrl = (string)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemShadowUrl;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemShadowBorderProperty = BindableProperty.Create(nameof(ItemShadowBorder), typeof(Rectangle), typeof(ButtonGroup), new Rectangle(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Shadow.Border = (Rectangle)newValue;
+ }
+ btGroup.itemShadowBorder = (Rectangle)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemShadowBorder;
+ });
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ButtonGroup(View view) : base()
+ {
+ itemGroup = new List