diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 23e7f8a74d..780ff7b833 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -36,9 +36,9 @@ namespace osu.Desktop.VisualTests.Tests filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.ItemChanged += (sender, mode) => + filter.SelectedItem.ValueChanged += (sender, args) => { - text.Text = "Currently Selected: " + mode.ToString(); + text.Text = "Currently Selected: " + filter.SelectedItem.ToString(); }; } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 6d17d79ca1..242a9a8f6a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface { protected override Dropdown CreateDropdown() => new OsuTabDropdown(); - protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; + protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); @@ -75,16 +75,6 @@ namespace osu.Game.Graphics.UserInterface } } - public new T Value - { - get { return base.Value; } - set - { - base.Value = value; - text.Text = (value as Enum)?.GetDescription(); - } - } - public override bool Active { get { return base.Active; } @@ -134,30 +124,31 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Blue; } - public OsuTabItem() + public OsuTabItem(T value) : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Children = new Drawable[] { - text = new OsuSpriteText - { - Margin = new MarginPadding { Top = 5, Bottom = 5 }, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - TextSize = 14, - Font = @"Exo2.0-Bold", // Font should only turn bold when active? - }, - box = new Box - { - RelativeSizeAxes = Axes.X, - Height = 1, - Alpha = 0, - Colour = Color4.White, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - } + text = new OsuSpriteText + { + Margin = new MarginPadding { Top = 5, Bottom = 5 }, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Text = (value as Enum)?.GetDescription(), + TextSize = 14, + Font = @"Exo2.0-Bold", // Font should only turn bold when active? + }, + box = new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Alpha = 0, + Colour = Color4.White, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + } }; } } diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 088346d91f..c9ea9e884e 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -61,10 +61,10 @@ namespace osu.Game.Screens.Select }, }; - tabs.ItemChanged += (sender, e) => invokeOnFilter(); + tabs.SelectedItem.ValueChanged += (sender, e) => invokeOnFilter(); modsCheckbox.Action += (sender, e) => invokeOnFilter(); - tabs.SelectedItem = BeatmapDetailTab.Global; + tabs.SelectedItem.Value = BeatmapDetailTab.Global; } }