/// User can handle Popup button count, head title and content area.
/// </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public 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 ButtonCountProperty = BindableProperty.Create("ButtonCount", typeof(int), typeof(Popup), 0, 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 ((int)newValue != instance.buttonCount)
+ if (newValue != null && instance?.popupStyle?.Buttons?.Size != null )
{
- instance.buttonCount = (int)newValue;
- instance.UpdateButton();
+ instance.popupStyle.Buttons.Size.Height = (int)newValue;
+ instance.btGroup.Itemheight = (int)newValue;
+ instance.UpdateView();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.buttonCount;
+ return (int)(instance.popupStyle?.Buttons?.Size?.Height ?? 0);
});
/// 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 ShadowOffsetProperty = BindableProperty.Create("ShadowOffset", typeof(Vector4), typeof(Popup), new Vector4(0, 0, 0, 0), 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 (null != instance.Style)
+ if (instance.popupStyle?.Buttons?.Text != null)
{
- instance.Style.ShadowOffset = (Vector4)newValue;
- instance.UpdateShadow();
+ instance.popupStyle.Buttons.Text.PointSize = (float)newValue;
}
+ instance.btGroup.ItemPointSize = (float)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.ShadowOffset;
+ return instance.popupStyle?.Buttons?.Text?.PointSize?.All ?? 0;
});
/// 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 ButtonFontFamilyProperty = BindableProperty.Create(nameof(ButtonFontFamily), typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Size)
- {
- instance.Style.Buttons.Size.Height = (int)newValue;
- instance.UpdateButton();
- }
+ instance.popupStyle.Buttons.Text.FontFamily = (string)newValue;
+ instance.btGroup.ItemFontFamily = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return (int)(instance.Style?.Buttons?.Size?.Height ?? 0);
+ return instance.popupStyle?.Buttons?.Text?.FontFamily.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 ButtonTextPointSizeProperty = BindableProperty.Create("ButtonTextPointSize", typeof(float), typeof(Popup), default(float), 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 (null != instance.Style?.Buttons?.Text)
+ {
+ if (instance.popupStyle?.Buttons?.Text != null)
{
- instance.Style.Buttons.Text.PointSize = (float)newValue;
- instance.UpdateButton();
+ instance.popupStyle.Buttons.Text.TextColor = (Color)newValue;
}
+ instance.btGroup.ItemTextColor = (Color)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Text?.PointSize?.All ?? 0;
+ return instance.popupStyle?.Buttons?.Text?.TextColor?.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 ButtonFontFamilyProperty = BindableProperty.Create("ButtonFontFamily", typeof(string), typeof(Popup), string.Empty, 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)
{
- if (null != instance.Style?.Buttons?.Text)
- {
- instance.Style.Buttons.Text.FontFamily = (string)newValue;
- instance.UpdateButton();
- }
+ instance.popupStyle.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
+ instance.btGroup.OverLayBackgroundColorSelector = (Selector<Color>)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.FontFamily.All;
+ return instance.popupStyle?.Buttons?.Overlay?.BackgroundColor;
});
/// 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 ButtonTextAlignmentProperty = BindableProperty.Create(nameof(ButtonTextAlignment), typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Text)
- {
- instance.Style.Buttons.Text.TextColor = (Color)newValue;
- }
+ instance.popupStyle.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ instance.btGroup.ItemTextAlignment = (HorizontalAlignment)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Text?.TextColor?.All;
+ return instance.popupStyle?.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
});
/// 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 ButtonBackgroundProperty = BindableProperty.Create(nameof(ButtonBackground), typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Overlay)
+ if (instance.popupStyle.Buttons.BackgroundImage == null)
{
- Selector<Color> color = (Selector<Color>)newValue;
- if (null == instance.Style.Buttons.Overlay.BackgroundColor)
- {
- instance.Style.Buttons.Overlay.BackgroundColor = new Selector<Color>();
- }
- instance.Style.Buttons.Overlay.BackgroundColor.Clone(color);
- instance.UpdateButton();
+ instance.popupStyle.Buttons.BackgroundImage = new Selector<string>();
}
+ instance.popupStyle.Buttons.BackgroundColor = new Selector<Color>();
+ instance.popupStyle.Buttons.BackgroundImage = (string)newValue;
+ instance.btGroup.ItemBackgroundImageUrl = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Overlay?.BackgroundColor;
+ return instance.popupStyle?.Buttons?.BackgroundImage?.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 ButtonTextAlignmentProperty = BindableProperty.Create("ButtonTextAlignment", typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), 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 (null != instance.Style?.Buttons?.Text)
+ if (instance.popupStyle.Buttons.BackgroundImageBorder == null)
{
- instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
- instance.UpdateButton();
+ instance.popupStyle.Buttons.BackgroundImageBorder = new Selector<Rectangle>();
}
+ instance.popupStyle.Buttons.BackgroundImageBorder = (Rectangle)newValue;
+ instance.btGroup.ItemBackgroundBorder = (Rectangle)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return instance.popupStyle?.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 ButtonBackgroundProperty = BindableProperty.Create("ButtonBackground", typeof(string), typeof(Popup), string.Empty, 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 (null != instance.Style?.Buttons?.Background)
- {
- instance.Style.Buttons.Background.ResourceUrl = (string)newValue;
- instance.UpdateButton();
- }
- }
+ ImageShadow shadow = (ImageShadow)newValue;
+ instance.btGroup.ItemImageShadow = new ImageShadow(shadow);
+ instance.popupStyle.Buttons.ImageShadow = new ImageShadow(shadow);
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Background?.ResourceUrl?.All;
+ return instance.popupStyle?.Buttons?.ImageShadow?.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 ButtonBackgroundBorderProperty = BindableProperty.Create("ButtonBackgroundBorder", typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
- {
- var instance = (Popup)bindable;
- if (newValue != null)
- {
- if (null != instance.Style?.Buttons?.Background)
- {
- instance.Style.Buttons.Background.Border = (Rectangle)newValue;
- instance.UpdateButton();
- }
- }
- },
- defaultValueCreator: (bindable) =>
- {
- var instance = (Popup)bindable;
- return instance.Style.Buttons?.Background?.Border?.All;
- });
+ private PopupStyle popupStyle => ViewStyle as PopupStyle;
private TextLabel titleText;
- private List<Button> buttonList;
- private List<string> buttonTextList = new List<string>();
-
- private int buttonCount = 0;
+ private ButtonGroup btGroup = null;
+ private Window window = null;
+ private Layer container = new Layer();
+ 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();
/// 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)
{
}
/// <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 virtual void Post(Window targetWindow)
+ {
+ if (targetWindow == null)
+ {
+ return;
+ }
+
+ window = targetWindow;
+ window.AddLayer(container);
+ container.RaiseToTop();
+ }
+
+ /// <summary>
+ /// Dismiss the dialog
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void Dismiss()
+ {
+ if (window == null)
+ {
+ 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)
+ {
+ if (popupStyle.Buttons != null)
+ {
+ Button btn = new Button(popupStyle.Buttons);
+ 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);
+ }
+
+ /// <summary>
+ /// Add button by style.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddButton(string buttonText, ButtonStyle style)
+ {
+ if (popupStyle.Buttons != null && style != null)
+ {
+ popupStyle.Buttons.CopyFrom(style);
+ AddButton(buttonText);
+ }
+ }
+
+ /// 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 GetButton(int index)
+ {
+ return btGroup.GetItem(index);
+ }
+
+ /// 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 RemoveButton(int index)
+ {
+ btGroup.RemoveItem(index);
+ }
+
+ /// 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 AddContentText(View childView)
+ {
+ if (null != ContentView)
+ {
+ ContentView.Add(childView);
+ }
+ UpdateView();
+ }
+
/// <summary>
/// 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>
+ /// Get style of popup.
+ /// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new PopupStyle Style => ViewStyle as PopupStyle;
+ public new PopupStyle Style
+ {
+ get
+ {
+ var result = new PopupStyle(popupStyle);
+ result.CopyPropertiesFromView(this);
+ result.Title.CopyPropertiesFromView(titleText);
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Popup Title.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextLabel Title
+ {
+ get
+ {
+ if (null == titleText)
+ {
+ titleText = new TextLabel();
+ 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 popupStyle?.Title?.Text?.All;
}
set
{
- if (null != Style?.Title)
+ if (value != null)
{
- Style.Title.Text = value;
+ if (popupStyle?.Title != null)
+ {
+ popupStyle.Title.Text = value;
+ }
}
}
}
/// 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 popupStyle?.Title?.PointSize?.All ?? 0;
}
set
{
- if (null != Style?.Title)
+ if (popupStyle?.Title != null)
{
- Style.Title.PointSize = value;
+ popupStyle.Title.PointSize = value;
}
}
}
/// 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 popupStyle?.Title?.TextColor?.All;
}
set
{
- if (null != Style?.Title)
+ if (popupStyle?.Title != null)
{
- Style.Title.TextColor = value;
+ popupStyle.Title.TextColor = value;
}
}
}
/// 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 popupStyle?.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
}
set
{
- Style.Title.HorizontalAlignment = value;
+ popupStyle.Title.HorizontalAlignment = value;
}
}
/// 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 popupStyle?.Title?.Position ?? new Position(0, 0, 0);
}
set
{
- Style.Title.Position = value;
+ popupStyle.Title.Position = value;
}
}
/// 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)(popupStyle?.Title?.Size?.Height ?? 0);
}
set
{
- Style.Title.Size.Height = value;
+ if (popupStyle?.Title?.Size != null)
+ {
+ popupStyle.Title.Size.Height = value;
+ }
}
}
/// 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
- {
- return (int)GetValue(ButtonCountProperty);
- }
- set
- {
- SetValue(ButtonCountProperty, value);
- }
- }
-
- /// <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
- {
- get
- {
- return (Vector4)GetValue(ShadowOffsetProperty);
- }
- set
- {
- SetValue(ShadowOffsetProperty, value);
- }
+ get;
+ set;
}
/// <summary>
/// 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
/// 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
/// <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 ButtonBackgroundImageURL
+ public string ButtonBackground
{
get
{
/// <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 ButtonBackgroundImageBorder
+ public Rectangle ButtonBackgroundBorder
{
get
{
}
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// 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 new Size2D Size2D
+ public ImageShadow ButtonImageShadow
{
- get
- {
- return base.Size2D;
- }
- set
- {
- base.Size2D = value;
- UpdateShadow();
- }
+ get => (ImageShadow)GetValue(ButtonImageShadowProperty);
+ set => SetValue(ButtonImageShadowProperty, value);
}
+
/// <summary>
/// Set button text by index.
/// </summary>
/// <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)
{
- if(index < 0 && index >= buttonCount)
- {
- return;
- }
- if(buttonTextList.Count < index + 1)
- {
- for (int i = buttonTextList.Count; i < index + 1; i++)
- {
- buttonTextList.Add("");
- }
- }
- buttonTextList[index] = text;
- UpdateButton();
+ AddButton(text);
}
/// <summary>
/// </summary>
/// <param name="type">Dispose type.</param>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
protected override void Dispose(DisposeTypes type)
{
if (disposed)
ContentView.Dispose();
ContentView = null;
}
- if (buttonList != null)
+
+ if (btGroup != null)
{
- foreach(Button btn in buttonList)
- {
- Remove(btn);
- btn.Dispose();
- }
+ btGroup.Dispose();
+ btGroup = null;
}
}
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 popupStyle = viewStyle as PopupStyle;
-
- if (null != popupStyle)
+ PopupStyle ppStyle = viewStyle as PopupStyle;
+ if (null != ppStyle)
{
- if (null == titleText)
- {
- titleText = new TextLabel();
- Add(titleText);
- }
-
- titleText.ApplyStyle(Style.Title);
+ 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.
+ /// <param name="sender">The sender</param>
+ /// <param name="e">The event data</param>
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- PopupStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as PopupStyle;
- if (tempAttributes != null)
+ PopupStyle ppStyle = StyleManager.Instance.GetViewStyle(StyleName) as PopupStyle;
+ if (ppStyle != null)
{
- Style.CopyFrom(tempAttributes);
- RelayoutRequest();
+ ApplyStyle(ppStyle);
+ UpdateView();
}
}
private void Initialize()
{
+ container.Add(this);
+ container.SetTouchConsumed(true);
+ container.SetHoverConsumed(true);
+
LeaveRequired = true;
+ PropertyChanged += PopupStylePropertyChanged;
// ContentView
ContentView = new View()
Add(ContentView);
ContentView.RaiseToTop();
- // Title
- if (null == titleText)
- {
- titleText = new TextLabel();
- Add(titleText);
- }
-
- buttonList = new List<Button>();
+ // Button
+ btGroup = new ButtonGroup(this);
}
- private void UpdateButton()
+ private void UpdateView()
{
- if (buttonCount <= 0) return;
- if (null == buttonTextList || buttonTextList.Count != buttonCount) return;
-
- if (null != buttonList)
- {
- foreach (Button btn in buttonList)
- {
- if (null != btn)
- {
- btn.ClickEvent -= ButtonClickEvent;
- this.Remove(btn);
- btn.Dispose();
- }
- }
- buttonList.Clear();
- }
-
- int sizeWidth = Size2D?.Width ?? 0;
- int buttonWidth = sizeWidth / buttonCount;
- int buttonHeight = (int)(Style?.Buttons?.Size?.Height ?? 0);
- for (int i = 0; i < buttonCount; i++)
- {
- Button btn = new Button(Style?.Buttons);
- btn.Size2D = new Size2D(buttonWidth, buttonHeight);
- btn.Style.Text.Text = buttonTextList[i];
- btn.ClickEvent += ButtonClickEvent;
-
- this.Add(btn);
- buttonList.Add(btn);
- }
-
- int pos = 0;
- if (null != buttonList && buttonList.Count > 0)
- {
- if (LayoutDirection == ViewLayoutDirectionType.RTL)
- {
- for (int i = buttonList.Count - 1; i >= 0; i--)
- {
- buttonList[i].PositionX = pos;
- pos += buttonList[i].Size2D.Width;
- }
- }
- else
- {
- for (int i = 0; i < buttonList.Count; i++)
- {
- buttonList[i].PositionX = pos;
- pos += buttonList[i].Size2D.Width;
- }
- }
- }
-
+ btGroup.UpdateButton(popupStyle.Buttons);
UpdateContentView();
+ UpdateTitle();
}
private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
{
- if (PopupButtonClickEvent != null && buttonList != null)
+ if (PopupButtonClickEvent != null && btGroup.Count > 0)
{
Button button = sender as Button;
- for (int i = 0; i < buttonList.Count; i++)
+ for (int i = 0; i < btGroup.Count; i++)
{
- if(button == buttonList[i])
+ if (button == GetButton(i))
{
ButtonClickEventArgs args = new ButtonClickEventArgs();
args.ButtonIndex = i;
}
}
}
- private void UpdateShadow()
+
+ private void PopupStylePropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (Style.ShadowOffset == null) return;
- int w = 0;
- int h = 0;
- if (Style.Shadow != null)
+ if (e.PropertyName.Equals("LayoutDirection"))
{
- w = (int)(Size2D.Width + Style.ShadowOffset.W + Style.ShadowOffset.X);
- h = (int)(Size2D.Height + Style.ShadowOffset.Y + Style.ShadowOffset.Z);
-
- shadowImage.Size2D = new Size2D(w, h);
+ btGroup.UpdateButton(popupStyle.Buttons);
}
}
- private void UpdateTitle()
+ private void UpdateContentView()
{
- int w = 0;
- int h = 0;
int titleX = 0;
int titleY = 0;
int titleH = 0;
int buttonH = 0;
-
- if (Style.Title != null)
+ string strText = Title.Text;
+ if (!string.IsNullOrEmpty(strText) && Title.Size != null)
{
- if (titleText.Text != null && titleText.Text != "")
- {
- Style.Title.Text = new Selector<string> { All = titleText.Text };
- w = (int)(Size2D.Width - titleText.PositionX * 2);
-
- if (Style.Title.Size != null)
- {
- titleH = (int)titleText.Size.Height;
- }
- titleText.Size2D = new Size2D(w, titleH);
- }
- else
- {
- titleText.Size2D = new Size2D(0, 0);
- }
+ titleH = (int)titleText.Size.Height;
}
- if (titleText != null)
+ if (!string.IsNullOrEmpty(strText) && Title.Position != null)
{
- if (LayoutDirection == ViewLayoutDirectionType.RTL)
- {
- if (Style.Title != null)
- {
- Style.Title.HorizontalAlignment = HorizontalAlignment.End;
- }
- titleText.HorizontalAlignment = HorizontalAlignment.End;
- }
- else if (LayoutDirection == ViewLayoutDirectionType.LTR)
- {
- if (Style.Title != null)
- {
- Style.Title.HorizontalAlignment = HorizontalAlignment.Begin;
- }
- titleText.HorizontalAlignment = HorizontalAlignment.Begin;
- }
+ titleX = (int)Title.Position.X;
+ titleY = (int)Title.Position.Y;
}
- UpdateContentView();
+ if (btGroup.Count != 0 && popupStyle?.Buttons?.Size != null )
+ {
+ buttonH = (int)popupStyle.Buttons.Size.Height;
+ }
+ ContentView.Size = new Size(Size.Width - titleX * 2, Size.Height - titleY - titleH - buttonH);
+ ContentView.Position = new Position(titleX, titleY + titleH);
+ ContentView.RaiseToTop();
}
- private void UpdateContentView()
+ private void UpdateTitle()
{
- int titleX = 0;
- int titleY = 0;
- int titleH = 0;
- if (Style.Title.Size != null)
- {
- titleH = (int)titleText.Size.Height;
- }
- if (Style.Title.Position != null)
+ if (titleText != null && string.IsNullOrEmpty(popupStyle.Title.Text.All) && popupStyle.Title.Size != null)
{
- titleX = (int)Style.Title.Position.X;
- titleY = (int)Style.Title.Position.Y;
+ titleText.RaiseToTop();
}
- int buttonH = (int)Style.Buttons.Size.Height;
-
- ContentView.Size2D = new Size2D(Size2D.Width - titleX * 2, Size2D.Height - titleY - titleH - buttonH);
- ContentView.Position2D = new Position2D(titleX, titleY + titleH);
- ContentView.RaiseToTop();
}
-
/// <summary>
/// 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")]
public class ButtonClickEventArgs : EventArgs
{
/// <summary> Button index which is clicked in Popup </summary>
/// <since_tizen> 6 </since_tizen>
+ [Obsolete("Deprecated in API8; Will be removed in API10")]
public int ButtonIndex;
}
}