2019-09-13 14:53:11 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-09-12 10:26:10 +08:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2019-09-12 10:26:10 +08:00
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osuTK;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterface
|
|
|
|
{
|
2019-09-13 12:59:06 +08:00
|
|
|
public abstract class GradientLineTabControl<TModel> : PageTabControl<TModel>
|
2019-09-12 10:26:10 +08:00
|
|
|
{
|
|
|
|
protected Color4 LineColour
|
|
|
|
{
|
2019-09-12 22:17:57 +08:00
|
|
|
get => line.Colour;
|
|
|
|
set => line.Colour = value;
|
2019-09-12 10:26:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private readonly GradientLine line;
|
|
|
|
|
2019-09-13 12:59:06 +08:00
|
|
|
protected GradientLineTabControl()
|
2019-09-12 10:26:10 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
|
|
|
AddInternal(line = new GradientLine
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-09-13 12:59:06 +08:00
|
|
|
protected override Dropdown<TModel> CreateDropdown() => null;
|
|
|
|
|
2019-09-12 10:26:10 +08:00
|
|
|
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
Spacing = new Vector2(20, 0),
|
|
|
|
};
|
|
|
|
|
|
|
|
private class GradientLine : GridContainer
|
|
|
|
{
|
|
|
|
public GradientLine()
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2020-02-05 00:09:18 +08:00
|
|
|
Size = new Vector2(0.8f, 1f);
|
2019-09-12 10:26:10 +08:00
|
|
|
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
2019-09-12 22:17:57 +08:00
|
|
|
new Box
|
2019-09-12 10:26:10 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-05 00:09:18 +08:00
|
|
|
Colour = ColourInfo.GradientHorizontal(Color4.Transparent, Colour)
|
2019-09-12 10:26:10 +08:00
|
|
|
},
|
2019-09-12 22:17:57 +08:00
|
|
|
new Box
|
2019-09-12 10:26:10 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-05 00:09:18 +08:00
|
|
|
Colour = ColourInfo.GradientHorizontal(Colour, Color4.Transparent)
|
2019-09-12 10:26:10 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|