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