osu/osu.Game/Overlays/TabControlOverlayHeader.cs

56 lines
1.8 KiB
C#
Raw Normal View History

// 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-03 06:01:42 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2019-12-31 15:12:03 +00:00
using osu.Framework.Graphics.UserInterface;
2020-01-03 06:01:42 +00:00
using osu.Game.Graphics;
using osuTK;
2019-12-31 15:12:03 +00:00
namespace osu.Game.Overlays
{
2019-12-31 15:12:03 +00:00
public abstract class TabControlOverlayHeader : OverlayHeader
{
2019-12-31 15:12:03 +00:00
protected OverlayHeaderTabControl TabControl;
2020-01-03 06:01:42 +00:00
protected override TabControl<string> CreateTabControl() => TabControl = new OverlayHeaderTabControl();
public class OverlayHeaderTabControl : OverlayTabControl<string>
{
public OverlayHeaderTabControl()
{
BarHeight = 1;
RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.X;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
Height = 35;
}
protected override TabItem<string> CreateTabItem(string value) => new OverlayHeaderTabItem(value)
{
AccentColour = AccentColour,
};
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
};
private class OverlayHeaderTabItem : OverlayTabItem
{
public OverlayHeaderTabItem(string value)
: base(value)
{
Text.Text = value;
Text.Font = OsuFont.GetFont(size: 14);
Bar.ExpandedSize = 5;
}
}
}
}
}