1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 09:47:24 +08:00
osu-lazer/osu.Game/Overlays/Changelog/UpdateStreamBadgeArea.cs

56 lines
1.7 KiB
C#
Raw Normal View History

2019-05-22 18:51:16 +08: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.
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Online.API.Requests.Responses;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Changelog
{
public class UpdateStreamBadgeArea : TabControl<APIUpdateStream>
{
public UpdateStreamBadgeArea()
2019-05-22 18:51:16 +08:00
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
public void Populate(List<APIUpdateStream> streams)
{
2020-02-21 23:12:23 +08:00
foreach (var updateStream in streams)
2019-05-23 11:41:45 +08:00
AddItem(updateStream);
2019-05-22 18:51:16 +08:00
}
protected override bool OnHover(HoverEvent e)
{
2020-02-21 23:12:23 +08:00
foreach (var streamBadge in TabContainer.Children.OfType<UpdateStreamBadge>())
streamBadge.UserHoveringArea = true;
2019-05-22 18:51:16 +08:00
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
2020-02-21 23:12:23 +08:00
foreach (var streamBadge in TabContainer.Children.OfType<UpdateStreamBadge>())
streamBadge.UserHoveringArea = false;
2019-05-22 18:51:16 +08:00
base.OnHoverLost(e);
}
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
2019-05-22 18:51:16 +08:00
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
AllowMultiline = true,
};
2019-05-22 18:51:16 +08:00
protected override Dropdown<APIUpdateStream> CreateDropdown() => null;
protected override TabItem<APIUpdateStream> CreateTabItem(APIUpdateStream value) =>
new UpdateStreamBadge(value) { SelectedTab = { BindTarget = Current } };
2019-05-22 18:51:16 +08:00
}
}