osukey/osu.Game/Overlays/ControllableOverlayHeader.cs
2020-01-08 00:41:52 +03:00

43 lines
1.4 KiB
C#

// 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.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osuTK.Graphics;
namespace osu.Game.Overlays
{
/// <typeparam name="T">The type of item to be represented by tabs in <see cref="TabControl{T}"/>.</typeparam>
public abstract class ControllableOverlayHeader<T> : OverlayHeader
{
protected Color4 ControlBackgroundColour
{
set => controlBackground.Colour = value;
}
private readonly Box controlBackground;
protected ControllableOverlayHeader()
{
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 })
}
});
}
protected abstract TabControl<T> CreateTabControl();
}
}