[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Button.cs
1 /*
2  * Copyright(c) 2019 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
21 namespace Tizen.NUI.Components
22 {
23     /// <summary>
24     /// Button is one kind of common component, a button clearly describes what action will occur when the user selects it.
25     /// Button may contain text or an icon.
26     /// </summary>
27     /// <since_tizen> 6 </since_tizen>
28     /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
29     [EditorBrowsable(EditorBrowsableState.Never)]
30     public class Button : Control
31     {
32         private ImageView backgroundImage;
33         private ImageView shadowImage;
34         private ImageView overlayImage;
35
36         private TextLabel buttonText;
37         private ImageView buttonIcon;
38
39         private ButtonAttributes buttonAttributes;
40         private EventHandler<StateChangeEventArgs> stateChangeHander;
41
42         private bool isSelected = false;
43         private bool isEnabled = true;
44         private bool isPressed = false;
45         /// <summary>
46         /// Creates a new instance of a Button.
47         /// </summary>
48         /// <since_tizen> 6 </since_tizen>
49         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
50         [EditorBrowsable(EditorBrowsableState.Never)]
51         public Button() : base()
52         {
53             Initialize();
54         }
55         /// <summary>
56         /// Creates a new instance of a Button with style.
57         /// </summary>
58         /// <param name="style">Create Button by special style defined in UX.</param>
59         /// <since_tizen> 6 </since_tizen>
60         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
61         [EditorBrowsable(EditorBrowsableState.Never)]
62         public Button(string style) : base(style)
63         {
64             Initialize();
65         }
66         /// <summary>
67         /// Creates a new instance of a Button with attributes.
68         /// </summary>
69         /// <param name="attributes">Create Button by attributes customized by user.</param>
70         /// <since_tizen> 6 </since_tizen>
71         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
72         [EditorBrowsable(EditorBrowsableState.Never)]
73         public Button(ButtonAttributes attributes) : base(attributes)
74         {
75             Initialize();
76         }
77         /// <summary>
78         /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
79         /// </summary>
80         /// <since_tizen> 6 </since_tizen>
81         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
82         [EditorBrowsable(EditorBrowsableState.Never)]
83         public event EventHandler<ClickEventArgs> ClickEvent;
84         /// <summary>
85         /// An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
86         /// </summary>
87         /// <since_tizen> 6 </since_tizen>
88         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
89         [EditorBrowsable(EditorBrowsableState.Never)]
90         public event EventHandler<StateChangeEventArgs> StateChangedEvent
91         {
92             add
93             {
94                 stateChangeHander += value;
95             }
96             remove
97             {
98                 stateChangeHander -= value;
99             }
100         }
101         /// <summary>
102         /// Icon orientation.
103         /// </summary>
104         /// <since_tizen> 6 </since_tizen>
105         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
106         [EditorBrowsable(EditorBrowsableState.Never)]
107         public enum IconOrientation
108         {
109             /// <summary>
110             /// Top.
111             /// </summary>
112             /// <since_tizen> 6 </since_tizen>
113             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
114             [EditorBrowsable(EditorBrowsableState.Never)]
115             Top,
116             /// <summary>
117             /// Bottom.
118             /// </summary>
119             /// <since_tizen> 6 </since_tizen>
120             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
121             [EditorBrowsable(EditorBrowsableState.Never)]
122             Bottom,
123             /// <summary>
124             /// Left.
125             /// </summary>
126             /// <since_tizen> 6 </since_tizen>
127             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
128             [EditorBrowsable(EditorBrowsableState.Never)]
129             Left,
130             /// <summary>
131             /// Right.
132             /// </summary>
133             /// <since_tizen> 6 </since_tizen>
134             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
135             [EditorBrowsable(EditorBrowsableState.Never)]
136             Right,
137         }
138         /// <summary>
139         /// Flag to decide Button can be selected or not.
140         /// </summary>
141         /// <since_tizen> 6 </since_tizen>
142         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
143         [EditorBrowsable(EditorBrowsableState.Never)]
144         public bool IsSelectable
145         {
146             get
147             {
148                 return buttonAttributes?.IsSelectable ?? false;
149             }
150             set
151             {
152                 buttonAttributes.IsSelectable = value;
153             }
154         }
155         /// <summary>
156         /// Background image's resource url in Button.
157         /// </summary>
158         /// <since_tizen> 6 </since_tizen>
159         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
160         [EditorBrowsable(EditorBrowsableState.Never)]
161         public string BackgroundImageURL
162         {
163             get
164             {
165                 return buttonAttributes?.BackgroundImageAttributes?.ResourceURL?.All;
166             }
167             set
168             {
169                 if (value != null)
170                 {
171                     CreateBackgroundAttributes();
172                     if (buttonAttributes.BackgroundImageAttributes.ResourceURL == null)
173                     {
174                         buttonAttributes.BackgroundImageAttributes.ResourceURL = new StringSelector();
175                     }
176                     buttonAttributes.BackgroundImageAttributes.ResourceURL.All = value;
177                     RelayoutRequest();
178                 }
179             }
180         }
181         /// <summary>
182         /// Background image's border in Button.
183         /// </summary>
184         /// <since_tizen> 6 </since_tizen>
185         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
186         [EditorBrowsable(EditorBrowsableState.Never)]
187         public Rectangle BackgroundImageBorder
188         {
189             get
190             {
191                 return buttonAttributes?.BackgroundImageAttributes?.Border?.All;
192             }
193             set
194             {
195                 if (value != null)
196                 {
197                     CreateBackgroundAttributes();
198                     if (buttonAttributes.BackgroundImageAttributes.Border == null)
199                     {
200                         buttonAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
201                     }
202                     buttonAttributes.BackgroundImageAttributes.Border.All = value;
203                     RelayoutRequest();
204                 }
205             }
206         }
207         /// <summary>
208         /// Shadow image's resource url in Button.
209         /// </summary>
210         /// <since_tizen> 6 </since_tizen>
211         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
212         [EditorBrowsable(EditorBrowsableState.Never)]
213         public string ShadowImageURL
214         {
215             get
216             {
217                 return buttonAttributes?.ShadowImageAttributes?.ResourceURL?.All;
218             }
219             set
220             {
221                 if (value != null)
222                 {
223                     CreateShadowAttributes();
224                     if (buttonAttributes.ShadowImageAttributes.ResourceURL == null)
225                     {
226                         buttonAttributes.ShadowImageAttributes.ResourceURL = new StringSelector();
227                     }
228                     buttonAttributes.ShadowImageAttributes.ResourceURL.All = value;
229                     RelayoutRequest();
230                 }
231             }
232         }
233         /// <summary>
234         /// Shadow image's border in Button.
235         /// </summary>
236         /// <since_tizen> 6 </since_tizen>
237         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
238         [EditorBrowsable(EditorBrowsableState.Never)]
239         public Rectangle ShadowImageBorder
240         {
241             get
242             {
243                 return buttonAttributes?.ShadowImageAttributes?.Border?.All;
244             }
245             set
246             {
247                 if (value != null)
248                 {
249                     CreateShadowAttributes();
250                     if (buttonAttributes.ShadowImageAttributes.Border == null)
251                     {
252                         buttonAttributes.ShadowImageAttributes.Border = new RectangleSelector();
253                     }
254                     buttonAttributes.ShadowImageAttributes.Border.All = value;
255                     RelayoutRequest();
256                 }
257             }
258         }
259         /// <summary>
260         /// Overlay image's resource url in Button.
261         /// </summary>
262         /// <since_tizen> 6 </since_tizen>
263         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
264         [EditorBrowsable(EditorBrowsableState.Never)]
265         public string OverlayImageURL
266         {
267             get
268             {
269                 return buttonAttributes?.OverlayImageAttributes?.ResourceURL?.All;
270             }
271             set
272             {
273                 if (value != null)
274                 {
275                     CreateOverlayAttributes();
276                     if (buttonAttributes.OverlayImageAttributes.ResourceURL == null)
277                     {
278                         buttonAttributes.OverlayImageAttributes.ResourceURL = new StringSelector();
279                     }
280                     buttonAttributes.OverlayImageAttributes.ResourceURL.All = value;
281                     RelayoutRequest();
282                 }
283             }
284         }
285         /// <summary>
286         /// Overlay image's border in Button.
287         /// </summary>
288         /// <since_tizen> 6 </since_tizen>
289         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
290         [EditorBrowsable(EditorBrowsableState.Never)]
291         public Rectangle OverlayImageBorder
292         {
293             get
294             {
295                 return buttonAttributes?.OverlayImageAttributes?.Border?.All;
296             }
297             set
298             {
299                 if (value != null)
300                 {
301                     CreateOverlayAttributes();
302                     if (buttonAttributes.OverlayImageAttributes.Border == null)
303                     {
304                         buttonAttributes.OverlayImageAttributes.Border = new RectangleSelector();
305                     }
306                     buttonAttributes.OverlayImageAttributes.Border.All = value;
307                     RelayoutRequest();
308                 }
309             }
310         }
311         /// <summary>
312         /// Text string in Button.
313         /// </summary>
314         /// <since_tizen> 6 </since_tizen>
315         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
316         [EditorBrowsable(EditorBrowsableState.Never)]
317         public string Text
318         {
319             get
320             {
321                 return buttonAttributes?.TextAttributes?.Text?.All;
322             }
323             set
324             {
325                 if (value != null)
326                 {
327                     CreateTextAttributes();
328                     if(buttonAttributes.TextAttributes.Text == null)
329                     {
330                         buttonAttributes.TextAttributes.Text = new StringSelector();
331                     }
332                     buttonAttributes.TextAttributes.Text.All = value;
333
334                     RelayoutRequest();
335                 }
336             }
337         }
338         /// <summary>
339         /// Translate text string in Button.
340         /// </summary>
341         /// <since_tizen> 6 </since_tizen>
342         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
343         [EditorBrowsable(EditorBrowsableState.Never)]
344         public string TranslatableText
345         {
346             get
347             {
348                 return buttonAttributes?.TextAttributes?.TranslatableText?.All;
349             }
350             set
351             {
352                 if (value != null)
353                 {
354                     CreateTextAttributes();
355                     if (buttonAttributes.TextAttributes.TranslatableText == null)
356                     {
357                         buttonAttributes.TextAttributes.TranslatableText = new StringSelector();
358                     }
359                     buttonAttributes.TextAttributes.TranslatableText.All = value;
360
361                     RelayoutRequest();
362                 }
363             }
364         }
365         /// <summary>
366         /// Text point size in Button.
367         /// </summary>
368         /// <since_tizen> 6 </since_tizen>
369         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
370         [EditorBrowsable(EditorBrowsableState.Never)]
371         public float PointSize
372         {
373             get
374             {
375                 return buttonAttributes?.TextAttributes?.PointSize?.All ?? 0;
376             }
377             set
378             {
379                 CreateTextAttributes();
380                 if (buttonAttributes.TextAttributes.PointSize == null)
381                 {
382                     buttonAttributes.TextAttributes.PointSize = new FloatSelector();
383                 }
384                 buttonAttributes.TextAttributes.PointSize.All = value;
385                 RelayoutRequest();
386             }
387         }
388         /// <summary>
389         /// Text font family in Button.
390         /// </summary>
391         /// <since_tizen> 6 </since_tizen>
392         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
393         [EditorBrowsable(EditorBrowsableState.Never)]
394         public string FontFamily
395         {
396             get
397             {
398                 return buttonAttributes?.TextAttributes?.FontFamily;
399             }
400             set
401             {
402                 CreateTextAttributes();
403                 buttonAttributes.TextAttributes.FontFamily = value;
404                 RelayoutRequest();
405             }
406         }
407         /// <summary>
408         /// Text color in Button.
409         /// </summary>
410         /// <since_tizen> 6 </since_tizen>
411         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
412         [EditorBrowsable(EditorBrowsableState.Never)]
413         public Color TextColor
414         {
415             get
416             {
417                 return buttonAttributes?.TextAttributes?.TextColor?.All;
418             }
419             set
420             {
421                 CreateTextAttributes();
422                 if (buttonAttributes.TextAttributes.TextColor == null)
423                 {
424                     buttonAttributes.TextAttributes.TextColor = new ColorSelector();
425                 }
426                 buttonAttributes.TextAttributes.TextColor.All = value;
427                 RelayoutRequest();
428             }
429         }
430         /// <summary>
431         /// Text horizontal alignment in Button.
432         /// </summary>
433         /// <since_tizen> 6 </since_tizen>
434         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
435         [EditorBrowsable(EditorBrowsableState.Never)]
436         public HorizontalAlignment TextAlignment
437         {
438             get
439             {
440                 return buttonAttributes?.TextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
441             }
442             set
443             {
444                 CreateTextAttributes();
445                 buttonAttributes.TextAttributes.HorizontalAlignment = value;
446                 RelayoutRequest();
447             }
448         }
449         /// <summary>
450         /// Icon image's resource url in Button.
451         /// </summary>
452         /// <since_tizen> 6 </since_tizen>
453         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
454         [EditorBrowsable(EditorBrowsableState.Never)]
455         public string IconURL
456         {
457             get
458             {
459                 return buttonAttributes?.IconAttributes?.ResourceURL?.All;
460             }
461             set
462             {
463                 if (value != null)
464                 {
465                     CreateIconAttributes();
466                     if (buttonAttributes.IconAttributes.ResourceURL == null)
467                     {
468                         buttonAttributes.IconAttributes.ResourceURL = new StringSelector();
469                     }
470                     buttonAttributes.IconAttributes.ResourceURL.All = value;
471                     RelayoutRequest();
472                 }
473             }
474         }
475         /// <summary>
476         /// Text string selector in Button.
477         /// </summary>
478         /// <since_tizen> 6 </since_tizen>
479         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
480         [EditorBrowsable(EditorBrowsableState.Never)]
481         public StringSelector TextSelector
482         {
483             get
484             {
485                 return buttonAttributes?.TextAttributes?.Text;
486             }
487             set
488             {
489                 if (value != null)
490                 {
491                     CreateTextAttributes();
492                     buttonAttributes.TextAttributes.Text = value.Clone() as StringSelector;
493                     RelayoutRequest();
494                 }
495             }
496         }
497         /// <summary>
498         /// Translateable text string selector in Button.
499         /// </summary>
500         /// <since_tizen> 6 </since_tizen>
501         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
502         [EditorBrowsable(EditorBrowsableState.Never)]
503         public StringSelector TranslatableTextSelector
504         {
505             get
506             {
507                 return buttonAttributes?.TextAttributes?.TranslatableText;
508             }
509             set
510             {
511                 if (value != null)
512                 {
513                     CreateTextAttributes();
514                     buttonAttributes.TextAttributes.TranslatableText = value.Clone() as StringSelector;
515                     RelayoutRequest();
516                 }
517             }
518         }
519         /// <summary>
520         /// Text color selector in Button.
521         /// </summary>
522         /// <since_tizen> 6 </since_tizen>
523         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
524         [EditorBrowsable(EditorBrowsableState.Never)]
525         public ColorSelector TextColorSelector
526         {
527             get
528             {
529                 return buttonAttributes?.TextAttributes?.TextColor;
530             }
531             set
532             {
533                 if(value != null)
534                 {
535                     CreateTextAttributes();
536                     buttonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector;
537                     RelayoutRequest();
538                 }
539             }
540         }
541         /// <summary>
542         /// Text font size selector in Button.
543         /// </summary>
544         /// <since_tizen> 6 </since_tizen>
545         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
546         [EditorBrowsable(EditorBrowsableState.Never)]
547         public FloatSelector PointSizeSelector
548         {
549             get
550             {
551                 return buttonAttributes?.TextAttributes?.PointSize;
552             }
553             set
554             {
555                 if (value != null)
556                 {
557                     CreateTextAttributes();
558                     buttonAttributes.TextAttributes.PointSize = value.Clone() as FloatSelector;
559                     RelayoutRequest();
560                 }
561             }
562         }
563         /// <summary>
564         /// Icon image's resource url selector in Button.
565         /// </summary>
566         /// <since_tizen> 6 </since_tizen>
567         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
568         [EditorBrowsable(EditorBrowsableState.Never)]
569         public StringSelector IconURLSelector
570         {
571             get
572             {
573                 return buttonAttributes?.IconAttributes?.ResourceURL;
574             }
575             set
576             {
577                 if (value != null)
578                 {
579                     CreateIconAttributes();
580                     buttonAttributes.IconAttributes.ResourceURL = value.Clone() as StringSelector;
581                     RelayoutRequest();
582                 }
583             }
584         }
585         /// <summary>
586         /// Background image's resource url selector in Button.
587         /// </summary>
588         /// <since_tizen> 6 </since_tizen>
589         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
590         [EditorBrowsable(EditorBrowsableState.Never)]
591         public StringSelector BackgroundImageURLSelector
592         {
593             get
594             {
595                 return buttonAttributes?.BackgroundImageAttributes?.ResourceURL;
596             }
597             set
598             {
599                 if (value != null)
600                 {
601                     CreateBackgroundAttributes();
602                     buttonAttributes.BackgroundImageAttributes.ResourceURL = value.Clone() as StringSelector;
603                     RelayoutRequest();
604                 }
605             }
606         }
607         /// <summary>
608         /// Background image's border selector in Button.
609         /// </summary>
610         /// <since_tizen> 6 </since_tizen>
611         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
612         [EditorBrowsable(EditorBrowsableState.Never)]
613         public RectangleSelector BackgroundImageBorderSelector
614         {
615             get
616             {
617                 return buttonAttributes?.BackgroundImageAttributes?.Border;
618             }
619             set
620             {
621                 if (value != null)
622                 {
623                     CreateBackgroundAttributes();
624                     buttonAttributes.BackgroundImageAttributes.Border = value.Clone() as RectangleSelector;
625                     RelayoutRequest();
626                 }
627             }
628         }
629         /// <summary>
630         /// Shadow image's resource url selector in Button.
631         /// </summary>
632         /// <since_tizen> 6 </since_tizen>
633         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
634         [EditorBrowsable(EditorBrowsableState.Never)]
635         public StringSelector ShadowImageURLSelector
636         {
637             get
638             {
639                 return buttonAttributes?.ShadowImageAttributes?.ResourceURL;
640             }
641             set
642             {
643                 if (value != null)
644                 {
645                     CreateShadowAttributes();
646                     buttonAttributes.ShadowImageAttributes.ResourceURL = value.Clone() as StringSelector;
647                     RelayoutRequest();
648                 }
649             }
650         }
651         /// <summary>
652         /// Shadow image's border selector in Button.
653         /// </summary>
654         /// <since_tizen> 6 </since_tizen>
655         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
656         [EditorBrowsable(EditorBrowsableState.Never)]
657         public RectangleSelector ShadowImageBorderSelector
658         {
659             get
660             {
661                 return buttonAttributes?.ShadowImageAttributes?.Border;
662             }
663             set
664             {
665                 if (value != null)
666                 {
667                     CreateShadowAttributes();
668                     buttonAttributes.ShadowImageAttributes.Border = value.Clone() as RectangleSelector;
669                     RelayoutRequest();
670                 }
671             }
672         }
673         /// <summary>
674         /// Overlay image's resource url selector in Button.
675         /// </summary>
676         /// <since_tizen> 6 </since_tizen>
677         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
678         [EditorBrowsable(EditorBrowsableState.Never)]
679         public StringSelector OverlayImageURLSelector
680         {
681             get
682             {
683                 return buttonAttributes?.OverlayImageAttributes?.ResourceURL;
684             }
685             set
686             {
687                 if (value != null)
688                 {
689                     CreateOverlayAttributes();
690                     buttonAttributes.OverlayImageAttributes.ResourceURL = value.Clone() as StringSelector;
691                     RelayoutRequest();
692                 }
693             }
694         }
695         /// <summary>
696         /// Overlay image's border selector in Button.
697         /// </summary>
698         /// <since_tizen> 6 </since_tizen>
699         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
700         [EditorBrowsable(EditorBrowsableState.Never)]
701         public RectangleSelector OverlayImageBorderSelector
702         {
703             get
704             {
705                 return buttonAttributes?.OverlayImageAttributes?.Border;
706             }
707             set
708             {
709                 if (value != null)
710                 {
711                     CreateOverlayAttributes();
712                     buttonAttributes.OverlayImageAttributes.Border = value.Clone() as RectangleSelector;
713                     RelayoutRequest();
714                 }
715             }
716         }
717         /// <summary>
718         /// Flag to decide selected state in Button.
719         /// </summary>
720         /// <since_tizen> 6 </since_tizen>
721         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
722         [EditorBrowsable(EditorBrowsableState.Never)]
723         public bool IsSelected
724         {
725             get
726             {
727                 return isSelected;
728             }
729             set
730             {
731                 isSelected = value;
732                 UpdateState();
733             }
734         }
735         /// <summary>
736         /// Flag to decide enable or disable in Button.
737         /// </summary>
738         /// <since_tizen> 6 </since_tizen>
739         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
740         [EditorBrowsable(EditorBrowsableState.Never)]
741         public bool IsEnabled
742         {
743             get
744             {
745                 return isEnabled;
746             }
747             set
748             {
749                 isEnabled = value;
750                 UpdateState();
751             }
752         }
753
754         /// <summary>
755         /// Icon relative orientation in Button, work only when show icon and text.
756         /// </summary>
757         /// <since_tizen> 6 </since_tizen>
758         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
759         [EditorBrowsable(EditorBrowsableState.Never)]
760         public IconOrientation? IconRelativeOrientation
761         {
762             get
763             {
764                 return buttonAttributes?.IconRelativeOrientation;
765             }
766             set
767             {
768                 if(buttonAttributes != null && buttonAttributes.IconRelativeOrientation != value)
769                 {
770                     buttonAttributes.IconRelativeOrientation = value;
771                     RelayoutRequest();
772                 }
773             }
774         }
775
776         /// <summary>
777         /// Icon left padding in Button, work only when show icon and text.
778         /// </summary>
779         /// <since_tizen> 6 </since_tizen>
780         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
781         [EditorBrowsable(EditorBrowsableState.Never)]
782         public int IconPaddingLeft
783         {
784             get
785             {
786                 return buttonAttributes?.IconAttributes?.PaddingLeft ?? 0;
787             }
788             set
789             {
790                 CreateIconAttributes();
791                 buttonAttributes.IconAttributes.PaddingLeft = value;
792                 RelayoutRequest();
793             }
794         }
795
796         /// <summary>
797         /// Icon right padding in Button, work only when show icon and text.
798         /// </summary>
799         /// <since_tizen> 6 </since_tizen>
800         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
801         [EditorBrowsable(EditorBrowsableState.Never)]
802         public int IconPaddingRight
803         {
804             get
805             {
806                 return buttonAttributes?.IconAttributes?.PaddingRight ?? 0;
807             }
808             set
809             {
810                 CreateIconAttributes();
811                 buttonAttributes.IconAttributes.PaddingRight = value;
812                 RelayoutRequest();
813             }
814         }
815
816         /// <summary>
817         /// Icon top padding in Button, work only when show icon and text.
818         /// </summary>
819         /// <since_tizen> 6 </since_tizen>
820         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
821         [EditorBrowsable(EditorBrowsableState.Never)]
822         public int IconPaddingTop
823         {
824             get
825             {
826                 return buttonAttributes?.IconAttributes?.PaddingTop ?? 0;
827             }
828             set
829             {
830                 CreateIconAttributes();
831                 buttonAttributes.IconAttributes.PaddingTop = value;
832                 RelayoutRequest();
833             }
834         }
835
836         /// <summary>
837         /// Icon bottom padding in Button, work only when show icon and text.
838         /// </summary>
839         /// <since_tizen> 6 </since_tizen>
840         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
841         [EditorBrowsable(EditorBrowsableState.Never)]
842         public int IconPaddingBottom
843         {
844             get
845             {
846                 return buttonAttributes?.IconAttributes?.PaddingBottom ?? 0;
847             }
848             set
849             {
850                 CreateIconAttributes();
851                 buttonAttributes.IconAttributes.PaddingBottom = value;
852                 RelayoutRequest();
853             }
854         }
855
856         /// <summary>
857         /// Text left padding in Button, work only when show icon and text.
858         /// </summary>
859         /// <since_tizen> 6 </since_tizen>
860         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
861         [EditorBrowsable(EditorBrowsableState.Never)]
862         public int TextPaddingLeft
863         {
864             get
865             {
866                 return buttonAttributes?.TextAttributes?.PaddingLeft ?? 0;
867             }
868             set
869             {
870                 CreateTextAttributes();
871                 buttonAttributes.TextAttributes.PaddingLeft = value;
872                 RelayoutRequest();
873             }
874         }
875
876         /// <summary>
877         /// Text right padding in Button, work only when show icon and text.
878         /// </summary>
879         /// <since_tizen> 6 </since_tizen>
880         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
881         [EditorBrowsable(EditorBrowsableState.Never)]
882         public int TextPaddingRight
883         {
884             get
885             {
886                 return buttonAttributes?.TextAttributes?.PaddingRight ?? 0;
887             }
888             set
889             {
890                 CreateTextAttributes();
891                 buttonAttributes.TextAttributes.PaddingRight = value;
892                 RelayoutRequest();
893             }
894         }
895
896         /// <summary>
897         /// Text top padding in Button, work only when show icon and text.
898         /// </summary>
899         /// <since_tizen> 6 </since_tizen>
900         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
901         [EditorBrowsable(EditorBrowsableState.Never)]
902         public int TextPaddingTop
903         {
904             get
905             {
906                 return buttonAttributes?.TextAttributes?.PaddingTop ?? 0;
907             }
908             set
909             {
910                 CreateTextAttributes();
911                 buttonAttributes.TextAttributes.PaddingTop = value;
912                 RelayoutRequest();
913             }
914         }
915
916         /// <summary>
917         /// Text bottom padding in Button, work only when show icon and text.
918         /// </summary>
919         /// <since_tizen> 6 </since_tizen>
920         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
921         [EditorBrowsable(EditorBrowsableState.Never)]
922         public int TextPaddingBottom
923         {
924             get
925             {
926                 return buttonAttributes?.TextAttributes?.PaddingBottom ?? 0;
927             }
928             set
929             {
930                 CreateTextAttributes();
931                 buttonAttributes.TextAttributes.PaddingBottom = value;
932                 RelayoutRequest();
933             }
934         }
935         /// <summary>
936         /// Dispose Button and all children on it.
937         /// </summary>
938         /// <param name="type">Dispose type.</param>
939         /// <since_tizen> 6 </since_tizen>
940         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
941         [EditorBrowsable(EditorBrowsableState.Never)]
942         protected override void Dispose(DisposeTypes type)
943         {
944             if (disposed)
945             {
946                 return;
947             }
948
949             if (type == DisposeTypes.Explicit)
950             {
951                 if (buttonIcon != null)
952                 {
953                     buttonIcon.Relayout -= OnIconRelayout;
954                     Utility.Dispose(buttonIcon);
955                 }
956                 if (buttonText != null)
957                 {
958                     Utility.Dispose(buttonText);
959                 }
960                 if (overlayImage != null)
961                 {
962                     Utility.Dispose(overlayImage);
963                 }
964                 if (backgroundImage != null)
965                 {
966                     Utility.Dispose(backgroundImage);
967                 }
968                 if (shadowImage != null)
969                 {
970                     Utility.Dispose(shadowImage);
971                 }
972             }
973
974             base.Dispose(type);
975         }
976         /// <summary>
977         /// Called after a key event is received by the view that has had its focus set.
978         /// </summary>
979         /// <param name="key">The key event.</param>
980         /// <returns>True if the key event should be consumed.</returns>
981         /// <since_tizen> 6 </since_tizen>
982         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
983         [EditorBrowsable(EditorBrowsableState.Never)]
984         public override bool OnKey(Key key)
985         {
986             if (key.State == Key.StateType.Down)
987             {
988                 if (key.KeyPressedName == "Return")
989                 {
990                     isPressed = true;
991                     UpdateState();
992                     if(isEnabled)
993                     {
994                         ClickEventArgs eventArgs = new ClickEventArgs();
995                         OnClick(eventArgs);
996                     }
997                 }
998             }
999             else if (key.State == Key.StateType.Up)
1000             {
1001                 if (key.KeyPressedName == "Return")
1002                 {
1003                     isPressed = false;
1004                     if (buttonAttributes.IsSelectable != null && buttonAttributes.IsSelectable == true)
1005                     {
1006                         isSelected = !isSelected;
1007                     }
1008                     UpdateState();
1009                 }
1010             }
1011             return base.OnKey(key);
1012         }
1013         /// <summary>
1014         /// 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.
1015         /// </summary>
1016         /// <since_tizen> 6 </since_tizen>
1017         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1018         [EditorBrowsable(EditorBrowsableState.Never)]
1019         public override void OnFocusGained()
1020         {
1021             base.OnFocusGained();
1022             UpdateState();
1023         }
1024         /// <summary>
1025         /// 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.
1026         /// </summary>
1027         /// <since_tizen> 6 </since_tizen>
1028         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1029         [EditorBrowsable(EditorBrowsableState.Never)]
1030         public override void OnFocusLost()
1031         {
1032             base.OnFocusLost();
1033             UpdateState();
1034         }
1035         /// <summary>
1036         /// Tap gesture event callback.
1037         /// </summary>
1038         /// <param name="source">Source which recieved touch event.</param>
1039         /// <param name="e">Tap gesture event argument.</param>
1040         /// <since_tizen> 6 </since_tizen>
1041         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1042         [EditorBrowsable(EditorBrowsableState.Never)]
1043         protected override void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
1044         {
1045             if (isEnabled)
1046             {
1047                 ClickEventArgs eventArgs = new ClickEventArgs();
1048                 OnClick(eventArgs);
1049                 base.OnTapGestureDetected(source, e);
1050             }
1051         }
1052
1053         /// <summary>
1054         /// Called after a touch event is received by the owning view.<br />
1055         /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
1056         /// </summary>
1057         /// <param name="touch">The touch event.</param>
1058         /// <returns>True if the event should be consumed.</returns>
1059         /// <since_tizen> 6 </since_tizen>
1060         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1061         [EditorBrowsable(EditorBrowsableState.Never)]
1062         public override bool OnTouch(Touch touch)
1063         {
1064             PointStateType state = touch.GetState(0);
1065       
1066             switch(state)
1067             {
1068                 case PointStateType.Down:
1069                     isPressed = true;
1070                     UpdateState();
1071                     return true;
1072                 case PointStateType.Interrupted:
1073                     isPressed = false;
1074                     UpdateState();
1075                     return true;
1076                 case PointStateType.Up:
1077                     isPressed = false;
1078                     if (buttonAttributes.IsSelectable != null && buttonAttributes.IsSelectable == true)
1079                     {
1080                         isSelected = !isSelected;
1081                     }
1082                     UpdateState();
1083                     return true;
1084                 default:
1085                     break;
1086             }
1087             return base.OnTouch(touch);
1088         }
1089         /// <summary>
1090         /// Get Button attribues.
1091         /// </summary>
1092         /// <since_tizen> 6 </since_tizen>
1093         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1094         [EditorBrowsable(EditorBrowsableState.Never)]
1095         protected override Attributes GetAttributes()
1096         {
1097             return new ButtonAttributes();
1098         }
1099         /// <summary>
1100         /// Update Button by attributes.
1101         /// </summary>
1102         /// <since_tizen> 6 </since_tizen>
1103         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1104         [EditorBrowsable(EditorBrowsableState.Never)]
1105         protected override void OnUpdate()
1106         {
1107             if (buttonAttributes.ShadowImageAttributes != null)
1108             {
1109                 if(shadowImage == null)
1110                 {
1111                     shadowImage = new ImageView()
1112                     {
1113                         WidthResizePolicy = ResizePolicyType.FillToParent,
1114                         HeightResizePolicy = ResizePolicyType.FillToParent
1115                     };
1116                     this.Add(shadowImage);
1117                 }
1118                 ApplyAttributes(shadowImage, buttonAttributes.ShadowImageAttributes);
1119             }
1120
1121             if (buttonAttributes.BackgroundImageAttributes != null)
1122             {
1123                 if(backgroundImage == null)
1124                 {
1125                     backgroundImage = new ImageView()
1126                     {
1127                         WidthResizePolicy = ResizePolicyType.FillToParent,
1128                         HeightResizePolicy = ResizePolicyType.FillToParent
1129                     };
1130                     this.Add(backgroundImage);
1131                 }
1132                 ApplyAttributes(backgroundImage, buttonAttributes.BackgroundImageAttributes);
1133             }
1134
1135             if (buttonAttributes.OverlayImageAttributes != null)
1136             {
1137                 if(overlayImage == null)
1138                 {
1139                     overlayImage = new ImageView()
1140                     {
1141                         WidthResizePolicy = ResizePolicyType.FillToParent,
1142                         HeightResizePolicy = ResizePolicyType.FillToParent
1143                     };
1144                     this.Add(overlayImage);
1145                 }
1146                 ApplyAttributes(overlayImage, buttonAttributes.OverlayImageAttributes);
1147             }
1148
1149             if (buttonAttributes.TextAttributes != null)
1150             {
1151                 if(buttonText == null)
1152                 {
1153                     buttonText = new TextLabel();
1154                     this.Add(buttonText);
1155                 }
1156                 ApplyAttributes(buttonText, buttonAttributes.TextAttributes);
1157             }
1158
1159             if (buttonAttributes.IconAttributes != null)
1160             {
1161                 if(buttonIcon == null)
1162                 {
1163                     buttonIcon = new ImageView();
1164                     buttonIcon.Relayout += OnIconRelayout;
1165                     this.Add(buttonIcon);
1166                 }
1167                 ApplyAttributes(buttonIcon, buttonAttributes.IconAttributes);
1168             }
1169
1170             MeasureText();
1171             LayoutChild();
1172
1173             Sensitive = isEnabled ? true : false;
1174         }
1175
1176         /// <summary>
1177         /// Update Button State.
1178         /// </summary>
1179         /// <since_tizen> 6 </since_tizen>
1180         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1181         [EditorBrowsable(EditorBrowsableState.Never)]
1182         protected void UpdateState()
1183         {
1184             ControlStates sourceState = State;
1185             ControlStates targetState;
1186
1187             if(isEnabled)
1188             {
1189                 targetState = isPressed ? ControlStates.Pressed : (IsFocused ? (IsSelected ? ControlStates.SelectedFocused : ControlStates.Focused) : (IsSelected ? ControlStates.Selected : ControlStates.Normal));
1190             }
1191             else
1192             {
1193                 targetState = IsSelected ? ControlStates.DisabledSelected : (IsFocused ? ControlStates.DisabledFocused : ControlStates.Disabled);
1194             }
1195             if(sourceState != targetState)
1196             {
1197                 State = targetState;
1198
1199                 OnUpdate();
1200
1201                 StateChangeEventArgs e = new StateChangeEventArgs
1202                 {
1203                     PreviousState = sourceState,
1204                     CurrentState = targetState
1205                 };
1206                 stateChangeHander?.Invoke(this, e);
1207             }
1208         }
1209         /// <summary>
1210         /// It is hijack by using protected, attributes copy problem when class inherited from Button.
1211         /// </summary>
1212         /// <since_tizen> 6 </since_tizen>
1213         private void Initialize()
1214         {
1215             buttonAttributes = attributes as ButtonAttributes;
1216             if (buttonAttributes == null)
1217             {
1218                 throw new Exception("Button attribute parse error.");
1219             }
1220
1221             ApplyAttributes(this, buttonAttributes);
1222             LayoutDirectionChanged += OnLayoutDirectionChanged;
1223         }
1224
1225         /// <summary>
1226         /// Measure text, it can be override.
1227         /// </summary>
1228         /// <since_tizen> 6 </since_tizen>
1229         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1230         [EditorBrowsable(EditorBrowsableState.Never)]
1231         protected virtual void MeasureText()
1232         {
1233             if (buttonAttributes.IconRelativeOrientation == null || buttonIcon == null || buttonText == null)
1234             {
1235                 return;
1236             }
1237             buttonText.WidthResizePolicy = ResizePolicyType.Fixed;
1238             buttonText.HeightResizePolicy = ResizePolicyType.Fixed;
1239             int textPaddingLeft = buttonAttributes.TextAttributes.PaddingLeft;
1240             int textPaddingRight = buttonAttributes.TextAttributes.PaddingRight;
1241             int textPaddingTop = buttonAttributes.TextAttributes.PaddingTop;
1242             int textPaddingBottom = buttonAttributes.TextAttributes.PaddingBottom;
1243
1244             int iconPaddingLeft = buttonAttributes.IconAttributes.PaddingLeft;
1245             int iconPaddingRight = buttonAttributes.IconAttributes.PaddingRight;
1246             int iconPaddingTop = buttonAttributes.IconAttributes.PaddingTop;
1247             int iconPaddingBottom = buttonAttributes.IconAttributes.PaddingBottom;
1248
1249             if (IconRelativeOrientation == IconOrientation.Top || IconRelativeOrientation == IconOrientation.Bottom)
1250             {
1251                 buttonText.SizeWidth = SizeWidth - textPaddingLeft - textPaddingRight;
1252                 buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom - iconPaddingTop - iconPaddingBottom - buttonIcon.SizeHeight;
1253             }
1254             else
1255             {
1256                 buttonText.SizeWidth = SizeWidth - textPaddingLeft - textPaddingRight - iconPaddingLeft - iconPaddingRight - buttonIcon.SizeWidth;
1257                 buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom;
1258             }
1259         }
1260         /// <summary>
1261         /// Layout child, it can be override.
1262         /// </summary>
1263         /// <since_tizen> 6 </since_tizen>
1264         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1265         [EditorBrowsable(EditorBrowsableState.Never)]
1266         protected virtual void LayoutChild()
1267         {
1268             if (buttonAttributes.IconRelativeOrientation == null || buttonIcon == null || buttonText == null)
1269             {
1270                 return;
1271             }
1272
1273             int textPaddingLeft = buttonAttributes.TextAttributes.PaddingLeft;
1274             int textPaddingRight = buttonAttributes.TextAttributes.PaddingRight;
1275             int textPaddingTop = buttonAttributes.TextAttributes.PaddingTop;
1276             int textPaddingBottom = buttonAttributes.TextAttributes.PaddingBottom;
1277
1278             int iconPaddingLeft = buttonAttributes.IconAttributes.PaddingLeft;
1279             int iconPaddingRight = buttonAttributes.IconAttributes.PaddingRight;
1280             int iconPaddingTop = buttonAttributes.IconAttributes.PaddingTop;
1281             int iconPaddingBottom = buttonAttributes.IconAttributes.PaddingBottom;
1282
1283             switch (IconRelativeOrientation)
1284             {
1285                 case IconOrientation.Top:
1286                     buttonIcon.PositionUsesPivotPoint = true;
1287                     buttonIcon.ParentOrigin = NUI.ParentOrigin.TopCenter;
1288                     buttonIcon.PivotPoint = NUI.PivotPoint.TopCenter;
1289                     buttonIcon.Position2D = new Position2D(0, iconPaddingTop);
1290
1291                     buttonText.PositionUsesPivotPoint = true;
1292                     buttonText.ParentOrigin = NUI.ParentOrigin.BottomCenter;
1293                     buttonText.PivotPoint = NUI.PivotPoint.BottomCenter;
1294                     buttonText.Position2D = new Position2D(0, -textPaddingBottom);
1295                     break;
1296                 case IconOrientation.Bottom:
1297                     buttonIcon.PositionUsesPivotPoint = true;
1298                     buttonIcon.ParentOrigin = NUI.ParentOrigin.BottomCenter;
1299                     buttonIcon.PivotPoint = NUI.PivotPoint.BottomCenter;
1300                     buttonIcon.Position2D = new Position2D(0, -iconPaddingBottom);
1301
1302                     buttonText.PositionUsesPivotPoint = true;
1303                     buttonText.ParentOrigin = NUI.ParentOrigin.TopCenter;
1304                     buttonText.PivotPoint = NUI.PivotPoint.TopCenter;
1305                     buttonText.Position2D = new Position2D(0, textPaddingTop);
1306                     break;
1307                 case IconOrientation.Left:
1308                     if (LayoutDirection == ViewLayoutDirectionType.LTR)
1309                     {
1310                         buttonIcon.PositionUsesPivotPoint = true;
1311                         buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft;
1312                         buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft;
1313                         buttonIcon.Position2D = new Position2D(iconPaddingLeft, 0);
1314
1315                         buttonText.PositionUsesPivotPoint = true;
1316                         buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight;
1317                         buttonText.PivotPoint = NUI.PivotPoint.CenterRight;
1318                         buttonText.Position2D = new Position2D(-textPaddingRight, 0);
1319                     }
1320                     else
1321                     {
1322                         buttonIcon.PositionUsesPivotPoint = true;
1323                         buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight;
1324                         buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight;
1325                         buttonIcon.Position2D = new Position2D(-iconPaddingLeft, 0);
1326
1327                         buttonText.PositionUsesPivotPoint = true;
1328                         buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
1329                         buttonText.PivotPoint = NUI.PivotPoint.CenterLeft;
1330                         buttonText.Position2D = new Position2D(textPaddingRight, 0);
1331                     }
1332
1333                     break;
1334                 case IconOrientation.Right:
1335                     if (LayoutDirection == ViewLayoutDirectionType.RTL)
1336                     {
1337                         buttonIcon.PositionUsesPivotPoint = true;
1338                         buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft;
1339                         buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft;
1340                         buttonIcon.Position2D = new Position2D(iconPaddingRight, 0);
1341
1342                         buttonText.PositionUsesPivotPoint = true;
1343                         buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight;
1344                         buttonText.PivotPoint = NUI.PivotPoint.CenterRight;
1345                         buttonText.Position2D = new Position2D(-textPaddingLeft, 0);
1346                     }
1347                     else
1348                     {
1349                         buttonIcon.PositionUsesPivotPoint = true;
1350                         buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight;
1351                         buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight;
1352                         buttonIcon.Position2D = new Position2D(-iconPaddingRight, 0);
1353
1354                         buttonText.PositionUsesPivotPoint = true;
1355                         buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
1356                         buttonText.PivotPoint = NUI.PivotPoint.CenterLeft;
1357                         buttonText.Position2D = new Position2D(textPaddingLeft, 0);
1358                     }
1359                     break;
1360                 default:
1361                     break;
1362             }
1363         }
1364         /// <summary>
1365         /// Theme change callback when theme is changed, this callback will be trigger.
1366         /// </summary>
1367         /// <since_tizen> 6 </since_tizen>
1368         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1369         [EditorBrowsable(EditorBrowsableState.Never)]
1370         protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
1371         {
1372             ButtonAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as ButtonAttributes;
1373             if(tempAttributes != null)
1374             {
1375                 attributes = buttonAttributes = tempAttributes;
1376                 RelayoutRequest();
1377             }
1378         }
1379
1380         private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
1381         {
1382             MeasureText();
1383             LayoutChild();
1384         }
1385
1386         private void OnClick(ClickEventArgs eventArgs)
1387         {
1388             ClickEvent?.Invoke(this, eventArgs);
1389         }
1390
1391         private void OnIconRelayout(object sender, EventArgs e)
1392         {
1393             MeasureText();
1394             LayoutChild();
1395         }
1396
1397         private void CreateBackgroundAttributes()
1398         {
1399             if (buttonAttributes.BackgroundImageAttributes == null)
1400             {
1401                 buttonAttributes.BackgroundImageAttributes = new ImageAttributes()
1402                 {
1403                     PositionUsesPivotPoint = true,
1404                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
1405                     PivotPoint = Tizen.NUI.PivotPoint.Center,
1406                     WidthResizePolicy = ResizePolicyType.FillToParent,
1407                     HeightResizePolicy = ResizePolicyType.FillToParent
1408                 };
1409             }
1410         }
1411
1412         private void CreateShadowAttributes()
1413         {
1414             if (buttonAttributes.ShadowImageAttributes == null)
1415             {
1416                 buttonAttributes.ShadowImageAttributes = new ImageAttributes()
1417                 {
1418                     PositionUsesPivotPoint = true,
1419                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
1420                     PivotPoint = Tizen.NUI.PivotPoint.Center,
1421                     WidthResizePolicy = ResizePolicyType.FillToParent,
1422                     HeightResizePolicy = ResizePolicyType.FillToParent
1423                 };
1424             }
1425         }
1426
1427         private void CreateOverlayAttributes()
1428         {
1429             if (buttonAttributes.OverlayImageAttributes == null)
1430             {
1431                 buttonAttributes.OverlayImageAttributes = new ImageAttributes()
1432                 {
1433                     PositionUsesPivotPoint = true,
1434                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
1435                     PivotPoint = Tizen.NUI.PivotPoint.Center,
1436                     WidthResizePolicy = ResizePolicyType.FillToParent,
1437                     HeightResizePolicy = ResizePolicyType.FillToParent
1438                 };
1439             }
1440         }
1441
1442         private void CreateTextAttributes()
1443         {
1444             if (buttonAttributes.TextAttributes == null)
1445             {
1446                 buttonAttributes.TextAttributes = new TextAttributes()
1447                 {
1448                     PositionUsesPivotPoint = true,
1449                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
1450                     PivotPoint = Tizen.NUI.PivotPoint.Center,
1451                     WidthResizePolicy = ResizePolicyType.FillToParent,
1452                     HeightResizePolicy = ResizePolicyType.FillToParent,
1453                     HorizontalAlignment = HorizontalAlignment.Center,
1454                     VerticalAlignment = VerticalAlignment.Center
1455                 };
1456             }
1457         }
1458
1459         private void CreateIconAttributes()
1460         {
1461             if (buttonAttributes.IconAttributes == null)
1462             {
1463                 buttonAttributes.IconAttributes = new ImageAttributes()
1464                 {
1465                     PositionUsesPivotPoint = true,
1466                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
1467                     PivotPoint = Tizen.NUI.PivotPoint.Center,
1468                     WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1469                     HeightResizePolicy = ResizePolicyType.UseNaturalSize,
1470                 };
1471             }
1472         }
1473         /// <summary>
1474         /// ClickEventArgs is a class to record button click event arguments which will sent to user.
1475         /// </summary>
1476         /// <since_tizen> 6 </since_tizen>
1477         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1478         [EditorBrowsable(EditorBrowsableState.Never)]
1479         public class ClickEventArgs : EventArgs
1480         {
1481         }
1482         /// <summary>
1483         /// StateChangeEventArgs is a class to record button state change event arguments which will sent to user.
1484         /// </summary>
1485         /// <since_tizen> 6 </since_tizen>
1486         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1487         [EditorBrowsable(EditorBrowsableState.Never)]
1488         public class StateChangeEventArgs : EventArgs
1489         {
1490             /// <summary> previous state of Button </summary>
1491             /// <since_tizen> 6 </since_tizen>
1492             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1493             [EditorBrowsable(EditorBrowsableState.Never)]
1494             public ControlStates PreviousState;
1495             /// <summary> current state of Button </summary>
1496             /// <since_tizen> 6 </since_tizen>
1497             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1498             [EditorBrowsable(EditorBrowsableState.Never)]
1499             public ControlStates CurrentState;
1500         }
1501
1502     }
1503 }