1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:43:20 +08:00

Expose a mode change event from EditorMenuBar

This commit is contained in:
smoogipoo 2017-10-02 09:24:25 +09:00
parent 8ed23a60e9
commit 7b1ef53f36

View File

@ -11,11 +11,19 @@ using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using System;
namespace osu.Game.Screens.Edit.Menus
{
public class EditorMenuBar : OsuMenu
{
/// <summary>
/// Invaoked when the selected mode has changed.
/// </summary>
public event Action<EditorScreenMode> ModeChanged;
private readonly ScreenSelectionTabControl tabControl;
public EditorMenuBar()
: base(Direction.Horizontal, true)
{
@ -26,13 +34,21 @@ namespace osu.Game.Screens.Edit.Menus
AddRangeInternal(new Drawable[]
{
new ScreenSelectionTabControl
tabControl = new ScreenSelectionTabControl
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
X = -15
}
});
tabControl.Current.ValueChanged += v => ModeChanged?.Invoke(v);
}
protected override void LoadComplete()
{
base.LoadComplete();
tabControl.Current.TriggerChange();
}
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();