osu/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs

39 lines
1.3 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-02-03 10:13:10 +00:00
2017-02-25 12:12:39 +00:00
using osu.Framework.Graphics.Transforms;
2017-02-03 10:13:10 +00:00
using osu.Framework.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
2017-02-03 10:13:10 +00:00
namespace osu.Game.Graphics.UserInterface
{
public class OsuDropDownMenu<U> : DropDownMenu<U>
{
protected override DropDownHeader CreateHeader() => new OsuDropDownHeader();
2017-02-03 10:13:10 +00:00
public OsuDropDownMenu()
{
2017-02-04 07:05:24 +00:00
ContentContainer.CornerRadius = 4;
ContentBackground.Colour = Color4.Black.Opacity(0.5f);
2017-02-03 10:13:10 +00:00
}
protected override void AnimateOpen()
{
ContentContainer.FadeIn(300, EasingTypes.OutQuint);
}
protected override void AnimateClose()
{
ContentContainer.FadeOut(300, EasingTypes.OutQuint);
}
protected override void UpdateContentHeight()
{
2017-03-07 01:59:19 +00:00
ContentContainer.ResizeTo(State == DropDownMenuState.Opened ? new Vector2(1, ContentHeight) : new Vector2(1, 0), 300, EasingTypes.OutQuint);
2017-02-03 10:13:10 +00:00
}
2017-03-14 13:39:57 +00:00
protected override DropDownMenuItem<U> CreateDropDownItem(string key, U value) => new OsuDropDownMenuItem<U>(key, value);
2017-02-03 10:13:10 +00:00
}
}