2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 using System.ComponentModel;
19 namespace Tizen.NUI.Components
22 /// The RadioButtonGroup class is used to group together a set of RadioButton control
23 /// It enables the user to select exclusively single radio button of group.
26 /// RadioButtonGroup radioGroup = new RadioButtonGroup();
27 /// RadioButton radio1 = new RadioButton();
28 /// RadioButton radio2 = new RadioButton();
29 /// radioGroup.Add(radio1);
30 /// radioGroup.Add(radio2);
32 /// <since_tizen> 6 </since_tizen>
33 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public class RadioButtonGroup : SelectGroup
38 /// Construct RadioButtonGroup
40 /// <since_tizen> 6 </since_tizen>
41 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
42 [EditorBrowsable(EditorBrowsableState.Never)]
43 public RadioButtonGroup() : base()
48 /// Get the RadioButton object at the specified index.
50 /// <param name="index">item index</param>
51 /// <returns>RadioButton</returns>
52 /// <since_tizen> 6 </since_tizen>
53 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
54 [EditorBrowsable(EditorBrowsableState.Never)]
55 public RadioButton GetItem(int index)
57 return ItemGroup[index] as RadioButton;
61 /// Add RadioButton to the end of RadioButtonGroup.
63 /// <param name="radio">The RadioButton to be added to the RadioButtonGroup</param>
64 /// <since_tizen> 6 </since_tizen>
65 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 public void Add(RadioButton radio)
69 if (null == radio) return;
70 base.AddSelection(radio);
71 radio.ItemGroup = this;
75 /// Remove RadioButton from the RadioButtonGroup.
77 /// <param name="radio">The RadioButton to remove from the RadioButtonGroup</param>
78 /// <since_tizen> 6 </since_tizen>
79 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public void Remove(RadioButton radio)
83 if (null == radio) return;
84 base.RemoveSelection(radio);
85 radio.ItemGroup = null;
89 /// Handle user's select action. Turn on check state of selected RadioButton,
90 /// and turn out check state of other RadioButtons in RadioButtonGroup
92 /// <param name="selection">The selection selected by user</param>
93 /// <since_tizen> 6 </since_tizen>
94 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 protected override void SelectionHandler(SelectButton selection)
98 RadioButton radio = selection as RadioButton;
99 if (!ItemGroup.Contains(radio))
104 foreach (RadioButton btn in ItemGroup)
106 if (btn != null && btn != radio && btn.IsEnabled == true)
108 btn.IsSelected = false;