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