// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface { public class OsuDropdown : Dropdown { protected override DropdownHeader CreateHeader() => new OsuDropdownHeader { AccentColour = AccentColour }; protected override Menu CreateMenu() => new OsuMenu(); private Color4? accentColour; public virtual Color4 AccentColour { get { return accentColour.GetValueOrDefault(); } set { accentColour = value; if (Header != null) ((OsuDropdownHeader)Header).AccentColour = value; foreach (var item in MenuItems.OfType>()) item.AccentColour = value; } } [BackgroundDependencyLoader] private void load(OsuColour colours) { if (accentColour == null) AccentColour = colours.PinkDarker; } protected override DropdownMenuItem CreateMenuItem(string text, T value) => new OsuDropdownMenuItem(text, value) { AccentColour = AccentColour }; } }