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()
49 /// Get the RadioButton object at the specified index.
51 /// <param name="index">item index</param>
52 /// <returns>RadioButton</returns>
53 /// <since_tizen> 6 </since_tizen>
54 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public RadioButton GetItemByIndex(int index)
58 return itemGroup[index] as RadioButton;
62 /// Add RadioButton to the end of RadioButtonGroup.
64 /// <param name="radio">The RadioButton to be added to the RadioButtonGroup</param>
65 /// <since_tizen> 6 </since_tizen>
66 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 public void Add(RadioButton radio)
70 base.AddSelection(radio);
71 radio.ItemGroup = this;
76 /// Remove RadioButton from the RadioButtonGroup.
78 /// <param name="radio">The RadioButton to remove from the RadioButtonGroup</param>
79 /// <since_tizen> 6 </since_tizen>
80 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public void Remove(RadioButton radio)
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;