1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 10:02:54 +08:00
osu-lazer/osu.Game/Overlays/BreadcrumbControlOverlayHeader.cs

60 lines
2.1 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-03-26 22:44:53 +08:00
using osu.Framework.Allocation;
2020-01-03 14:01:42 +08:00
using osu.Framework.Graphics;
2019-12-31 23:12:03 +08:00
using osu.Framework.Graphics.UserInterface;
2021-07-17 19:37:32 +08:00
using osu.Framework.Localisation;
2020-01-03 14:01:42 +08:00
using osu.Game.Graphics.UserInterface;
2019-12-31 23:12:03 +08:00
namespace osu.Game.Overlays
{
2022-11-24 13:32:20 +08:00
public abstract partial class BreadcrumbControlOverlayHeader : TabControlOverlayHeader<LocalisableString?>
{
2021-07-17 20:33:26 +08:00
protected override OsuTabControl<LocalisableString?> CreateTabControl() => new OverlayHeaderBreadcrumbControl();
2020-01-03 14:01:42 +08:00
2022-11-24 13:32:20 +08:00
public partial class OverlayHeaderBreadcrumbControl : BreadcrumbControl<LocalisableString?>
2020-01-03 14:01:42 +08:00
{
public OverlayHeaderBreadcrumbControl()
{
RelativeSizeAxes = Axes.X;
2020-03-26 22:44:53 +08:00
Height = 47;
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
AccentColour = colourProvider.Light2;
2020-01-03 14:01:42 +08:00
}
2021-07-17 20:33:26 +08:00
protected override TabItem<LocalisableString?> CreateTabItem(LocalisableString? value) => new ControlTabItem(value)
{
AccentColour = AccentColour,
};
2020-01-03 14:01:42 +08:00
2022-11-24 13:32:20 +08:00
private partial class ControlTabItem : BreadcrumbTabItem
2020-01-03 14:01:42 +08:00
{
protected override float ChevronSize => 8;
2021-07-17 20:33:26 +08:00
public ControlTabItem(LocalisableString? value)
2020-01-03 14:01:42 +08:00
: base(value)
{
2020-03-26 22:44:53 +08:00
RelativeSizeAxes = Axes.Y;
2020-01-03 14:01:42 +08:00
Text.Font = Text.Font.With(size: 14);
2020-03-26 22:44:53 +08:00
Text.Anchor = Anchor.CentreLeft;
Text.Origin = Anchor.CentreLeft;
Chevron.Y = 1;
2020-01-03 14:01:42 +08:00
Bar.Height = 0;
}
2020-03-26 22:44:53 +08: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 14:01:42 +08:00
}
}
}
}