Release 4.0.0-preview1-00301
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / RadioButton.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     /// <summary>
22     /// A RadioButton provides a radio button with two states, \e selected or \e unselected.<br />
23     /// Radio buttons are designed to select one of the many options at the same time.<br />
24     /// A RadioButton can change its current state using the selected.<br />
25     /// <br />
26     /// RadioButtons can be grouped.<br />
27     /// Two or more RadioButtons are in one group when they have this same parent.<br />
28     /// In each groups only one RadioButton can be \e selected at a given time.<br />
29     /// So when a RadioButton is set to \e selected, other RadioButtons in its group are set to \e unselected.<br />
30     /// When \e selected RadioButton is set to \e unselected, no other RadioButtons in this group are set to \e selected.<br />
31     /// <br />
32     /// The StateChanged event is emitted when the RadioButton change its state to \e selected or \e unselected.<br />
33     /// </summary>
34     public class RadioButton : Button
35     {
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37
38         internal RadioButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.RadioButton_SWIGUpcast(cPtr), cMemoryOwn)
39         {
40             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41         }
42
43         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RadioButton obj)
44         {
45             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
46         }
47
48         /// <summary>
49         /// To dispose the RadioButton instance.
50         /// </summary>
51         protected override void Dispose(DisposeTypes type)
52         {
53             if (disposed)
54             {
55                 return;
56             }
57
58             if (type == DisposeTypes.Explicit)
59             {
60                 //Called by User
61                 //Release your own managed resources here.
62                 //You should release all of your own disposable objects here.
63
64             }
65
66             //Release your own unmanaged resources here.
67             //You should not access any managed member here except static instance.
68             //because the execution order of Finalizes is non-deterministic.
69
70             if (swigCPtr.Handle != global::System.IntPtr.Zero)
71             {
72                 if (swigCMemOwn)
73                 {
74                     swigCMemOwn = false;
75                     NDalicPINVOKE.delete_RadioButton(swigCPtr);
76                 }
77                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78             }
79
80             base.Dispose(type);
81         }
82         /// <summary>
83         /// Creates an uninitialized RadioButton.
84         /// </summary>
85         /// <since_tizen> 3 </since_tizen>
86         public RadioButton() : this(NDalicPINVOKE.RadioButton_New__SWIG_0(), true)
87         {
88             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89
90         }
91
92         /// <summary>
93         /// Creates an uninitialized RadioButton with the label.
94         /// </summary>
95         /// <param name="label">The label text.</param>
96         /// <since_tizen> 3 </since_tizen>
97         public RadioButton(string label) : this(NDalicPINVOKE.RadioButton_New__SWIG_1(label), true)
98         {
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100
101         }
102     }
103 }