2017-02-07 12:59:30 +08:00
|
|
|
|
// 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-22 07:49:21 +08:00
|
|
|
|
using System.Collections.Generic;
|
2016-12-02 05:36:04 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2017-02-03 18:13:10 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2016-12-02 05:36:04 +08:00
|
|
|
|
|
2017-05-15 09:55:29 +08:00
|
|
|
|
namespace osu.Game.Overlays.Settings
|
2016-12-02 05:36:04 +08:00
|
|
|
|
{
|
2017-05-15 09:55:29 +08:00
|
|
|
|
public class SettingsDropdown<T> : SettingsItem<T>
|
2016-12-02 05:36:04 +08:00
|
|
|
|
{
|
2017-05-04 22:07:24 +08:00
|
|
|
|
private Dropdown<T> dropdown;
|
2017-01-31 17:37:11 +08:00
|
|
|
|
|
2017-05-04 22:07:24 +08:00
|
|
|
|
private IEnumerable<KeyValuePair<string, T>> items = new KeyValuePair<string, T>[] { };
|
2017-02-06 08:21:26 +08:00
|
|
|
|
public IEnumerable<KeyValuePair<string, T>> Items
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
items = value;
|
2017-03-22 07:49:21 +08:00
|
|
|
|
if (dropdown != null)
|
2017-02-06 08:21:26 +08:00
|
|
|
|
dropdown.Items = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-04 22:07:24 +08:00
|
|
|
|
protected override Drawable CreateControl() => dropdown = new OsuDropdown<T>
|
2016-12-02 05:36:04 +08:00
|
|
|
|
{
|
2017-05-04 22:07:24 +08:00
|
|
|
|
Margin = new MarginPadding { Top = 5 },
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Items = Items,
|
|
|
|
|
};
|
2016-12-02 05:36:04 +08:00
|
|
|
|
}
|
2016-12-02 19:35:55 +08:00
|
|
|
|
}
|