mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 02:22:55 +08:00
Expose a mode change event from EditorMenuBar
This commit is contained in:
parent
8ed23a60e9
commit
7b1ef53f36
@ -11,11 +11,19 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Menus
|
namespace osu.Game.Screens.Edit.Menus
|
||||||
{
|
{
|
||||||
public class EditorMenuBar : OsuMenu
|
public class EditorMenuBar : OsuMenu
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Invaoked when the selected mode has changed.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<EditorScreenMode> ModeChanged;
|
||||||
|
|
||||||
|
private readonly ScreenSelectionTabControl tabControl;
|
||||||
|
|
||||||
public EditorMenuBar()
|
public EditorMenuBar()
|
||||||
: base(Direction.Horizontal, true)
|
: base(Direction.Horizontal, true)
|
||||||
{
|
{
|
||||||
@ -26,13 +34,21 @@ namespace osu.Game.Screens.Edit.Menus
|
|||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new ScreenSelectionTabControl
|
tabControl = new ScreenSelectionTabControl
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
X = -15
|
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();
|
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
|
||||||
|
Loading…
Reference in New Issue
Block a user