2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-11-06 17:28:22 +08:00
|
|
|
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
public class TimelineButton : CompositeDrawable
|
|
|
|
|
{
|
|
|
|
|
public Action Action;
|
|
|
|
|
public readonly BindableBool Enabled = new BindableBool(true);
|
|
|
|
|
|
2019-03-27 18:29:27 +08:00
|
|
|
|
public IconUsage Icon
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-02-28 12:58:19 +08:00
|
|
|
|
get => button.Icon;
|
|
|
|
|
set => button.Icon = value;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly IconButton button;
|
|
|
|
|
|
|
|
|
|
public TimelineButton()
|
|
|
|
|
{
|
2018-07-13 15:28:18 +08:00
|
|
|
|
InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() };
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
button.Enabled.BindTo(Enabled);
|
|
|
|
|
Width = button.ButtonSize.X;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
|
|
button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight);
|
|
|
|
|
}
|
2018-07-13 15:28:18 +08:00
|
|
|
|
|
|
|
|
|
private class TimelineIconButton : IconButton
|
|
|
|
|
{
|
|
|
|
|
public TimelineIconButton()
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
IconColour = OsuColour.Gray(0.35f);
|
|
|
|
|
IconHoverColour = Color4.White;
|
|
|
|
|
HoverColour = OsuColour.Gray(0.25f);
|
|
|
|
|
FlashColour = OsuColour.Gray(0.5f);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|