osukey/osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs
2017-03-15 20:15:40 -04:00

53 lines
1.7 KiB
C#

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using OpenTK.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Graphics.UserInterface
{
public class OsuTabDropDownMenuItem<T> : DropDownMenuItem<T>
{
public OsuTabDropDownMenuItem(string text, T value) : base(text, value)
{
Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4 };
Foreground.Margin = new MarginPadding { Left = 7 };
Masking = true;
CornerRadius = 6;
Foreground.Add(new OsuSpriteText
{
Text = text,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = Color4.Black.Opacity(0f);
ForegroundColourHover = Color4.Black;
ForegroundColourSelected = Color4.Black;
if (typeof(T) == typeof(SortMode))
{
BackgroundColourHover = colours.GreenLight;
BackgroundColourSelected = colours.GreenLight;
}
else
{
BackgroundColourHover = colours.Blue;
BackgroundColourSelected = colours.Blue;
}
}
}
}