Release 4.0.0-preview1-00301
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / Button.cs
1 /*
2  * Copyright(c) 2017 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
18 namespace Tizen.NUI.UIComponents
19 {
20
21     using System;
22     using System.Runtime.InteropServices;
23     using Tizen.NUI.BaseComponents;
24
25     /// <summary>
26     /// The Button class is a base class for different kinds of buttons.<br />
27     /// This class provides the disabled property and the clicked signal.<br />
28     /// The clicked event handler is emitted when the button is touched, and the touch point doesn't leave the boundary of the button.<br />
29     /// When the disabled property is set to true, no signal is emitted.<br />
30     /// The 'Visual' describes not just traditional images like PNG and BMP, but also refers to whatever is used to show the button. It could be a color, gradient, or some other kind of renderer.<br />
31     /// The button's appearance can be modified by setting properties for the various visuals or images.<br />
32     /// It is not mandatory to set all the visuals. A button could be defined only by setting its background visual, or by setting its background and selected visuals.<br />
33     /// The button visual is shown over the background visual.<br />
34     /// When pressed, the unselected visuals are replaced by the selected visuals.<br />
35     /// The text label is always placed on the top of all images.<br />
36     /// When the button is disabled, the background button and the selected visuals are replaced by their disabled visuals.<br />
37     /// </summary>
38     public class Button : View
39     {
40         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41
42         internal Button(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Button_SWIGUpcast(cPtr), cMemoryOwn)
43         {
44             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
45         }
46
47         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Button obj)
48         {
49             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50         }
51
52         /// <summary>
53         /// To dispose the button instance.
54         /// </summary>
55         protected override void Dispose(DisposeTypes type)
56         {
57             if (disposed)
58             {
59                 return;
60             }
61
62             if (type == DisposeTypes.Explicit)
63             {
64                 //Called by User
65                 //Release your own managed resources here.
66                 //You should release all of your own disposable objects here.
67
68             }
69
70             //Release your own unmanaged resources here.
71             //You should not access any managed member here except static instance.
72             //because the execution order of Finalizes is non-deterministic.
73
74             DisConnectFromSignals();
75
76             if (swigCPtr.Handle != global::System.IntPtr.Zero)
77             {
78                 if (swigCMemOwn)
79                 {
80                     swigCMemOwn = false;
81                     NDalicPINVOKE.delete_Button(swigCPtr);
82                 }
83                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
84             }
85
86             base.Dispose(type);
87         }
88
89         private void DisConnectFromSignals()
90         {
91             // Save current CPtr.
92             global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr;
93
94             // Use BaseHandle CPtr as current might have been deleted already in derived classes.
95             swigCPtr = GetBaseHandleCPtrHandleRef;
96
97             if (_stateChangedCallback != null)
98             {
99                 StateChangedSignal().Disconnect(_stateChangedCallback);
100             }
101
102             if (_releasedCallback != null)
103             {
104                 ReleasedSignal().Disconnect(_releasedCallback);
105             }
106
107             if (_pressedCallback != null)
108             {
109                 this.PressedSignal().Disconnect(_pressedCallback);
110             }
111
112             if (_clickedCallback != null)
113             {
114                 ClickedSignal().Disconnect(_clickedCallback);
115             }
116
117             // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
118             // Restore current CPtr.
119             swigCPtr = currentCPtr;
120         }
121
122
123         private EventHandlerWithReturnType<object, EventArgs, bool> _clickedEventHandler;
124         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
125         private delegate bool ClickedCallbackType(global::System.IntPtr data);
126         private ClickedCallbackType _clickedCallback;
127
128         /// <summary>
129         /// The Clicked event will be triggered when the button is touched and the touch point doesn't leave the boundary of the button.
130         /// </summary>
131         /// <since_tizen> 3 </since_tizen>
132         public event EventHandlerWithReturnType<object, EventArgs, bool> Clicked
133         {
134             add
135             {
136                 if (_clickedEventHandler == null)
137                 {
138                     _clickedCallback = OnClicked;
139                     ClickedSignal().Connect(_clickedCallback);
140                 }
141
142                 _clickedEventHandler += value;
143             }
144
145             remove
146             {
147                 _clickedEventHandler -= value;
148
149                 if (_clickedEventHandler == null && ClickedSignal().Empty() == false)
150                 {
151                     ClickedSignal().Disconnect(_clickedCallback);
152                 }
153             }
154         }
155
156
157         private bool OnClicked(IntPtr data)
158         {
159             if (_clickedEventHandler != null)
160             {
161                 return _clickedEventHandler(this, null);
162             }
163             return false;
164         }
165
166
167
168         private EventHandlerWithReturnType<object, EventArgs, bool> _pressedEventHandler;
169         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
170         private delegate bool PressedCallbackType(global::System.IntPtr data);
171         private PressedCallbackType _pressedCallback;
172
173         /// <summary>
174         /// The Pressed event will be triggered when the button is touched.
175         /// </summary>
176         /// <since_tizen> 3 </since_tizen>
177         public event EventHandlerWithReturnType<object, EventArgs, bool> Pressed
178         {
179             add
180             {
181                 if (_pressedEventHandler == null)
182                 {
183                     _pressedCallback = OnPressed;
184                     PressedSignal().Connect(_pressedCallback);
185                 }
186
187                 _pressedEventHandler += value;
188             }
189
190             remove
191             {
192                 _pressedEventHandler -= value;
193
194                 if (_pressedEventHandler == null && PressedSignal().Empty() == false)
195                 {
196                     this.PressedSignal().Disconnect(_pressedCallback);
197                 }
198             }
199         }
200
201         private bool OnPressed(IntPtr data)
202         {
203             if (_pressedEventHandler != null)
204             {
205                 return _pressedEventHandler(this, null);
206             }
207             return false;
208         }
209
210
211
212         private EventHandlerWithReturnType<object, EventArgs, bool> _releasedEventHandler;
213         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
214         private delegate bool ReleasedCallbackType(global::System.IntPtr data);
215         private ReleasedCallbackType _releasedCallback;
216
217         /// <summary>
218         /// The Released event will be triggered when the button is touched and the touch point leaves the boundary of the button.
219         /// </summary>
220         /// <since_tizen> 3 </since_tizen>
221         public event EventHandlerWithReturnType<object, EventArgs, bool> Released
222         {
223             add
224             {
225                 if (_releasedEventHandler == null)
226                 {
227                     _releasedCallback = OnReleased;
228                     ReleasedSignal().Connect(_releasedCallback);
229                 }
230                 _releasedEventHandler += value;
231             }
232
233             remove
234             {
235                 _releasedEventHandler -= value;
236
237                 if (_releasedEventHandler == null && ReleasedSignal().Empty() == false)
238                 {
239                     ReleasedSignal().Disconnect(_releasedCallback);
240                 }
241
242             }
243         }
244
245         private bool OnReleased(IntPtr data)
246         {
247             if (_releasedEventHandler != null)
248             {
249                 return _releasedEventHandler(this, null);
250             }
251             return false;
252         }
253
254
255         private EventHandlerWithReturnType<object, EventArgs, bool> _stateChangedEventHandler;
256         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
257         private delegate bool StateChangedCallback(global::System.IntPtr data);
258         private StateChangedCallback _stateChangedCallback;
259
260         /// <summary>
261         /// The StateChanged event will be triggered when the button's state is changed.
262         /// </summary>
263         /// <since_tizen> 3 </since_tizen>
264         public event EventHandlerWithReturnType<object, EventArgs, bool> StateChanged
265         {
266             add
267             {
268                 if (_stateChangedEventHandler == null)
269                 {
270                     _stateChangedCallback = OnStateChanged;
271                     StateChangedSignal().Connect(_stateChangedCallback);
272                 }
273
274                 _stateChangedEventHandler += value;
275             }
276
277             remove
278             {
279                 _stateChangedEventHandler -= value;
280
281                 if (_stateChangedEventHandler == null && StateChangedSignal().Empty() == false)
282                 {
283                     StateChangedSignal().Disconnect(_stateChangedCallback);
284                 }
285             }
286         }
287
288         private bool OnStateChanged(IntPtr data)
289         {
290             if (_stateChangedEventHandler != null)
291             {
292                 return _stateChangedEventHandler(this, null);
293             }
294             return false;
295         }
296
297
298         /// <summary>
299         /// Gets or sets the unselected button foreground or icon visual.
300         /// </summary>
301         /// <since_tizen> 3 </since_tizen>
302         public Tizen.NUI.PropertyMap UnselectedVisual
303         {
304             get
305             {
306                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
307                 GetProperty(Button.Property.UNSELECTED_VISUAL).Get(temp);
308                 return temp;
309             }
310             set
311             {
312                 SetProperty(Button.Property.UNSELECTED_VISUAL, new Tizen.NUI.PropertyValue(value));
313             }
314         }
315
316         /// <summary>
317         /// Gets or sets the selected button foreground or icon visual.
318         /// </summary>
319         /// <since_tizen> 3 </since_tizen>
320         public Tizen.NUI.PropertyMap SelectedVisual
321         {
322             get
323             {
324                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
325                 GetProperty(Button.Property.SELECTED_VISUAL).Get(temp);
326                 return temp;
327             }
328             set
329             {
330                 SetProperty(Button.Property.SELECTED_VISUAL, new Tizen.NUI.PropertyValue(value));
331             }
332         }
333
334         /// <summary>
335         /// Gets or sets the disabled selected state foreground or icon button visual.
336         /// </summary>
337         /// <since_tizen> 3 </since_tizen>
338         public Tizen.NUI.PropertyMap DisabledSelectedVisual
339         {
340             get
341             {
342                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
343                 GetProperty(Button.Property.DISABLED_SELECTED_VISUAL).Get(temp);
344                 return temp;
345             }
346             set
347             {
348                 SetProperty(Button.Property.DISABLED_SELECTED_VISUAL, new Tizen.NUI.PropertyValue(value));
349             }
350         }
351
352         /// <summary>
353         /// Gets or sets the disabled unselected state foreground or icon visual.
354         /// </summary>
355         /// <since_tizen> 3 </since_tizen>
356         public Tizen.NUI.PropertyMap DisabledUnselectedVisual
357         {
358             get
359             {
360                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
361                 GetProperty(Button.Property.DISABLED_UNSELECTED_VISUAL).Get(temp);
362                 return temp;
363             }
364             set
365             {
366                 SetProperty(Button.Property.DISABLED_UNSELECTED_VISUAL, new Tizen.NUI.PropertyValue(value));
367             }
368         }
369
370         /// <summary>
371         /// Gets or sets the disabled unselected state background button visual.
372         /// </summary>
373         /// <since_tizen> 3 </since_tizen>
374         public Tizen.NUI.PropertyMap UnselectedBackgroundVisual
375         {
376             get
377             {
378                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
379                 GetProperty(Button.Property.UNSELECTED_BACKGROUND_VISUAL).Get(temp);
380                 return temp;
381             }
382             set
383             {
384                 SetProperty(Button.Property.UNSELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value));
385             }
386         }
387
388         /// <summary>
389         /// Gets or sets the selected background button visual.
390         /// </summary>
391         /// <since_tizen> 3 </since_tizen>
392         public Tizen.NUI.PropertyMap SelectedBackgroundVisual
393         {
394             get
395             {
396                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
397                 GetProperty(Button.Property.SELECTED_BACKGROUND_VISUAL).Get(temp);
398                 return temp;
399             }
400             set
401             {
402                 SetProperty(Button.Property.SELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value));
403             }
404         }
405
406         /// <summary>
407         /// Gets or sets the disabled while unselected background button visual.
408         /// </summary>
409         /// <since_tizen> 3 </since_tizen>
410         public Tizen.NUI.PropertyMap DisabledUnselectedBackgroundVisual
411         {
412             get
413             {
414                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
415                 GetProperty(Button.Property.DISABLED_UNSELECTED_BACKGROUND_VISUAL).Get(temp);
416                 return temp;
417             }
418             set
419             {
420                 SetProperty(Button.Property.DISABLED_UNSELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value));
421             }
422         }
423
424         /// <summary>
425         /// Gets or sets the disabled while selected background button visual.
426         /// </summary>
427         /// <since_tizen> 3 </since_tizen>
428         public Tizen.NUI.PropertyMap DisabledSelectedBackgroundVisual
429         {
430             get
431             {
432                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
433                 GetProperty(Button.Property.DISABLED_SELECTED_BACKGROUND_VISUAL).Get(temp);
434                 return temp;
435             }
436             set
437             {
438                 SetProperty(Button.Property.DISABLED_SELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value));
439             }
440         }
441
442         /// <summary>
443         /// Gets or sets the position of the the label in relation to the foreground or icon, if both present.
444         /// </summary>
445         /// <since_tizen> 3 </since_tizen>
446         public Align LabelRelativeAlignment
447         {
448             get
449             {
450                 string temp;
451                 if (GetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT).Get(out temp) == false)
452                 {
453                     NUILog.Error("LabelRelativeAlignment get error!");
454                 }
455                 switch (temp)
456                 {
457                     case "BEGIN":
458                         return Align.Begin;
459                     case "END":
460                         return Align.End;
461                     case "TOP":
462                         return Align.Top;
463                     case "BOTTOM":
464                         return Align.Bottom;
465                     default:
466                         return Align.End;
467                 }
468             }
469             set
470             {
471                 string valueToString = "";
472                 switch (value)
473                 {
474                     case Align.Begin:
475                     {
476                         valueToString = "BEGIN";
477                         break;
478                     }
479                     case Align.End:
480                     {
481                         valueToString = "END";
482                         break;
483                     }
484                     case Align.Top:
485                     {
486                         valueToString = "TOP";
487                         break;
488                     }
489                     case Align.Bottom:
490                     {
491                         valueToString = "BOTTOM";
492                         break;
493                     }
494                     default:
495                     {
496                         valueToString = "END";
497                         break;
498                     }
499                 }
500                 SetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
501             }
502         }
503
504         /// <summary>
505         /// Gets or sets the padding around the text.
506         /// </summary>
507         /// <since_tizen> 3 </since_tizen>
508         public Vector4 LabelPadding
509         {
510             get
511             {
512                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
513                 GetProperty(Button.Property.LABEL_PADDING).Get(temp);
514                 return temp;
515             }
516             set
517             {
518                 SetProperty(Button.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
519             }
520         }
521
522         /// <summary>
523         /// Gets or sets the padding around the foreground visual.
524         /// </summary>
525         /// <since_tizen> 3 </since_tizen>
526         public Vector4 ForegroundVisualPadding
527         {
528             get
529             {
530                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
531                 GetProperty(Button.Property.FOREGROUND_VISUAL_PADDING).Get(temp);
532                 return temp;
533             }
534             set
535             {
536                 SetProperty(Button.Property.FOREGROUND_VISUAL_PADDING, new Tizen.NUI.PropertyValue(value));
537             }
538         }
539
540         internal new class Property
541         {
542             internal static readonly int UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_VISUAL_get();
543             internal static readonly int SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_VISUAL_get();
544             internal static readonly int DISABLED_SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_SELECTED_VISUAL_get();
545             internal static readonly int DISABLED_UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_UNSELECTED_VISUAL_get();
546             internal static readonly int UNSELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_BACKGROUND_VISUAL_get();
547             internal static readonly int SELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_BACKGROUND_VISUAL_get();
548             internal static readonly int DISABLED_UNSELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get();
549             internal static readonly int DISABLED_SELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get();
550             internal static readonly int LABEL_RELATIVE_ALIGNMENT = NDalicManualPINVOKE.Button_Property_LABEL_RELATIVE_ALIGNMENT_get();
551             internal static readonly int LABEL_PADDING = NDalicManualPINVOKE.Button_Property_LABEL_PADDING_get();
552             internal static readonly int FOREGROUND_VISUAL_PADDING = NDalicManualPINVOKE.Button_Property_VISUAL_PADDING_get();
553             internal static readonly int AUTO_REPEATING = NDalicPINVOKE.Button_Property_AUTO_REPEATING_get();
554             internal static readonly int INITIAL_AUTO_REPEATING_DELAY = NDalicPINVOKE.Button_Property_INITIAL_AUTO_REPEATING_DELAY_get();
555             internal static readonly int NEXT_AUTO_REPEATING_DELAY = NDalicPINVOKE.Button_Property_NEXT_AUTO_REPEATING_DELAY_get();
556             internal static readonly int TOGGLABLE = NDalicPINVOKE.Button_Property_TOGGLABLE_get();
557             internal static readonly int SELECTED = NDalicPINVOKE.Button_Property_SELECTED_get();
558             internal static readonly int UNSELECTED_COLOR = NDalicPINVOKE.Button_Property_UNSELECTED_COLOR_get();
559             internal static readonly int SELECTED_COLOR = NDalicPINVOKE.Button_Property_SELECTED_COLOR_get();
560             internal static readonly int LABEL = NDalicPINVOKE.Button_Property_LABEL_get();
561         }
562
563         /// <summary>
564         /// Creates an uninitialized button.<br />
565         /// Only the derived versions can be instantiated.<br />
566         /// </summary>
567         /// <since_tizen> 3 </since_tizen>
568         public Button() : this(NDalicPINVOKE.new_Button__SWIG_0(), true)
569         {
570             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571         }
572
573         internal ButtonSignal PressedSignal()
574         {
575             ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_PressedSignal(swigCPtr), false);
576             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577             return ret;
578         }
579
580         internal ButtonSignal ReleasedSignal()
581         {
582             ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_ReleasedSignal(swigCPtr), false);
583             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584             return ret;
585         }
586
587         internal ButtonSignal ClickedSignal()
588         {
589             ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_ClickedSignal(swigCPtr), false);
590             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
591             return ret;
592         }
593
594         internal ButtonSignal StateChangedSignal()
595         {
596             ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_StateChangedSignal(swigCPtr), false);
597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598             return ret;
599         }
600
601         /// <summary>
602         /// If the autorepeating property is set to true, then the togglable property is set to false.
603         /// </summary>
604         /// <since_tizen> 3 </since_tizen>
605         public bool AutoRepeating
606         {
607             get
608             {
609                 bool temp = false;
610                 GetProperty(Button.Property.AUTO_REPEATING).Get(out temp);
611                 return temp;
612             }
613             set
614             {
615                 SetProperty(Button.Property.AUTO_REPEATING, new Tizen.NUI.PropertyValue(value));
616             }
617         }
618
619         /// <summary>
620         /// By default, this value is set to 0.15 seconds.
621         /// </summary>
622         /// <since_tizen> 3 </since_tizen>
623         public float InitialAutoRepeatingDelay
624         {
625             get
626             {
627                 float temp = 0.0f;
628                 GetProperty(Button.Property.INITIAL_AUTO_REPEATING_DELAY).Get(out temp);
629                 return temp;
630             }
631             set
632             {
633                 SetProperty(Button.Property.INITIAL_AUTO_REPEATING_DELAY, new Tizen.NUI.PropertyValue(value));
634             }
635         }
636
637         /// <summary>
638         /// By default, this value is set to 0.05 seconds.
639         /// </summary>
640         /// <since_tizen> 3 </since_tizen>
641         public float NextAutoRepeatingDelay
642         {
643             get
644             {
645                 float temp = 0.0f;
646                 GetProperty(Button.Property.NEXT_AUTO_REPEATING_DELAY).Get(out temp);
647                 return temp;
648             }
649             set
650             {
651                 SetProperty(Button.Property.NEXT_AUTO_REPEATING_DELAY, new Tizen.NUI.PropertyValue(value));
652             }
653         }
654
655         /// <summary>
656         /// If the togglable property is set to true, then the autorepeating property is set to false.
657         /// </summary>
658         /// <since_tizen> 3 </since_tizen>
659         public bool Togglable
660         {
661             get
662             {
663                 bool temp = false;
664                 GetProperty(Button.Property.TOGGLABLE).Get(out temp);
665                 return temp;
666             }
667             set
668             {
669                 SetProperty(Button.Property.TOGGLABLE, new Tizen.NUI.PropertyValue(value));
670             }
671         }
672
673         /// <summary>
674         /// Gets or sets the togglable button as either selected or unselected, togglable property must be set to true.
675         /// </summary>
676         /// <since_tizen> 3 </since_tizen>
677         public bool Selected
678         {
679             get
680             {
681                 bool temp = false;
682                 GetProperty(Button.Property.SELECTED).Get(out temp);
683                 return temp;
684             }
685             set
686             {
687                 SetProperty(Button.Property.SELECTED, new Tizen.NUI.PropertyValue(value));
688             }
689         }
690
691         /// <summary>
692         /// Gets or sets the unselected color.
693         /// </summary>
694         /// <since_tizen> 3 </since_tizen>
695         public Color UnselectedColor
696         {
697             get
698             {
699                 Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f);
700                 GetProperty(Button.Property.UNSELECTED_COLOR).Get(temp);
701                 return temp;
702             }
703             set
704             {
705                 SetProperty(Button.Property.UNSELECTED_COLOR, new Tizen.NUI.PropertyValue(value));
706             }
707         }
708
709         /// <summary>
710         /// Gets or sets the selected color.
711         /// </summary>
712         /// <since_tizen> 3 </since_tizen>
713         public Color SelectedColor
714         {
715             get
716             {
717                 Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f);
718                 GetProperty(Button.Property.SELECTED_COLOR).Get(temp);
719                 return temp;
720             }
721             set
722             {
723                 SetProperty(Button.Property.SELECTED_COLOR, new Tizen.NUI.PropertyValue(value));
724             }
725         }
726
727         /// <summary>
728         /// Gets or sets the label.
729         /// </summary>
730         /// <since_tizen> 3 </since_tizen>
731         public Tizen.NUI.PropertyMap Label
732         {
733             get
734             {
735                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
736                 GetProperty(Button.Property.LABEL).Get(temp);
737                 return temp;
738             }
739             set
740             {
741                 SetProperty(Button.Property.LABEL, new Tizen.NUI.PropertyValue(value));
742             }
743         }
744
745         /// <summary>
746         /// Gets or sets the text of the label.
747         /// </summary>
748         /// <since_tizen> 3 </since_tizen>
749         public string LabelText
750         {
751             get
752             {
753                 Tizen.NUI.PropertyMap map = new Tizen.NUI.PropertyMap();
754                 GetProperty( Button.Property.LABEL).Get(map);
755                 Tizen.NUI.PropertyValue value = map.Find( TextVisualProperty.Text, "Text");
756                 string str;
757                 value.Get(out str);
758                 return str;
759             }
760             set
761             {
762                 SetProperty( Button.Property.LABEL, new Tizen.NUI.PropertyValue( value ) );
763             }
764         }
765
766         /// <summary>
767         /// Enumeration for describing the position, the text label can be, in relation to the control (and foreground/icon).
768         /// </summary>
769         /// <since_tizen> 3 </since_tizen>
770         public enum Align
771         {
772             /// <summary>
773             /// At the start of the control before the foreground or icon.
774             /// </summary>
775             Begin,
776             /// <summary>
777             /// At the end of the control after the foreground or icon.
778             /// </summary>
779             End,
780             /// <summary>
781             /// At the top of the control above the foreground or icon.
782             /// </summary>
783             Top,
784             /// <summary>
785             /// At the bottom of the control below the foreground or icon.
786             /// </summary>
787             Bottom
788         }
789
790     }
791
792 }