1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 02:53:22 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/GradientLineTabControl.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
2.2 KiB
C#
Raw Normal View History

// 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 partial 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 partial class GradientLine : GridContainer
{
public GradientLine()
{
RelativeSizeAxes = Axes.X;
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,
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,
Colour = ColourInfo.GradientHorizontal(Colour, Color4.Transparent)
2019-09-12 10:26:10 +08:00
},
}
};
}
}
}
}