2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Binding;
22 namespace Tizen.NUI.Components
25 /// Button is one kind of common component, a button clearly describes what action will occur when the user selects it.
26 /// Button may contain text or an icon.
28 /// <since_tizen> 6 </since_tizen>
29 public class Button : Control
31 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
32 [EditorBrowsable(EditorBrowsableState.Never)]
33 public static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create("IconRelativeOrientation", typeof(IconOrientation?), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
35 var instance = (Button)bindable;
38 instance.privateIconRelativeOrientation = (IconOrientation?)newValue;
41 defaultValueCreator: (bindable) =>
43 var instance = (Button)bindable;
44 return instance.privateIconRelativeOrientation;
46 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
47 [EditorBrowsable(EditorBrowsableState.Never)]
48 public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
50 var instance = (Button)bindable;
53 instance.privateIsEnabled = (bool)newValue;
56 defaultValueCreator: (bindable) =>
58 var instance = (Button)bindable;
59 return instance.privateIsEnabled;
61 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create("IsSelected", typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
65 var instance = (Button)bindable;
68 instance.privateIsSelected = (bool)newValue;
71 defaultValueCreator: (bindable) =>
73 var instance = (Button)bindable;
74 return instance.privateIsSelected;
76 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create("IsSelectable", typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
80 var instance = (Button)bindable;
83 instance.privateIsSelectable = (bool)newValue;
86 defaultValueCreator: (bindable) =>
88 var instance = (Button)bindable;
89 return instance.privateIsSelectable;
91 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public static readonly BindableProperty IconPaddingProperty = BindableProperty.Create("IconPadding", typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
95 var instance = (Button)bindable;
96 if (null != newValue && null != instance.Style?.IconPadding)
98 instance.Style.IconPadding.CopyFrom((Extents)newValue);
99 instance.UpdateUIContent();
102 defaultValueCreator: (bindable) =>
104 var instance = (Button)bindable;
105 return instance.Style?.IconPadding;
107 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public static readonly BindableProperty TextPaddingProperty = BindableProperty.Create("TextPadding", typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
111 var instance = (Button)bindable;
112 if (null != newValue && null != instance.Style?.TextPadding)
114 instance.Style.TextPadding.CopyFrom((Extents)newValue);
115 instance.UpdateUIContent();
118 defaultValueCreator: (bindable) =>
120 var instance = (Button)bindable;
121 return instance.Style?.TextPadding;
124 private ImageView overlayImage;
126 private TextLabel buttonText;
127 private ImageControl buttonIcon;
129 private EventHandler<StateChangedEventArgs> stateChangeHander;
131 private bool isSelected = false;
132 private bool isEnabled = true;
133 private bool isPressed = false;
136 /// Creates a new instance of a Button.
138 /// <since_tizen> 6 </since_tizen>
139 public Button() : base()
145 /// Creates a new instance of a Button with style.
147 /// <param name="style">Create Button by special style defined in UX.</param>
148 /// <since_tizen> 6 </since_tizen>
149 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
150 [EditorBrowsable(EditorBrowsableState.Never)]
151 public Button(string style) : base(style)
157 /// Creates a new instance of a Button with attributes.
159 /// <param name="controlStyle">Create Button by attributes customized by user.</param>
160 /// <since_tizen> 6 </since_tizen>
161 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
162 [EditorBrowsable(EditorBrowsableState.Never)]
163 public Button(ButtonStyle controlStyle) : base(controlStyle)
169 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
171 /// <since_tizen> 6 </since_tizen>
172 public event EventHandler<ClickEventArgs> ClickEvent;
174 /// An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
176 /// <since_tizen> 6 </since_tizen>
177 public event EventHandler<StateChangedEventArgs> StateChangedEvent
181 stateChangeHander += value;
185 stateChangeHander -= value;
189 /// Icon orientation.
191 /// <since_tizen> 6 </since_tizen>
192 public enum IconOrientation
197 /// <since_tizen> 6 </since_tizen>
202 /// <since_tizen> 6 </since_tizen>
207 /// <since_tizen> 6 </since_tizen>
212 /// <since_tizen> 6 </since_tizen>
216 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public new ButtonStyle Style => ViewStyle as ButtonStyle;
221 /// The text of Button.
223 /// <since_tizen> 6 </since_tizen>
228 return Style?.Text?.Text?.GetValue(ControlState);
232 if (null != Style?.Text)
234 Style.Text.Text = value;
240 /// Flag to decide Button can be selected or not.
242 /// <since_tizen> 6 </since_tizen>
243 public bool IsSelectable
247 return (bool)GetValue(IsSelectableProperty);
251 SetValue(IsSelectableProperty, value);
255 private bool privateIsSelectable
259 return Style?.IsSelectable ?? false;
263 Style.IsSelectable = value;
268 /// Translate text string in Button.
270 /// <since_tizen> 6 </since_tizen>
271 public string TranslatableText
275 return Style?.Text?.TranslatableText?.All;
279 if (null != Style?.Text)
281 Style.Text.TranslatableText = value;
287 /// Text point size in Button.
289 /// <since_tizen> 6 </since_tizen>
290 public float PointSize
294 return Style?.Text?.PointSize?.All ?? 0;
298 if (null != Style?.Text)
300 Style.Text.PointSize = value;
306 /// Text font family in Button.
308 /// <since_tizen> 6 </since_tizen>
309 public string FontFamily
313 return Style?.Text?.FontFamily.All;
317 if (null != Style?.Text)
319 Style.Text.FontFamily = value;
324 /// Text color in Button.
326 /// <since_tizen> 6 </since_tizen>
327 public Color TextColor
331 return Style?.Text?.TextColor?.All;
335 if (null != Style?.Text)
337 Style.Text.TextColor = value;
342 /// Text horizontal alignment in Button.
344 /// <since_tizen> 6 </since_tizen>
345 public HorizontalAlignment TextAlignment
349 return Style?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
353 if (null != Style?.Text)
355 Style.Text.HorizontalAlignment = value;
360 /// Icon image's resource url in Button.
362 /// <since_tizen> 6 </since_tizen>
363 public string IconURL
367 return Style?.Icon?.ResourceUrl?.All;
371 if (null != Style?.Icon)
373 Style.Icon.ResourceUrl = value;
378 private StringSelector textSelector = new StringSelector();
380 /// Text string selector in Button.
382 /// <since_tizen> 6 </since_tizen>
383 public StringSelector TextSelector
391 textSelector.Clone(value);
395 private StringSelector translatableTextSelector = new StringSelector();
397 /// Translateable text string selector in Button.
399 /// <since_tizen> 6 </since_tizen>
400 public StringSelector TranslatableTextSelector
404 return translatableTextSelector;
408 translatableTextSelector.Clone(value);
412 private ColorSelector textColorSelector = new ColorSelector();
414 /// Text color selector in Button.
416 /// <since_tizen> 6 </since_tizen>
417 public ColorSelector TextColorSelector
421 return textColorSelector;
425 textColorSelector.Clone(value);
429 private FloatSelector pointSizeSelector = new FloatSelector();
431 /// Text font size selector in Button.
433 /// <since_tizen> 6 </since_tizen>
434 public FloatSelector PointSizeSelector
438 return pointSizeSelector;
442 pointSizeSelector.Clone(value);
446 private StringSelector iconURLSelector = new StringSelector();
448 /// Icon image's resource url selector in Button.
450 /// <since_tizen> 6 </since_tizen>
451 public StringSelector IconURLSelector
455 return iconURLSelector;
459 iconURLSelector.Clone(value);
464 /// Flag to decide selected state in Button.
466 /// <since_tizen> 6 </since_tizen>
467 public bool IsSelected
471 return (bool)GetValue(IsSelectedProperty);
475 SetValue(IsSelectedProperty, value);
478 private bool privateIsSelected
491 /// Flag to decide enable or disable in Button.
493 /// <since_tizen> 6 </since_tizen>
494 public bool IsEnabled
498 return (bool)GetValue(IsEnabledProperty);
502 SetValue(IsEnabledProperty, value);
505 private bool privateIsEnabled
519 /// Icon relative orientation in Button, work only when show icon and text.
521 /// <since_tizen> 6 </since_tizen>
522 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
523 [EditorBrowsable(EditorBrowsableState.Never)]
524 public IconOrientation? IconRelativeOrientation
528 return (IconOrientation?)GetValue(IconRelativeOrientationProperty);
532 SetValue(IconRelativeOrientationProperty, value);
535 private IconOrientation? privateIconRelativeOrientation
539 return Style?.IconRelativeOrientation;
543 if(Style != null && Style.IconRelativeOrientation != value)
545 Style.IconRelativeOrientation = value;
552 /// Icon padding in Button, work only when show icon and text.
554 /// <since_tizen> 6 </since_tizen>
555 public Extents IconPadding
557 get => (Extents)GetValue(IconPaddingProperty);
558 set => SetValue(IconPaddingProperty, value);
562 /// Text padding in Button, work only when show icon and text.
564 /// <since_tizen> 6 </since_tizen>
565 public Extents TextPadding
567 get => (Extents) GetValue(TextPaddingProperty);
568 set => SetValue(TextPaddingProperty, value);
572 /// Dispose Button and all children on it.
574 /// <param name="type">Dispose type.</param>
575 /// <since_tizen> 6 </since_tizen>
576 protected override void Dispose(DisposeTypes type)
583 if (type == DisposeTypes.Explicit)
585 if (buttonIcon != null)
587 Utility.Dispose(buttonIcon);
589 if (buttonText != null)
591 Utility.Dispose(buttonText);
593 if (overlayImage != null)
595 Utility.Dispose(overlayImage);
602 /// Called after a key event is received by the view that has had its focus set.
604 /// <param name="key">The key event.</param>
605 /// <returns>True if the key event should be consumed.</returns>
606 /// <since_tizen> 6 </since_tizen>
607 public override bool OnKey(Key key)
609 if (key.State == Key.StateType.Down)
611 if (key.KeyPressedName == "Return")
617 ClickEventArgs eventArgs = new ClickEventArgs();
622 else if (key.State == Key.StateType.Up)
624 if (key.KeyPressedName == "Return")
627 if (Style.IsSelectable != null && Style.IsSelectable == true)
629 isSelected = !isSelected;
634 return base.OnKey(key);
638 /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
640 /// <since_tizen> 6 </since_tizen>
641 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
642 [EditorBrowsable(EditorBrowsableState.Never)]
643 public override void OnFocusGained()
645 base.OnFocusGained();
650 /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
652 /// <since_tizen> 6 </since_tizen>
653 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
654 [EditorBrowsable(EditorBrowsableState.Never)]
655 public override void OnFocusLost()
662 /// Tap gesture event callback.
664 /// <param name="source">Source which recieved touch event.</param>
665 /// <param name="e">Tap gesture event argument.</param>
666 /// <since_tizen> 6 </since_tizen>
667 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
668 [EditorBrowsable(EditorBrowsableState.Never)]
669 protected override void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
673 ClickEventArgs eventArgs = new ClickEventArgs();
675 base.OnTapGestureDetected(source, e);
679 /// Called after a touch event is received by the owning view.<br />
680 /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
682 /// <param name="touch">The touch event.</param>
683 /// <returns>True if the event should be consumed.</returns>
684 /// <since_tizen> 6 </since_tizen>
685 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
686 [EditorBrowsable(EditorBrowsableState.Never)]
687 public override bool OnTouch(Touch touch)
689 PointStateType state = touch.GetState(0);
693 case PointStateType.Down:
697 case PointStateType.Interrupted:
701 case PointStateType.Up:
703 if (Style.IsSelectable != null && Style.IsSelectable == true)
705 isSelected = !isSelected;
712 return base.OnTouch(touch);
715 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
716 [EditorBrowsable(EditorBrowsableState.Never)]
717 public override void ApplyStyle(ViewStyle viewStyle)
719 base.ApplyStyle(viewStyle);
721 ButtonStyle buttonStyle = viewStyle as ButtonStyle;
723 if (null != buttonStyle)
725 if (null == overlayImage)
727 overlayImage = new ImageView()
729 WidthResizePolicy = ResizePolicyType.FillToParent,
730 HeightResizePolicy = ResizePolicyType.FillToParent
732 this.Add(overlayImage);
735 if (null == buttonText)
737 buttonText = new TextLabel();
738 this.Add(buttonText);
741 if (null == buttonIcon)
743 buttonIcon = new ImageControl();
744 this.Add(buttonIcon);
747 overlayImage.ApplyStyle(buttonStyle.Overlay);
748 buttonText.ApplyStyle(buttonStyle.Text);
749 buttonIcon.ApplyStyle(buttonStyle.Icon);
754 /// Get Button attribues.
756 /// <since_tizen> 6 </since_tizen>
757 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
758 [EditorBrowsable(EditorBrowsableState.Never)]
759 protected override ViewStyle GetViewStyle()
761 return new ButtonStyle();
764 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
765 [EditorBrowsable(EditorBrowsableState.Never)]
766 protected override void OnUpdate()
773 /// Update Button State.
775 /// <since_tizen> 6 </since_tizen>
776 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
777 [EditorBrowsable(EditorBrowsableState.Never)]
778 protected void UpdateState()
780 ControlStates sourceState = ControlState;
781 ControlStates targetState;
785 targetState = isPressed ? ControlStates.Pressed : (IsFocused ? (IsSelected ? ControlStates.SelectedFocused : ControlStates.Focused) : (IsSelected ? ControlStates.Selected : ControlStates.Normal));
789 targetState = IsSelected ? ControlStates.DisabledSelected : (IsFocused ? ControlStates.DisabledFocused : ControlStates.Disabled);
792 if(sourceState != targetState)
794 ControlState = targetState;
798 StateChangedEventArgs e = new StateChangedEventArgs
800 PreviousState = sourceState,
801 CurrentState = targetState
803 stateChangeHander?.Invoke(this, e);
808 /// It is hijack by using protected, attributes copy problem when class inherited from Button.
810 /// <since_tizen> 6 </since_tizen>
811 private void Initialize()
813 if (null == Style.IconRelativeOrientation) Style.IconRelativeOrientation = IconOrientation.Left;
815 LayoutDirectionChanged += OnLayoutDirectionChanged;
819 /// Measure text, it can be override.
821 /// <since_tizen> 6 </since_tizen>
822 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
823 [EditorBrowsable(EditorBrowsableState.Never)]
824 protected virtual void MeasureText()
826 if (Style.IconRelativeOrientation == null || buttonIcon == null || buttonText == null)
830 buttonText.WidthResizePolicy = ResizePolicyType.Fixed;
831 buttonText.HeightResizePolicy = ResizePolicyType.Fixed;
832 int textPaddingStart = Style.TextPadding.Start;
833 int textPaddingEnd = Style.TextPadding.End;
834 int textPaddingTop = Style.TextPadding.Top;
835 int textPaddingBottom = Style.TextPadding.Bottom;
837 int iconPaddingStart = Style.IconPadding.Start;
838 int iconPaddingEnd = Style.IconPadding.End;
839 int iconPaddingTop = Style.IconPadding.Top;
840 int iconPaddingBottom = Style.IconPadding.Bottom;
842 if (IconRelativeOrientation == IconOrientation.Top || IconRelativeOrientation == IconOrientation.Bottom)
844 buttonText.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd;
845 buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom - iconPaddingTop - iconPaddingBottom - buttonIcon.SizeHeight;
849 buttonText.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd - iconPaddingStart - iconPaddingEnd - buttonIcon.SizeWidth;
850 buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom;
854 /// Layout child, it can be override.
856 /// <since_tizen> 6 </since_tizen>
857 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
858 [EditorBrowsable(EditorBrowsableState.Never)]
859 protected virtual void LayoutChild()
861 if (Style.IconRelativeOrientation == null || buttonIcon == null || buttonText == null)
866 int textPaddingStart = Style.TextPadding.Start;
867 int textPaddingEnd = Style.TextPadding.End;
868 int textPaddingTop = Style.TextPadding.Top;
869 int textPaddingBottom = Style.TextPadding.Bottom;
871 int iconPaddingStart = Style.IconPadding.Start;
872 int iconPaddingEnd = Style.IconPadding.End;
873 int iconPaddingTop = Style.IconPadding.Top;
874 int iconPaddingBottom = Style.IconPadding.Bottom;
876 switch (IconRelativeOrientation)
878 case IconOrientation.Top:
879 buttonIcon.PositionUsesPivotPoint = true;
880 buttonIcon.ParentOrigin = NUI.ParentOrigin.TopCenter;
881 buttonIcon.PivotPoint = NUI.PivotPoint.TopCenter;
882 buttonIcon.Position2D = new Position2D(0, iconPaddingTop);
884 buttonText.PositionUsesPivotPoint = true;
885 buttonText.ParentOrigin = NUI.ParentOrigin.BottomCenter;
886 buttonText.PivotPoint = NUI.PivotPoint.BottomCenter;
887 buttonText.Position2D = new Position2D(0, -textPaddingBottom);
889 case IconOrientation.Bottom:
890 buttonIcon.PositionUsesPivotPoint = true;
891 buttonIcon.ParentOrigin = NUI.ParentOrigin.BottomCenter;
892 buttonIcon.PivotPoint = NUI.PivotPoint.BottomCenter;
893 buttonIcon.Position2D = new Position2D(0, -iconPaddingBottom);
895 buttonText.PositionUsesPivotPoint = true;
896 buttonText.ParentOrigin = NUI.ParentOrigin.TopCenter;
897 buttonText.PivotPoint = NUI.PivotPoint.TopCenter;
898 buttonText.Position2D = new Position2D(0, textPaddingTop);
900 case IconOrientation.Left:
901 if (LayoutDirection == ViewLayoutDirectionType.LTR)
903 buttonIcon.PositionUsesPivotPoint = true;
904 buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft;
905 buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft;
906 buttonIcon.Position2D = new Position2D(iconPaddingStart, 0);
908 buttonText.PositionUsesPivotPoint = true;
909 buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight;
910 buttonText.PivotPoint = NUI.PivotPoint.CenterRight;
911 buttonText.Position2D = new Position2D(-textPaddingEnd, 0);
915 buttonIcon.PositionUsesPivotPoint = true;
916 buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight;
917 buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight;
918 buttonIcon.Position2D = new Position2D(-iconPaddingStart, 0);
920 buttonText.PositionUsesPivotPoint = true;
921 buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
922 buttonText.PivotPoint = NUI.PivotPoint.CenterLeft;
923 buttonText.Position2D = new Position2D(textPaddingEnd, 0);
927 case IconOrientation.Right:
928 if (LayoutDirection == ViewLayoutDirectionType.RTL)
930 buttonIcon.PositionUsesPivotPoint = true;
931 buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft;
932 buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft;
933 buttonIcon.Position2D = new Position2D(iconPaddingEnd, 0);
935 buttonText.PositionUsesPivotPoint = true;
936 buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight;
937 buttonText.PivotPoint = NUI.PivotPoint.CenterRight;
938 buttonText.Position2D = new Position2D(-textPaddingStart, 0);
942 buttonIcon.PositionUsesPivotPoint = true;
943 buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight;
944 buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight;
945 buttonIcon.Position2D = new Position2D(-iconPaddingEnd, 0);
947 buttonText.PositionUsesPivotPoint = true;
948 buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
949 buttonText.PivotPoint = NUI.PivotPoint.CenterLeft;
950 buttonText.Position2D = new Position2D(textPaddingStart, 0);
956 if ("" == buttonText.Text)
958 buttonIcon.ParentOrigin = NUI.ParentOrigin.Center;
959 buttonIcon.PivotPoint = NUI.PivotPoint.Center;
963 /// Theme change callback when theme is changed, this callback will be trigger.
965 /// <since_tizen> 6 </since_tizen>
966 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
967 [EditorBrowsable(EditorBrowsableState.Never)]
968 protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
970 ButtonStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as ButtonStyle;
971 if (tempAttributes != null)
973 Style.CopyFrom(tempAttributes);
978 private void UpdateUIContent()
983 Sensitive = isEnabled;
986 private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
992 private void OnClick(ClickEventArgs eventArgs)
994 ClickEvent?.Invoke(this, eventArgs);
997 private void OnIconRelayout(object sender, EventArgs e)
1004 /// ClickEventArgs is a class to record button click event arguments which will sent to user.
1006 /// <since_tizen> 6 </since_tizen>
1007 public class ClickEventArgs : EventArgs
1011 /// StateChangeEventArgs is a class to record button state change event arguments which will sent to user.
1013 /// <since_tizen> 6 </since_tizen>
1014 public class StateChangedEventArgs : EventArgs
1016 /// <summary> previous state of Button </summary>
1017 /// <since_tizen> 6 </since_tizen>
1018 public ControlStates PreviousState;
1019 /// <summary> current state of Button </summary>
1020 /// <since_tizen> 6 </since_tizen>
1021 public ControlStates CurrentState;