osu/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 02:26:10 +00:00
// See the LICENCE file in the repository root for full licence text.
2022-06-17 07:37:17 +00:00
#nullable disable
2019-09-12 02:26:10 +00: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 04:59:06 +00:00
public abstract partial class GradientLineTabControl<TModel> : PageTabControl<TModel>
2019-09-12 02:26:10 +00:00
{
protected Color4 LineColour
{
2019-09-12 14:17:57 +00:00
get => line.Colour;
set => line.Colour = value;
2019-09-12 02:26:10 +00:00
}
private readonly GradientLine line;
2019-09-13 04:59:06 +00:00
protected GradientLineTabControl()
2019-09-12 02:26:10 +00:00
{
RelativeSizeAxes = Axes.X;
AddInternal(line = new GradientLine
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
});
}
2019-09-13 04:59:06 +00:00
protected override Dropdown<TModel> CreateDropdown() => null;
2019-09-12 02:26:10 +00: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 02:26:10 +00:00
Content = new[]
{
new Drawable[]
{
2019-09-12 14:17:57 +00:00
new Box
2019-09-12 02:26:10 +00:00
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(Color4.Transparent, Colour)
2019-09-12 02:26:10 +00:00
},
2019-09-12 14:17:57 +00:00
new Box
2019-09-12 02:26:10 +00:00
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(Colour, Color4.Transparent)
2019-09-12 02:26:10 +00:00
},
}
};
}
}
}
}