[NUI] Sync with dalihub (#969)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.CommonUI / 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.CommonUI
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> 6 </since_tizen>
32     /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
33     [EditorBrowsable(EditorBrowsableState.Never)]
34     public class RadioButton : SelectButton
35     {
36         /// <summary>
37         /// Creates a new instance of a RadioButton.
38         /// </summary>
39         /// <since_tizen> 6 </since_tizen>
40         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
41         [EditorBrowsable(EditorBrowsableState.Never)]
42         public RadioButton() : base() { }
43         /// <summary>
44         /// Creates a new instance of a RadioButton with style.
45         /// </summary>
46         /// <param name="style"></param>
47         /// <since_tizen> 6 </since_tizen>
48         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
49         [EditorBrowsable(EditorBrowsableState.Never)]
50         public RadioButton(string style) : base(style) { }
51         /// <summary>
52         /// Creates a new instance of a RadioButton with attributes.
53         /// </summary>
54         /// <param name="attrs"></param>
55         /// <since_tizen> 6 </since_tizen>
56         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
57         [EditorBrowsable(EditorBrowsableState.Never)]
58         public RadioButton(SelectButtonAttributes attrs) : base(attrs) { }
59         /// <summary>
60         /// Get RadioButtonGroup to which this selections belong.
61         /// </summary>
62         /// <since_tizen> 6 </since_tizen>
63         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
64         [EditorBrowsable(EditorBrowsableState.Never)]
65         public RadioButtonGroup ItemGroup
66         {
67             get
68             {
69                 return itemGroup as RadioButtonGroup;
70             }
71             internal set
72             {
73                 itemGroup = value;
74             }
75         }
76
77         /// <summary>
78         /// Set CheckState to true after selecting RadioButton.
79         /// </summary>
80         /// <since_tizen> 6 </since_tizen>
81         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
82         [EditorBrowsable(EditorBrowsableState.Never)]
83         protected override void OnSelected()
84         {
85             if (!IsSelected)
86             {
87                 IsSelected = true;
88             }
89         }
90     }
91 }