// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { public class OptionDropDown : FillFlowContainer { private DropDown dropdown; private SpriteText text; public string LabelText { get { return text.Text; } set { text.Text = value; } } public Bindable Bindable { get { return bindable; } set { bindable = value; dropdown.SelectedValue.BindTo(bindable); if (bindable.Disabled) Alpha = 0.3f; } } private Bindable bindable; private IEnumerable> items; public IEnumerable> Items { get { return items; } set { items = value; if (dropdown != null) dropdown.Items = value; } } public OptionDropDown() { Items = new KeyValuePair[0]; Direction = FillDirection.Vertical; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Children = new Drawable[] { text = new OsuSpriteText { Alpha = 0, }, dropdown = new OsuDropDown { Margin = new MarginPadding { Top = 5 }, RelativeSizeAxes = Axes.X, Items = Items, } }; } } }