2020-01-04 04:22:19 +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.
|
|
|
|
|
|
2020-01-20 13:52:03 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2020-01-04 04:22:19 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2020-01-20 13:52:03 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2020-01-04 04:22:19 +08:00
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
2020-01-20 17:26:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="OverlayHeader"/> which contains <see cref="TabControl{T}"/>.
|
|
|
|
|
/// </summary>
|
2020-01-08 05:41:52 +08:00
|
|
|
|
/// <typeparam name="T">The type of item to be represented by tabs in <see cref="TabControl{T}"/>.</typeparam>
|
|
|
|
|
public abstract class ControllableOverlayHeader<T> : OverlayHeader
|
2020-01-04 04:22:19 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly Box controlBackground;
|
|
|
|
|
|
2020-01-20 13:52:03 +08:00
|
|
|
|
protected ControllableOverlayHeader(OverlayColourScheme colourScheme)
|
|
|
|
|
: base(colourScheme)
|
2020-01-04 04:22:19 +08:00
|
|
|
|
{
|
|
|
|
|
HeaderInfo.Add(new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
controlBackground = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Gray,
|
|
|
|
|
},
|
|
|
|
|
CreateTabControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN })
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-20 13:52:03 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
controlBackground.Colour = colours.ForOverlayElement(ColourScheme, 0.2f, 0.2f);
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-08 05:41:52 +08:00
|
|
|
|
protected abstract TabControl<T> CreateTabControl();
|
2020-01-04 04:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|