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