[NUI] CheckBox, RadioButton and Switch can place text without setting text size ...
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Button.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.ComponentModel;
19 using System.Diagnostics;
20 using Tizen.NUI.BaseComponents;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Accessibility;
23
24 namespace Tizen.NUI.Components
25 {
26     /// <summary>
27     /// ClickedEventArgs is a class to record button click event arguments which will sent to user.
28     /// </summary>
29     /// <since_tizen> 8 </since_tizen>
30     public class ClickedEventArgs : EventArgs
31     {
32     }
33
34     /// <summary>
35     /// SelectedChangedEventArgs is a class to record item selected arguments which will sent to user.
36     /// </summary>
37     /// <since_tizen> 8 </since_tizen>
38     public class SelectedChangedEventArgs : EventArgs
39     {
40         /// <summary> Selected state </summary>
41         /// <since_tizen> 8 </since_tizen>
42         public bool IsSelected { get; set; }
43     }
44
45     /// <summary>
46     /// Button is one kind of common component, a button clearly describes what action will occur when the user selects it.
47     /// Button may contain text or an icon.
48     /// </summary>
49     /// <since_tizen> 6 </since_tizen>
50     public partial class Button : Control
51     {
52         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
53         [EditorBrowsable(EditorBrowsableState.Never)]
54         public static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create(nameof(IconRelativeOrientation), typeof(IconOrientation?), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
55         {
56             var instance = (Button)bindable;
57             var newIconOrientation = (IconOrientation?)newValue;
58             if (instance.iconRelativeOrientation != newIconOrientation)
59             {
60                 instance.iconRelativeOrientation = newIconOrientation;
61                 instance.LayoutItems();
62             }
63         },
64         defaultValueCreator: (bindable) => ((Button)bindable).iconRelativeOrientation
65         );
66
67         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
68         [EditorBrowsable(EditorBrowsableState.Never)]
69         public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
70         {
71             var instance = (Button)bindable;
72             if (newValue != null)
73             {
74                 bool newEnabled = (bool)newValue;
75                 if (instance.isEnabled != newEnabled)
76                 {
77                     instance.isEnabled = newEnabled;
78                     instance.Sensitive = newEnabled;
79                     instance.UpdateState();
80                 }
81             }
82         },
83         defaultValueCreator: (bindable) => ((Button)bindable).isEnabled);
84         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
85         [EditorBrowsable(EditorBrowsableState.Never)]
86         public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
87         {
88             var instance = (Button)bindable;
89             if (newValue != null)
90             {
91                 bool newSelected = (bool)newValue;
92                 if (instance.isSelected != newSelected)
93                 {
94                     instance.isSelected = newSelected;
95
96                     if (instance.isSelectable)
97                     {
98                         instance.UpdateState();
99                     }
100                 }
101             }
102         },
103         defaultValueCreator: (bindable) =>
104         {
105             var instance = (Button)bindable;
106             return instance.isSelectable && instance.isSelected;
107         });
108         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
109         [EditorBrowsable(EditorBrowsableState.Never)]
110         public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
111         {
112             var instance = (Button)bindable;
113             if (newValue != null)
114             {
115                 bool newSelectable = (bool)newValue;
116                 if (instance.isSelectable != newSelectable)
117                 {
118                     instance.isSelectable = newSelectable;
119                     instance.UpdateState();
120                 }
121             }
122         },
123         defaultValueCreator: (bindable) => ((Button)bindable).isSelectable);
124
125         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
126         [EditorBrowsable(EditorBrowsableState.Never)]
127         public static readonly BindableProperty IconPaddingProperty = BindableProperty.Create(nameof(IconPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
128         {
129             var instance = (Button)bindable;
130             instance.iconPadding = (Extents)((Extents)newValue).Clone();
131             if (instance.buttonIcon != null)
132             {
133                 instance.buttonIcon.Margin = instance.iconPadding;
134             }
135         },
136         defaultValueCreator: (bindable) => ((Button)bindable).iconPadding);
137
138         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
139         [EditorBrowsable(EditorBrowsableState.Never)]
140         public static readonly BindableProperty TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
141         {
142             var instance = (Button)bindable;
143             instance.textPadding = (Extents)((Extents)newValue).Clone();
144             if (instance.buttonText != null)
145             {
146                 instance.buttonText.Margin = instance.textPadding;
147             }
148         },
149         defaultValueCreator: (bindable) => ((Button)bindable).textPadding);
150
151         private IconOrientation? iconRelativeOrientation = IconOrientation.Left;
152         private bool isSelected = false;
153         private bool isSelectable = false;
154         private bool isEnabled = true;
155         private Extents iconPadding;
156         private Extents textPadding;
157
158         static Button() { }
159
160         /// <summary>
161         /// Creates a new instance of a Button.
162         /// </summary>
163         /// <since_tizen> 6 </since_tizen>
164         public Button() : base()
165         {
166         }
167
168         /// <summary>
169         /// Creates a new instance of a Button with style.
170         /// </summary>
171         /// <param name="style">Create Button by special style defined in UX.</param>
172         /// <since_tizen> 8 </since_tizen>
173         public Button(string style) : base(style)
174         {
175         }
176
177         /// <summary>
178         /// Creates a new instance of a Button with style.
179         /// </summary>
180         /// <param name="buttonStyle">Create Button by style customized by user.</param>
181         /// <since_tizen> 8 </since_tizen>
182         public Button(ButtonStyle buttonStyle) : base(buttonStyle)
183         {
184         }
185
186         /// <summary>
187         /// Calculates current states for the button<br />
188         /// </summary>
189         [EditorBrowsable(EditorBrowsableState.Never)]
190         protected override AccessibilityStates AccessibilityCalculateStates()
191         {
192             var states = base.AccessibilityCalculateStates();
193             states.Set(AccessibilityState.Enabled, this.IsEnabled);
194             return states;
195         }
196
197         /// <summary>
198         /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
199         /// </summary>
200         /// <since_tizen> 6 </since_tizen>
201         [Obsolete("Deprecated in API8; Will be removed in API10. Please use Clicked event instead.")]
202         public event EventHandler<ClickEventArgs> ClickEvent;
203
204         /// <summary>
205         /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
206         /// </summary>
207         /// <since_tizen> 8 </since_tizen>
208         public event EventHandler<ClickedEventArgs> Clicked;
209
210         /// <summary>
211         /// An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
212         /// </summary>
213         /// <since_tizen> 6 </since_tizen>
214         [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEvent")]
215         public event EventHandler<StateChangedEventArgs> StateChangedEvent
216         {
217             add
218             {
219                 stateChangeHandler += value;
220             }
221             remove
222             {
223                 stateChangeHandler -= value;
224             }
225         }
226
227         /// <summary>
228         /// Icon orientation.
229         /// </summary>
230         /// <since_tizen> 6 </since_tizen>
231         public enum IconOrientation
232         {
233             /// <summary>
234             /// Top.
235             /// </summary>
236             /// <since_tizen> 6 </since_tizen>
237             Top,
238             /// <summary>
239             /// Bottom.
240             /// </summary>
241             /// <since_tizen> 6 </since_tizen>
242             Bottom,
243             /// <summary>
244             /// Left.
245             /// </summary>
246             /// <since_tizen> 6 </since_tizen>
247             Left,
248             /// <summary>
249             /// Right.
250             /// </summary>
251             /// <since_tizen> 6 </since_tizen>
252             Right,
253         }
254
255         /// <summary>
256         /// Button's icon part.
257         /// </summary>
258         /// <since_tizen> 8 </since_tizen>
259         public ImageView Icon
260         {
261             get => buttonIcon;
262             internal set
263             {
264                 buttonIcon = value;
265             }
266         }
267
268         /// <summary>
269         /// Button's overlay image part.
270         /// </summary>
271         /// <since_tizen> 8 </since_tizen>
272         public ImageView OverlayImage
273         {
274             get
275             {
276                 if (null == overlayImage)
277                 {
278                     overlayImage = CreateOverlayImage();
279                     if (null != Extension)
280                     {
281                         overlayImage = Extension.OnCreateOverlayImage(this, overlayImage);
282                     }
283                     if (null != overlayImage)
284                     {
285                         overlayImage.ExcludeLayouting = true;
286                         Add(overlayImage);
287                     }
288                 }
289                 return overlayImage;
290             }
291             internal set
292             {
293                 overlayImage = value;
294             }
295         }
296
297         /// <summary>
298         /// Button's text part.
299         /// </summary>
300         /// <since_tizen> 8 </since_tizen>
301         public TextLabel TextLabel
302         {
303             get => buttonText;
304             internal set
305             {
306                 buttonText = value;
307                 AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Label, buttonText.Text);
308             }
309         }
310
311         /// <summary>
312         /// Return currently applied style.
313         /// </summary>
314         /// <remarks>
315         /// Modifying contents in style may cause unexpected behaviour.
316         /// </remarks>
317         /// <since_tizen> 8 </since_tizen>
318         public ButtonStyle Style => (ButtonStyle)(ViewStyle as ButtonStyle)?.Clone();
319
320         /// <summary>
321         /// The text of Button.
322         /// </summary>
323         /// <since_tizen> 6 </since_tizen>
324         public string Text
325         {
326             get
327             {
328                 return TextLabel.Text;
329             }
330             set
331             {
332                 TextLabel.Text = value;
333
334                 if (IsHighlighted && String.IsNullOrEmpty(AccessibilityName) && GetAccessibilityNameSignal().Empty())
335                 {
336                     EmitAccessibilityEvent(ObjectPropertyChangeEvent.Name);
337                 }
338             }
339         }
340
341         /// <summary>
342         /// Flag to decide Button can be selected or not.
343         /// </summary>
344         /// <since_tizen> 6 </since_tizen>
345         public bool IsSelectable
346         {
347             get
348             {
349                 return (bool)GetValue(IsSelectableProperty);
350             }
351             set
352             {
353                 SetValue(IsSelectableProperty, value);
354             }
355         }
356
357         /// <summary>
358         /// Translate text string in Button.
359         /// </summary>
360         /// <since_tizen> 6 </since_tizen>
361         public string TranslatableText
362         {
363             get
364             {
365                 return TextLabel.TranslatableText;
366             }
367             set
368             {
369                 TextLabel.TranslatableText = value;
370             }
371         }
372
373         /// <summary>
374         /// Text point size in Button.
375         /// </summary>
376         /// <since_tizen> 6 </since_tizen>
377         public float PointSize
378         {
379             get
380             {
381                 return TextLabel.PointSize;
382             }
383             set
384             {
385                 TextLabel.PointSize = value;
386             }
387         }
388
389         /// <summary>
390         /// Text font family in Button.
391         /// </summary>
392         /// <since_tizen> 6 </since_tizen>
393         public string FontFamily
394         {
395             get
396             {
397                 return TextLabel.FontFamily;
398             }
399             set
400             {
401                 TextLabel.FontFamily = value;
402             }
403         }
404
405         /// <summary>
406         /// Text color in Button.
407         /// </summary>
408         /// <since_tizen> 6 </since_tizen>
409         public Color TextColor
410         {
411             get
412             {
413                 return TextLabel.TextColor;
414             }
415             set
416             {
417                 TextLabel.TextColor = value;
418             }
419         }
420
421         /// <summary>
422         /// Text horizontal alignment in Button.
423         /// </summary>
424         /// <since_tizen> 6 </since_tizen>
425         public HorizontalAlignment TextAlignment
426         {
427             get
428             {
429                 return TextLabel.HorizontalAlignment;
430             }
431             set
432             {
433                 TextLabel.HorizontalAlignment = value;
434             }
435         }
436
437         /// <summary>
438         /// Icon image's resource url in Button.
439         /// </summary>
440         /// <since_tizen> 6 </since_tizen>
441         public string IconURL
442         {
443             get
444             {
445                 return Icon.ResourceUrl;
446             }
447             set
448             {
449                 Icon.ResourceUrl = value;
450             }
451         }
452
453         /// <summary>
454         /// Text string selector in Button.
455         /// Getter returns copied selector value if exist, null otherwise.
456         /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
457         /// </summary>
458         /// <since_tizen> 6 </since_tizen>
459         public StringSelector TextSelector
460         {
461             get => buttonText == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(TextLabel.TextSelectorProperty));
462             set
463             {
464                 if (value == null || buttonText == null)
465                 {
466                     throw new NullReferenceException("Button.TextSelector is null");
467                 }
468                 else
469                 {
470                     buttonText.SetValue(TextLabel.TextSelectorProperty, value);
471                 }
472             }
473         }
474
475         /// <summary>
476         /// Translatable text string selector in Button.
477         /// Getter returns copied selector value if exist, null otherwise.
478         /// </summary>
479         /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
480         /// <since_tizen> 6 </since_tizen>
481         public StringSelector TranslatableTextSelector
482         {
483             get => buttonText == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(TextLabel.TranslatableTextSelectorProperty));
484             set
485             {
486                 if (value == null || buttonText == null)
487                 {
488                     throw new NullReferenceException("Button.TranslatableTextSelector is null");
489                 }
490                 else
491                 {
492                     buttonText.SetValue(TextLabel.TranslatableTextSelectorProperty, value);
493                 }
494             }
495         }
496
497         /// <summary>
498         /// Text color selector in Button.
499         /// Getter returns copied selector value if exist, null otherwise.
500         /// </summary>
501         /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
502         /// <since_tizen> 6 </since_tizen>
503         public ColorSelector TextColorSelector
504         {
505             get => buttonText == null ? null : new ColorSelector((Selector<Color>)buttonText.GetValue(TextLabel.TextColorSelectorProperty));
506             set
507             {
508                 if (value == null || buttonText == null)
509                 {
510                     throw new NullReferenceException("Button.TextColorSelectorProperty is null");
511                 }
512                 else
513                 {
514                     buttonText.SetValue(TextLabel.TextColorSelectorProperty, value);
515                 }
516             }
517         }
518
519         /// <summary>
520         /// Text font size selector in Button.
521         /// Getter returns copied selector value if exist, null otherwise.
522         /// </summary>
523         /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
524         /// <since_tizen> 6 </since_tizen>
525         public FloatSelector PointSizeSelector
526         {
527             get => buttonText == null ? null : new FloatSelector((Selector<float?>)buttonText.GetValue(TextLabel.PointSizeSelectorProperty));
528             set
529             {
530                 if (value == null || buttonText == null)
531                 {
532                     throw new NullReferenceException("Button.PointSizeSelector is null");
533                 }
534                 else
535                 {
536                     buttonText.SetValue(TextLabel.PointSizeSelectorProperty, value);
537                 }
538             }
539         }
540
541         /// <summary>
542         /// Icon image's resource url selector in Button.
543         /// Getter returns copied selector value if exist, null otherwise.
544         /// </summary>
545         /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
546         /// <since_tizen> 6 </since_tizen>
547         public StringSelector IconURLSelector
548         {
549             get => buttonIcon == null ? null : new StringSelector((Selector<string>)buttonIcon.GetValue(ImageView.ResourceUrlSelectorProperty));
550             set
551             {
552                 if (value == null || buttonIcon == null)
553                 {
554                     throw new NullReferenceException("Button.IconURLSelector is null");
555                 }
556                 else
557                 {
558                     buttonIcon.SetValue(ImageView.ResourceUrlSelectorProperty, value);
559                 }
560             }
561         }
562
563         /// <summary>
564         /// Flag to decide selected state in Button.
565         /// </summary>
566         /// <since_tizen> 6 </since_tizen>
567         public bool IsSelected
568         {
569             get
570             {
571                 return (bool)GetValue(IsSelectedProperty);
572             }
573             set
574             {
575                 SetValue(IsSelectedProperty, value);
576             }
577         }
578
579         /// <summary>
580         /// Flag to decide enable or disable in Button.
581         /// </summary>
582         /// <since_tizen> 6 </since_tizen>
583         public bool IsEnabled
584         {
585             get
586             {
587                 return (bool)GetValue(IsEnabledProperty);
588             }
589             set
590             {
591                 SetValue(IsEnabledProperty, value);
592             }
593         }
594
595         /// <summary>
596         /// Icon relative orientation in Button, work only when show icon and text.
597         /// </summary>
598         /// <since_tizen> 8 </since_tizen>
599         public IconOrientation? IconRelativeOrientation
600         {
601             get
602             {
603                 return (IconOrientation?)GetValue(IconRelativeOrientationProperty) ?? IconOrientation.Left;
604             }
605             set
606             {
607                 SetValue(IconRelativeOrientationProperty, value);
608             }
609         }
610
611         /// <summary>
612         /// Icon padding in Button, work only when show icon and text.
613         /// </summary>
614         /// <since_tizen> 6 </since_tizen>
615         public Extents IconPadding
616         {
617             get => (Extents)GetValue(IconPaddingProperty) ?? new Extents();
618             set => SetValue(IconPaddingProperty, value);
619         }
620
621         /// <summary>
622         /// Text padding in Button, work only when show icon and text.
623         /// </summary>
624         /// <since_tizen> 6 </since_tizen>
625         public Extents TextPadding
626         {
627             get => (Extents)GetValue(TextPaddingProperty) ?? new Extents();
628             set => SetValue(TextPaddingProperty, value);
629         }
630
631         /// <summary>
632         /// Called after a key event is received by the view that has had its focus set.
633         /// </summary>
634         /// <param name="key">The key event.</param>
635         /// <returns>True if the key event should be consumed.</returns>
636         /// <since_tizen> 6 </since_tizen>
637         public override bool OnKey(Key key)
638         {
639             if (!IsEnabled || null == key)
640             {
641                 return false;
642             }
643
644             if (key.State == Key.StateType.Down)
645             {
646                 if (key.KeyPressedName == "Return")
647                 {
648                     isPressed = true;
649                     UpdateState();
650                 }
651             }
652             else if (key.State == Key.StateType.Up)
653             {
654                 if (key.KeyPressedName == "Return")
655                 {
656                     bool clicked = isPressed && IsEnabled;
657
658                     isPressed = false;
659
660                     if (IsSelectable)
661                     {
662                         IsSelected = !IsSelected;
663                     }
664                     else
665                     {
666                         UpdateState();
667                     }
668
669                     if (clicked)
670                     {
671                         ClickedEventArgs eventArgs = new ClickedEventArgs();
672                         OnClickedInternal(eventArgs);
673                     }
674                 }
675             }
676             return base.OnKey(key);
677         }
678
679         /// <summary>
680         /// 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.
681         /// </summary>
682         /// <since_tizen> 8 </since_tizen>
683         public override void OnFocusGained()
684         {
685             base.OnFocusGained();
686             UpdateState();
687         }
688
689         /// <summary>
690         /// 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.
691         /// </summary>
692         /// <since_tizen> 8 </since_tizen>
693         public override void OnFocusLost()
694         {
695             base.OnFocusLost();
696             UpdateState();
697         }
698
699         /// <summary>
700         /// Called after a touch event is received by the owning view.<br />
701         /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
702         /// </summary>
703         /// <param name="touch">The touch event.</param>
704         /// <returns>True if the event should be consumed.</returns>
705         /// <since_tizen> 8 </since_tizen>
706         [Obsolete("Deprecated in API8; Will be removed in API10. Please use OnClicked instead.")]
707 #pragma warning disable CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
708         public override bool OnTouch(Touch touch)
709 #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
710         {
711             return base.OnTouch(touch);
712         }
713
714         /// <summary>
715         /// Apply style to button.
716         /// </summary>
717         /// <param name="viewStyle">The style to apply.</param>
718         /// <since_tizen> 8 </since_tizen>
719         public override void ApplyStyle(ViewStyle viewStyle)
720         {
721             Debug.Assert(buttonIcon != null && buttonText != null);
722
723             styleApplied = false;
724
725             base.ApplyStyle(viewStyle);
726
727             if (viewStyle is ButtonStyle buttonStyle)
728             {
729                 Extension = buttonStyle.CreateExtension();
730
731                 if (buttonStyle.Overlay != null)
732                 {   
733                     OverlayImage?.ApplyStyle(buttonStyle.Overlay);
734                 }
735
736                 if (Extension != null)
737                 {
738                     buttonIcon.Unparent();
739                     buttonText.Unparent();
740                     buttonIcon = Extension.OnCreateIcon(this, buttonIcon);
741                     buttonText = Extension.OnCreateText(this, buttonText);
742                     LayoutItems();
743                 }
744
745                 if (buttonStyle.Text != null)
746                 {
747                     buttonText.ApplyStyle(buttonStyle.Text);
748                 }
749
750                 if (buttonStyle.Icon != null)
751                 {
752                     buttonIcon.ApplyStyle(buttonStyle.Icon);
753                 }
754             }
755
756             styleApplied = true;
757             UpdateState();
758         }
759
760         /// <summary>
761         /// ClickEventArgs is a class to record button click event arguments which will sent to user.
762         /// </summary>
763         /// <since_tizen> 6 </since_tizen>
764         [Obsolete("Deprecated in API8; Will be removed in API10. Please use ClickedEventArgs instead.")]
765         [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
766         public class ClickEventArgs : EventArgs
767         {
768         }
769
770         /// <summary>
771         /// StateChangeEventArgs is a class to record button state change event arguments which will sent to user.
772         /// </summary>
773         /// <since_tizen> 6 </since_tizen>
774         [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEventArgs")]
775         [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
776         public class StateChangedEventArgs : EventArgs
777         {
778             /// <summary> previous state of Button </summary>
779             /// <since_tizen> 6 </since_tizen>
780             /// It will be removed in API10
781             [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
782             [Obsolete("Deprecated in API8; Will be removed in API10")]
783             public ControlStates PreviousState;
784             /// <summary> current state of Button </summary>
785             /// <since_tizen> 6 </since_tizen>
786             /// It will be removed in API10
787             [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
788             [Obsolete("Deprecated in API8; Will be removed in API10")]
789             public ControlStates CurrentState;
790         }
791     }
792 }