ToggleBool toggles the selected boolean value. Returns the key and new value for the caller to act on.
()
| 140 | // ToggleBool toggles the selected boolean value. |
| 141 | // Returns the key and new value for the caller to act on. |
| 142 | func (s *SettingsOverlay) ToggleBool() (key string, newVal bool) { |
| 143 | if s.selectedIndex < len(s.items) && s.items[s.selectedIndex].Type == SettingsItemBool { |
| 144 | s.items[s.selectedIndex].BoolVal = !s.items[s.selectedIndex].BoolVal |
| 145 | return s.items[s.selectedIndex].Key, s.items[s.selectedIndex].BoolVal |
| 146 | } |
| 147 | return "", false |
| 148 | } |
| 149 | |
| 150 | // RevertToggle reverts the last toggle (used when validation fails). |
| 151 | func (s *SettingsOverlay) RevertToggle() { |
no outgoing calls