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