diff options
author | Seunghyun Choi <sh4682.choi@samsung.com> | 2016-12-21 18:11:54 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-07-10 11:11:16 +0900 |
commit | b1401b312d784490474d60fae4bbc59edd35fa79 (patch) | |
tree | 5703078b958d67cfa1a41ac9b4882094da791be8 /Xamarin.Forms.Platform.Tizen/Native | |
parent | dec707f392d886c891cd7dcde64eafdfec036cd7 (diff) | |
download | xamarin-forms-b1401b312d784490474d60fae4bbc59edd35fa79.tar.gz xamarin-forms-b1401b312d784490474d60fae4bbc59edd35fa79.tar.bz2 xamarin-forms-b1401b312d784490474d60fae4bbc59edd35fa79.zip |
Add Button Style
- Add Button Style(Circle, Bottom)
- Approval of the RFC is required.
(http://suprem.sec.samsung.net/confluence/display/SPTDTLC/%5BFormsTizen%5D+RFC+2+-+Button+Style)
Change-Id: I545e0cc2417298f90468b651030937665f547105
Signed-off-by: Seunghyun Choi <sh4682.choi@samsung.com>
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Native')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Native/Button.cs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Button.cs b/Xamarin.Forms.Platform.Tizen/Native/Button.cs index 8f85da63..71ec0c10 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/Button.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/Button.cs @@ -20,7 +20,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native /// <summary> /// The internal padding of the button, helps to determine the size. /// </summary> - readonly ESize _internalPadding; + ESize _internalPadding; /// <summary> /// Optional image, if set will be drawn on the button. @@ -201,6 +201,18 @@ namespace Xamarin.Forms.Platform.Tizen.Native var padding = _internalPadding; + if (Style == "circle") + { + var circleTextPadding = (EdjeObject["icon_text_padding"]?.Geometry.Height).GetValueOrDefault(0); + var circleHeight = padding.Height + ((rawSize.Width == 0) ? 0 : circleTextPadding + formattedSize.Height); + + return new ESize + { + Width = padding.Width, + Height = circleHeight + }; + } + if (rawSize.Width > availableWidth) { // if the raw text width is larger than the available width, use @@ -299,5 +311,30 @@ namespace Xamarin.Forms.Platform.Tizen.Native SetPartContent("icon", _image); } } + + public void UpdateStyle(string style) + { + if (Style != style) + { + Style = style; + + if (Style == "circle") + { + var circleSize = (EdjeObject["bg"]?.Geometry.Width).GetValueOrDefault(0); + _internalPadding = new ESize(circleSize, circleSize); + _span.HorizontalTextAlignment = TextAlignment.Center; + } + else if (Style == "bottom") + { + _internalPadding = GetInternalPadding(); + _span.HorizontalTextAlignment = TextAlignment.Auto; + } + else + { + _span.HorizontalTextAlignment = TextAlignment.Auto; + } + ApplyTextAndStyle(); + } + } } } |