// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings { public partial class SettingsDropdown : SettingsItem { protected new OsuDropdown Control => (OsuDropdown)base.Control; public IEnumerable Items { get => Control.Items; set => Control.Items = value; } public IBindableList ItemSource { get => Control.ItemSource; set => Control.ItemSource = value; } public override IEnumerable FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => (LocalisableString)i.ToString())); protected sealed override Drawable CreateControl() => CreateDropdown(); protected virtual OsuDropdown CreateDropdown() => new DropdownControl(); protected partial class DropdownControl : OsuDropdown { public DropdownControl() { RelativeSizeAxes = Axes.X; } protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200); } } }