1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 22:35:23 +08:00

Make OverlayHeader non-generic

This commit is contained in:
Andrei Zavatski 2019-12-31 18:12:03 +03:00
parent 3a71abe8ff
commit 19e7867aba
3 changed files with 15 additions and 11 deletions

View File

@ -1,10 +1,14 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public abstract class BreadcrumbControlOverlayHeader : OverlayHeader<OverlayHeaderBreadcrumbControl> public abstract class BreadcrumbControlOverlayHeader : OverlayHeader
{ {
protected override OverlayHeaderBreadcrumbControl CreateControl() => new OverlayHeaderBreadcrumbControl(); protected OverlayHeaderBreadcrumbControl TabControl;
protected override TabControl<string> CreateControl() => TabControl = new OverlayHeaderBreadcrumbControl();
} }
} }

View File

@ -11,12 +11,8 @@ using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
/// <typeparam name="TControl">A control for overlay.</typeparam> public abstract class OverlayHeader : Container
public abstract class OverlayHeader<TControl> : Container
where TControl : TabControl<string>
{ {
protected readonly TControl TabControl;
private readonly Box titleBackground; private readonly Box titleBackground;
private readonly Box controlBackground; private readonly Box controlBackground;
private readonly Container background; private readonly Container background;
@ -88,7 +84,7 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Gray, Colour = Color4.Gray,
}, },
TabControl = CreateControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }) CreateControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN })
} }
}, },
CreateContent() CreateContent()
@ -103,6 +99,6 @@ namespace osu.Game.Overlays
protected abstract ScreenTitle CreateTitle(); protected abstract ScreenTitle CreateTitle();
protected abstract TControl CreateControl(); protected abstract TabControl<string> CreateControl();
} }
} }

View File

@ -1,10 +1,14 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public abstract class TabControlOverlayHeader : OverlayHeader<OverlayHeaderTabControl> public abstract class TabControlOverlayHeader : OverlayHeader
{ {
protected override OverlayHeaderTabControl CreateControl() => new OverlayHeaderTabControl(); protected OverlayHeaderTabControl TabControl;
protected override TabControl<string> CreateControl() => TabControl = new OverlayHeaderTabControl();
} }
} }