osu/osu.Game/Overlays/Settings/SettingsDropdown.cs

38 lines
1.1 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-03-21 23:49:21 +00:00
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
2017-02-03 10:13:10 +00:00
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsDropdown<T> : SettingsItem<T>
{
private Dropdown<T> dropdown;
private IEnumerable<KeyValuePair<string, T>> items = new KeyValuePair<string, T>[] { };
public IEnumerable<KeyValuePair<string, T>> Items
{
get
{
return items;
}
set
{
items = value;
2017-03-21 23:49:21 +00:00
if (dropdown != null)
dropdown.Items = value;
}
}
protected override Drawable CreateControl() => dropdown = new OsuDropdown<T>
{
Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X,
Items = Items,
};
}
2016-12-02 11:35:55 +00:00
}