Exemple #1
0
 public void NotifyToggleDeselected(HedraToggle toggle)
 {
     if (behaviour == ToggleGroupBehaviour.RadioButton && setToggles.Count <= 1)
     {
         toggle.Set();
         return;
     }
     setToggles.Remove(toggle);
 }
Exemple #2
0
 public void NotifyToggleSelected(HedraToggle toggle)
 {
     if (behaviour == ToggleGroupBehaviour.RadioButton)
     {
         UnsetTogglesExcept(toggle);
         setToggles.Clear();
     }
     setToggles.Add(toggle);
 }
Exemple #3
0
 protected void UnsetTogglesExcept(HedraToggle exception)
 {
     for (int i = 0; i < toggles.Count; i++)
     {
         if (toggles[i] != exception)
         {
             toggles[i].Unset();
         }
     }
 }
Exemple #4
0
        public void Set(int index)
        {
            if (index < 0 || index >= toggles.Count)
            {
                return;
            }

            HedraToggle target = toggles[index];

            if (!target.IsSet)
            {
                target.Set();
            }

            if (behaviour == ToggleGroupBehaviour.RadioButton)
            {
                UnsetTogglesExcept(target);
                setToggles.Clear();
            }
            setToggles.Add(target);
        }
Exemple #5
0
        public void Unset(int index)
        {
            if (index < 0 || index >= toggles.Count)
            {
                return;
            }

            if (behaviour == ToggleGroupBehaviour.RadioButton)
            {
                return;
            }

            HedraToggle target = toggles[index];

            if (!target.IsSet)
            {
                return;
            }

            target.Unset();
            setToggles.Remove(target);
        }
Exemple #6
0
        public void Register(HedraToggle toggle)
        {
            if (toggles.Contains(toggle))
            {
                return;
            }
            toggles.Add(toggle);

            if (!toggle.IsSet)
            {
                return;
            }

            if (behaviour == ToggleGroupBehaviour.RadioButton && setToggles.Count > 0)
            {
                toggle.Unset();
            }

            if (toggle.IsSet)
            {
                setToggles.Add(toggle);
            }
        }
Exemple #7
0
 public void Remove(HedraToggle toggle)
 {
     toggles.Remove(toggle);
 }