/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
using System;
-using System.Collections.Generic;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
using System.ComponentModel;
/// User can handle Popup button count, head title and content area.
/// </summary>
/// <since_tizen> 6 </since_tizen>
- public class Popup : Control
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
+ public partial class Popup : 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 ButtonHeightProperty = BindableProperty.Create("ButtonHeight", typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonHeightProperty = BindableProperty.Create(nameof(ButtonHeight), typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Size.Height = (int)newValue;
instance.btGroup.Itemheight = (int)newValue;
instance.UpdateView();
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return (int)(instance.Style?.Buttons?.Size?.Height ?? 0);
+ return (int)((Popup)bindable).btGroup.Itemheight;
});
/// 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 ButtonTextPointSizeProperty = BindableProperty.Create("ButtonTextPointSize", typeof(float), typeof(Popup), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonTextPointSizeProperty = BindableProperty.Create(nameof(ButtonTextPointSize), typeof(float), typeof(Popup), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.Text.PointSize == null)
- {
- instance.Style.Buttons.Text.PointSize = new Selector<float?>();
- }
- instance.Style.Buttons.Text.PointSize.All = (float)newValue;
instance.btGroup.ItemPointSize = (float)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.PointSize?.All ?? 0;
+ return ((Popup)bindable).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 ButtonFontFamilyProperty = BindableProperty.Create("ButtonFontFamily", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonFontFamilyProperty = BindableProperty.Create(nameof(ButtonFontFamily), typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Text.FontFamily = (string)newValue;
instance.btGroup.ItemFontFamily = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.FontFamily.All;
+ return ((Popup)bindable).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 ButtonTextColorProperty = BindableProperty.Create("ButtonTextColor", typeof(Color), typeof(Popup), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonTextColorProperty = BindableProperty.Create(nameof(ButtonTextColor), typeof(Color), typeof(Popup), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
- {
- if (instance.Style.Buttons.Text.TextColor == null)
- {
- instance.Style.Buttons.Text.TextColor = new Selector<Color>();
- }
- instance.Style.Buttons.Text.TextColor.All = (Color)newValue;
+ {
instance.btGroup.ItemTextColor = (Color)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.TextColor?.All;
+ return ((Popup)bindable).btGroup.ItemTextColor;
});
/// 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 ButtonOverLayBackgroundColorSelectorProperty = BindableProperty.Create("ButtonOverLayBackgroundColorSelector", typeof(Selector<Color>), typeof(Popup), new Selector<Color>(), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonOverLayBackgroundColorSelectorProperty = BindableProperty.Create(nameof(ButtonOverLayBackgroundColorSelector), typeof(Selector<Color>), typeof(Popup), new Selector<Color>(), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
instance.btGroup.OverLayBackgroundColorSelector = (Selector<Color>)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Overlay?.BackgroundColor;
+ return ((Popup)bindable).btGroup.OverLayBackgroundColorSelector;
});
/// 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 ButtonTextAlignmentProperty = BindableProperty.Create("ButtonTextAlignment", typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonTextAlignmentProperty = BindableProperty.Create(nameof(ButtonTextAlignment), typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
instance.btGroup.ItemTextAlignment = (HorizontalAlignment)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return ((Popup)bindable).btGroup.ItemTextAlignment;
});
/// 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 ButtonBackgroundProperty = BindableProperty.Create("ButtonBackground", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonBackgroundProperty = BindableProperty.Create(nameof(ButtonBackground), typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.BackgroundImage == null)
- {
- instance.Style.Buttons.BackgroundImage = new Selector<string>();
- }
instance.btGroup.ItemBackgroundImageUrl = (string)newValue;
- instance.Style.Buttons.BackgroundImage = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.BackgroundImage?.All;
+ return ((Popup)bindable).btGroup.ItemBackgroundImageUrl;
});
/// 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 ButtonBackgroundBorderProperty = BindableProperty.Create("ButtonBackgroundBorder", typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonBackgroundBorderProperty = BindableProperty.Create(nameof(ButtonBackgroundBorder), typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.BackgroundImageBorder == null)
- {
- instance.Style.Buttons.BackgroundImageBorder = new Selector<Rectangle>();
- }
- instance.Style.Buttons.BackgroundImageBorder = (Rectangle)newValue;
instance.btGroup.ItemBackgroundBorder = (Rectangle)newValue;
}
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.BackgroundImageBorder?.All;
- });
-
- /// 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 ButtonShadowProperty = BindableProperty.Create("ButtonShadow", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var instance = (Popup)bindable;
- if (newValue != null)
- {
- if (instance.Style.Buttons.Shadow.ResourceUrl == null)
- {
- instance.Style.Buttons.Shadow.ResourceUrl = new Selector<string>();
- }
- instance.btGroup.ItemShadowUrl = (string)newValue;
- instance.Style.Buttons.Shadow.ResourceUrl = (string)newValue;
- }
- },
- defaultValueCreator: (bindable) =>
- {
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Shadow?.ResourceUrl?.All;
+ return ((Popup)bindable).btGroup.ItemBackgroundBorder;
});
/// 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 ButtonShadowBorderProperty = BindableProperty.Create("ButtonShadowBorder", typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonImageShadowProperty = BindableProperty.Create(nameof(ButtonImageShadow), typeof(ImageShadow), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
- if (newValue != null)
- {
- if (instance.Style.Buttons.Shadow.Border == null)
- {
- instance.Style.Buttons.Shadow.Border = new Selector<Rectangle>();
- }
- instance.btGroup.ItemShadowBorder = (Rectangle)newValue;
- instance.Style.Buttons.Shadow.Border = (Rectangle)newValue;
- }
+ ImageShadow shadow = (ImageShadow)newValue;
+ instance.btGroup.ItemImageShadow = new ImageShadow(shadow);
},
defaultValueCreator: (bindable) =>
{
- var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Shadow?.Border?.All;
+ return ((Popup)bindable).btGroup.ItemImageShadow;
});
private TextLabel titleText;
private ButtonGroup btGroup = null;
private Window window = null;
+ private Layer container = new Layer();
+ private ButtonStyle buttonStyle = new ButtonStyle();
+
+ static Popup() { }
/// <summary>
/// Creates a new instance of a Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public Popup() : base()
{
- Initialize();
}
/// <summary>
/// Creates a new instance of a Popup with style.
/// </summary>
/// <param name="style">Create Popup by special style defined in UX.</param>
- /// <since_tizen> 6 </since_tizen>
- /// 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 Popup(string style) : base(style)
{
- Initialize();
}
/// <summary>
- /// Creates a new instance of a Popup with attributes.
+ /// Creates a new instance of a Popup with style.
/// </summary>
- /// <param name="attributes">Create Popup by attributes customized by user.</param>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <param name="popupStyle">Create Popup by style customized by user.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Popup(PopupStyle attributes) : base(attributes)
+ public Popup(PopupStyle popupStyle) : base(popupStyle)
{
- Initialize();
}
/// 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 Post(Window win)
+ public virtual void Post(Window targetWindow)
{
- window = win;
- window.Add(this);
+ if (targetWindow == null)
+ {
+ return;
+ }
+
+ window = targetWindow;
+ window.AddLayer(container);
+ container.RaiseToTop();
}
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// Dismiss the dialog
+ /// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public void AddButton(string buttonText)
+ public virtual void Dismiss()
{
- if (Style.Buttons != null)
+ if (window == null)
{
- Button btn = new Button(Style.Buttons);
- btn.Style.Text.Text = buttonText;
- btn.ClickEvent += ButtonClickEvent;
- btGroup.AddItem(btn);
- UpdateView();
+ return;
}
+
+ window.RemoveLayer(container);
+ window = null;
}
/// 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 AddButton(string buttonText)
+ {
+ Button btn = new Button(buttonStyle);
+ btn.Text = buttonText;
+ btn.ClickEvent += ButtonClickEvent;
+ btGroup.AddItem(btn);
+ UpdateView();
+ }
+
+ /// <summary>
+ /// Add button by style's name.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
public void AddButton(string buttonText, string style)
{
AddButton(buttonText);
}
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// Add button by style.
+ /// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void AddButton(string buttonText, ButtonStyle style)
{
- if (Style.Buttons != null && style != null)
- {
- Style.Buttons.CopyFrom(style);
- AddButton(buttonText);
- }
+ Button btn = new Button(style);
+ btn.Text = buttonText;
+ btn.ClickEvent += ButtonClickEvent;
+ btGroup.AddItem(btn);
+ UpdateView();
}
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
/// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public event EventHandler<ButtonClickEventArgs> PopupButtonClickEvent;
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// Popup Title.
+ /// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new PopupStyle Style => ViewStyle as PopupStyle;
+ public TextLabel Title
+ {
+ get
+ {
+ if (null == titleText)
+ {
+ titleText = new TextLabel
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Bottom,
+ Text = "Title"
+ };
+ Add(titleText);
+ }
+ return titleText;
+ }
+ internal set
+ {
+ titleText = value;
+ }
+ }
/// <summary>
/// Title text string in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public string TitleText
{
get
{
- return Style?.Title?.Text?.All;
+ return GetValue(TitleTextProperty) as string;
}
set
{
- if (value != null)
- {
- if (Style.Title.Text == null)
- {
- Style.Title.Text = new Selector<string>();
- }
- Style.Title.Text.All = value;
- }
+ SetValue(TitleTextProperty, value);
+ NotifyPropertyChanged();
}
}
+ private string InternalTitleText
+ {
+ get => Title.Text;
+ set => Title.Text = value;
+ }
/// <summary>
/// Title text point size in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public float TitlePointSize
{
get
{
- return Style?.Title?.PointSize?.All ?? 0;
+ return (float)GetValue(TitlePointSizeProperty);
}
set
{
- if (Style.Title.PointSize == null)
- {
- Style.Title.PointSize = new Selector<float?>();
- }
- Style.Title.PointSize.All = value;
+ SetValue(TitlePointSizeProperty, value);
+ NotifyPropertyChanged();
}
}
+ private float InternalTitlePointSize
+ {
+ get => Title.PointSize;
+ set => Title.PointSize = value;
+ }
/// <summary>
/// Title text color in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public Color TitleTextColor
{
get
{
- return Style?.Title?.TextColor?.All;
+ return GetValue(TitleTextColorProperty) as Color;
}
set
{
- if (Style.Title.TextColor == null)
- {
- Style.Title.TextColor = new Selector<Color>();
- }
- Style.Title.TextColor.All = value;
+ SetValue(TitleTextColorProperty, value);
+ NotifyPropertyChanged();
}
}
+ private Color InternalTitleTextColor
+ {
+ get => Title.TextColor;
+ set => Title.TextColor = value;
+ }
/// <summary>
/// Title text horizontal alignment in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public HorizontalAlignment TitleTextHorizontalAlignment
{
get
{
- return Style?.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return (HorizontalAlignment)GetValue(TitleTextHorizontalAlignmentProperty);
}
set
{
- Style.Title.HorizontalAlignment = value;
+ SetValue(TitleTextHorizontalAlignmentProperty, value);
+ NotifyPropertyChanged();
}
}
+ private HorizontalAlignment InternalTitleTextHorizontalAlignment
+ {
+ get => Title.HorizontalAlignment;
+ set => Title.HorizontalAlignment = value;
+ }
/// <summary>
/// Title text's position in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public Position TitleTextPosition
{
get
{
- return Style?.Title?.Position ?? new Position(0, 0, 0);
+ return GetValue(TitleTextPositionProperty) as Position;
}
set
{
- Style.Title.Position = value;
+ SetValue(TitleTextPositionProperty, value);
+ NotifyPropertyChanged();
}
}
+ private Position InternalTitleTextPosition
+ {
+ get => Title.Position;
+ set => Title.Position = value;
+ }
/// <summary>
/// Title text's height in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public int TitleHeight
{
get
{
- return (int)(Style?.Title?.Size?.Height ?? 0);
+ return (int)GetValue(TitleHeightProperty);
}
set
{
- Style.Title.Size.Height = value;
+ SetValue(TitleHeightProperty, value);
+ NotifyPropertyChanged();
}
}
+ private int InternalTitleHeight
+ {
+ get => (int)Title.SizeHeight;
+ set => Title.SizeHeight = (int)value;
+ }
/// <summary>
/// Content view in Popup, only can be gotten.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public View ContentView
{
get;
/// Button count in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public int ButtonCount
{
- get;
- set;
+ get
+ {
+ return (int)GetValue(ButtonCountProperty);
+ }
+ set
+ {
+ SetValue(ButtonCountProperty, value);
+ NotifyPropertyChanged();
+ }
}
-
- /// <summary>
- /// Shadow offset in Popup, including left, right, up and bottom offset.
- /// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// 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 ShadowOffset
+ private int InternalButtonCount
{
get;
set;
/// Button height in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public int ButtonHeight
{
get
/// Button text point size in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public float ButtonTextPointSize
{
get
/// Button text font family in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public string ButtonFontFamily
{
get
- {
+ {
return (string)GetValue(ButtonFontFamilyProperty);
}
set
/// Button text color in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public Color ButtonTextColor
{
get
/// Button text horizontal alignment in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public HorizontalAlignment ButtonTextAlignment
{
get
- {
+ {
return (HorizontalAlignment)GetValue(ButtonTextAlignmentProperty);
}
set
public string ButtonBackground
{
get
- {
+ {
return (string)GetValue(ButtonBackgroundProperty);
}
set
{
get
{
-
+
return (Rectangle)GetValue(ButtonBackgroundBorderProperty);
}
set
}
/// <summary>
- /// Button shadow's resource url in Popup.
+ /// Button's image shadow in Popup.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// 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 ButtonShadow
+ public ImageShadow ButtonImageShadow
{
- get
- {
- return (string)GetValue(ButtonShadowProperty);
- }
- set
- {
- SetValue(ButtonShadowProperty, value);
- }
+ get => (ImageShadow)GetValue(ButtonImageShadowProperty);
+ set => SetValue(ButtonImageShadowProperty, value);
}
- /// <summary>
- /// Button shadow's border in Popup.
- /// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// 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 ButtonShadowBorder
- {
- get
- {
-
- return (Rectangle)GetValue(ButtonShadowBorderProperty);
- }
- set
- {
- SetValue(ButtonShadowBorderProperty, value);
- }
- }
/// <summary>
/// Set button text by index.
/// <param name="index">Button index.</param>
/// <param name="text">Button text string.</param>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public void SetButtonText(int index, string text)
- {}
+ {
+ AddButton(text);
+ }
/// <summary>
/// Dispose Popup and all children on it.
/// </summary>
/// <param name="type">Dispose type.</param>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
+#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
protected override void Dispose(DisposeTypes type)
+#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
{
if (disposed)
{
btGroup.Dispose();
btGroup = null;
}
+
+ buttonStyle?.Dispose();
}
base.Dispose(type);
base.OnFocusLost();
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// Apply style to popup.
+ /// </summary>
+ /// <param name="viewStyle">The style to apply.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public override void ApplyStyle(ViewStyle viewStyle)
{
base.ApplyStyle(viewStyle);
- PopupStyle ppStyle = viewStyle as PopupStyle;
- if (null != ppStyle)
+
+ if (viewStyle is PopupStyle ppStyle)
{
- if (null == titleText)
+ if (ppStyle.Buttons?.SizeHeight != null)
{
- titleText = new TextLabel();
- Add(titleText);
+ ButtonHeight = (int)ppStyle.Buttons.SizeHeight;
}
- titleText.RaiseToTop();
- titleText.ApplyStyle(ppStyle.Title);
+
+ buttonStyle = (ButtonStyle)ppStyle.Buttons?.Clone();
+ if (buttonStyle.PositionUsesPivotPoint == null) buttonStyle.PositionUsesPivotPoint = true;
+ if (buttonStyle.ParentOrigin == null) buttonStyle.ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft;
+ if (buttonStyle.PivotPoint == null) buttonStyle.PivotPoint = Tizen.NUI.PivotPoint.BottomLeft;
+
+ if (btGroup != null)
+ {
+ for (int i = 0; i < btGroup.Count; i++)
+ {
+ var button = GetButton(i);
+ button.ApplyStyle(buttonStyle);
+ }
+ }
+
+ Title.ApplyStyle(ppStyle.Title);
+ Title.RaiseToTop();
}
}
/// <summary>
- /// Get Popup attribues.
+ /// Get Popup style.
/// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <returns>The default popup style.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
- protected override ViewStyle GetViewStyle()
+ protected override ViewStyle CreateViewStyle()
{
return new PopupStyle();
}
- /// <summary>
- /// Theme change callback when theme is changed, this callback will be trigger.
- /// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ protected override void OnUpdate()
{
- PopupStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as PopupStyle;
- if (tempAttributes != null)
- {
- string strSaveTitleText = TitleText;
- Style.CopyFrom(tempAttributes);
- Style.Title.Text = strSaveTitleText;
- UpdateView();
- }
+ base.OnUpdate();
+ UpdateView();
}
- private void Initialize()
+ /// <summary>
+ /// Initialize AT-SPI object.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void OnInitialize()
{
+ base.OnInitialize();
+ AccessibilityRole = Role.Dialog;
+
+ container.Add(this);
+ container.SetTouchConsumed(true);
+ container.SetHoverConsumed(true);
+
LeaveRequired = true;
- PropertyChanged += PopupAttributesPropertyChanged;
+ PropertyChanged += PopupStylePropertyChanged;
// ContentView
ContentView = new View()
Add(ContentView);
ContentView.RaiseToTop();
- // Title
- if (null == titleText)
- {
- titleText = new TextLabel();
- titleText.RaiseToTop();
- Add(titleText);
- }
-
// Button
btGroup = new ButtonGroup(this);
}
+ /// <summary>
+ /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override AccessibilityStates AccessibilityCalculateStates()
+ {
+ var states = base.AccessibilityCalculateStates();
+
+ states[AccessibilityState.Modal] = true;
+
+ return states;
+ }
+
private void UpdateView()
{
- UpdateShadowExtens();
- btGroup.UpdateButton(Style.Buttons);
+ btGroup.UpdateButton(buttonStyle);
UpdateContentView();
UpdateTitle();
}
}
}
- private void PopupAttributesPropertyChanged(object sender, PropertyChangedEventArgs e)
+ private void PopupStylePropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName.Equals("LayoutDirection"))
+ if (e.PropertyName is var propName && propName != null && propName.Equals("LayoutDirection"))
{
- btGroup.UpdateButton(Style.Buttons);
+ btGroup.UpdateButton(buttonStyle);
}
}
int titleY = 0;
int titleH = 0;
int buttonH = 0;
- string strText = Style.Title.Text.All;
- if ((strText != null && strText != "") && Style.Title.Size != null)
+ string strText = Title.Text;
+ if (!string.IsNullOrEmpty(strText) && Title.Size != null)
{
titleH = (int)titleText.Size.Height;
}
- if ((strText != null && strText != "") && Style.Title.Position != null)
+ if (!string.IsNullOrEmpty(strText) && Title.Position != null)
{
- titleX = (int)Style.Title.Position.X;
- titleY = (int)Style.Title.Position.Y;
+ titleX = (int)Title.Position.X;
+ titleY = (int)Title.Position.Y;
}
if (btGroup.Count != 0)
{
- buttonH = (int)Style.Buttons.Size.Height;
+ buttonH = ButtonHeight;
}
ContentView.Size = new Size(Size.Width - titleX * 2, Size.Height - titleY - titleH - buttonH);
ContentView.Position = new Position(titleX, titleY + titleH);
ContentView.RaiseToTop();
}
- private void UpdateShadowExtens()
- {
- if (Style.ShadowExtents != null)
- {
- Style.Shadow.Size = new Size(Size.Width + Style.ShadowExtents.Start + Style.ShadowExtents.End, Size.Height + Style.ShadowExtents.Top + Style.ShadowExtents.Bottom);
- }
- }
-
private void UpdateTitle()
{
- if (titleText != null && Style.Title.Text.All != "" && Style.Title.Size != null)
+ if (titleText != null && string.IsNullOrEmpty(Title.Text) && Title.Size != null)
{
titleText.RaiseToTop();
}
/// ButtonClickEventArgs is a class to record button click event arguments which will sent to user.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
public class ButtonClickEventArgs : EventArgs
{
/// <summary> Button index which is clicked in Popup </summary>
/// <since_tizen> 6 </since_tizen>
+ /// It will be removed in API10
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public int ButtonIndex;
}
}