using Sandbox.UI; using System; namespace Editor; public class SegmentedControl : Widget { private List options = new(); private int selectedIndex = 0; public int SelectedIndex { get => selectedIndex; set { selectedIndex = value; SelectedChanged(); } } public string Selected { get => options[selectedIndex]; set { var index = options.IndexOf( value ); if ( index < 0 ) return; selectedIndex = index; Update(); } } public Action OnSelectedChanged; bool _showtext = true; public bool ShowText { get => _showtext; set { if ( ShowText == value ) return; _showtext = value; foreach ( var option in Children.OfType