[NUI] Open the APIs of Button/CheckBox/RadioButton/Slider/Switch (#1722)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RadioButton.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.ComponentModel;
18
19 namespace Tizen.NUI.Components
20 {
21     /// <summary>
22     /// RadioButton is the Class that describe the control which can be checked, but not cleared by a user.
23     /// </summary>
24     /// <code>
25     /// RadioButton radio = new RadioButton("C_RadioButton_WhiteText");
26     /// radio.Size = new Size(200, 64, 0);
27     /// radio.Position = new Position(500, posY, 0);
28     /// radio.Text = "RadioButton";
29     /// radio.Focusable = true;
30     /// </code>
31     /// <since_tizen> 8 </since_tizen>
32     public class RadioButton : SelectButton
33     {
34         static RadioButton() { }
35
36         /// <summary>
37         /// Creates a new instance of a RadioButton.
38         /// </summary>
39         /// <since_tizen> 8 </since_tizen>
40         public RadioButton() : base() { }
41         /// <summary>
42         /// Creates a new instance of a RadioButton with style.
43         /// </summary>
44         /// <param name="style"></param>
45         /// <since_tizen> 8 </since_tizen>
46         public RadioButton(string style) : base(style) { }
47         /// <summary>
48         /// Creates a new instance of a RadioButton with style.
49         /// </summary>
50         /// <param name="buttonStyle"></param>
51         /// <since_tizen> 8 </since_tizen>
52         public RadioButton(ButtonStyle buttonStyle) : base(buttonStyle) { }
53
54         /// <summary>
55         /// Get RadioButtonGroup to which this selections belong.
56         /// </summary>
57         /// <since_tizen> 6 </since_tizen>
58         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
59         [EditorBrowsable(EditorBrowsableState.Never)]
60         public RadioButtonGroup ItemGroup
61         {
62             get
63             {
64                 return base.ItemGroup as RadioButtonGroup;
65             }
66             internal set
67             {
68                 base.ItemGroup = value;
69             }
70         }
71
72         /// <summary>
73         /// Set CheckState to true after selecting RadioButton.
74         /// </summary>
75         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
76         [EditorBrowsable(EditorBrowsableState.Never)]
77         protected override void OnSelectedChanged()
78         {
79             if (!IsSelected)
80             {
81                 IsSelected = true;
82             }
83         }
84     }
85 }