2019-12-28 01:57:41 +00: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-03-26 14:44:53 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2020-01-03 06:01:42 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
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.UserInterface;
|
2019-12-31 15:12:03 +00:00
|
|
|
|
|
2019-12-28 01:57:41 +00:00
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
2020-01-21 03:00:12 +00:00
|
|
|
|
public abstract class BreadcrumbControlOverlayHeader : TabControlOverlayHeader<string>
|
2019-12-28 01:57:41 +00:00
|
|
|
|
{
|
2020-01-21 03:00:12 +00:00
|
|
|
|
protected override OsuTabControl<string> CreateTabControl() => new OverlayHeaderBreadcrumbControl();
|
2020-01-03 06:01:42 +00:00
|
|
|
|
|
|
|
|
|
public class OverlayHeaderBreadcrumbControl : BreadcrumbControl<string>
|
|
|
|
|
{
|
|
|
|
|
public OverlayHeaderBreadcrumbControl()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2020-03-26 14:44:53 +00:00
|
|
|
|
Height = 47;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
|
{
|
|
|
|
|
AccentColour = colourProvider.Light2;
|
2020-01-03 06:01:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override TabItem<string> CreateTabItem(string value) => new ControlTabItem(value);
|
|
|
|
|
|
|
|
|
|
private class ControlTabItem : BreadcrumbTabItem
|
|
|
|
|
{
|
|
|
|
|
protected override float ChevronSize => 8;
|
|
|
|
|
|
|
|
|
|
public ControlTabItem(string value)
|
|
|
|
|
: base(value)
|
|
|
|
|
{
|
2020-03-26 14:44:53 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Y;
|
2020-01-03 06:01:42 +00:00
|
|
|
|
Text.Font = Text.Font.With(size: 14);
|
2020-03-26 14:44:53 +00:00
|
|
|
|
Text.Anchor = Anchor.CentreLeft;
|
|
|
|
|
Text.Origin = Anchor.CentreLeft;
|
|
|
|
|
Chevron.Y = 1;
|
2020-01-03 06:01:42 +00:00
|
|
|
|
Bar.Height = 0;
|
|
|
|
|
}
|
2020-03-26 14:44:53 +00:00
|
|
|
|
|
|
|
|
|
// base OsuTabItem makes font bold on activation, we don't want that here
|
|
|
|
|
protected override void OnActivated() => FadeHovered();
|
|
|
|
|
|
|
|
|
|
protected override void OnDeactivated() => FadeUnhovered();
|
2020-01-03 06:01:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-28 01:57:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|