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