mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Create IHasOsuContextMenu and update OsuContextMenuContainer in line with framework.
This commit is contained in:
parent
7467d24d35
commit
4fb9570618
@ -3,9 +3,8 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@ -67,9 +66,9 @@ namespace osu.Desktop.Tests.Visual
|
||||
);
|
||||
}
|
||||
|
||||
private class MyContextMenuContainer : Container, IHasContextMenu
|
||||
private class MyContextMenuContainer : Container, IHasOsuContextMenu
|
||||
{
|
||||
public ContextMenuItem[] ContextMenuItems => new ContextMenuItem[]
|
||||
public OsuContextMenuItem[] ContextMenuItems => new[]
|
||||
{
|
||||
new OsuContextMenuItem(@"Some option"),
|
||||
new OsuContextMenuItem(@"Highlighted option", MenuItemType.Highlighted),
|
||||
@ -81,16 +80,16 @@ namespace osu.Desktop.Tests.Visual
|
||||
};
|
||||
}
|
||||
|
||||
private class AnotherContextMenuContainer : Container, IHasContextMenu
|
||||
private class AnotherContextMenuContainer : Container, IHasOsuContextMenu
|
||||
{
|
||||
public ContextMenuItem[] ContextMenuItems => new ContextMenuItem[]
|
||||
public OsuContextMenuItem[] ContextMenuItems => new[]
|
||||
{
|
||||
new OsuContextMenuItem(@"Simple option"),
|
||||
new OsuContextMenuItem(@"Simple very very long option"),
|
||||
new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => this.ResizeWidthTo(Width * 2, 100, Easing.OutQuint) },
|
||||
new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => this.ResizeHeightTo(Height * 2, 100, Easing.OutQuint) },
|
||||
new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => this.ResizeWidthTo(Width / 2, 100, Easing.OutQuint) },
|
||||
new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => this.ResizeHeightTo(Height / 2, 100, Easing.OutQuint) },
|
||||
new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted, () => this.ResizeWidthTo(Width * 2, 100, Easing.OutQuint)),
|
||||
new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted, () => this.ResizeHeightTo(Height * 2, 100, Easing.OutQuint)),
|
||||
new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive, () => this.ResizeWidthTo(Width / 2, 100, Easing.OutQuint)),
|
||||
new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive, () => this.ResizeHeightTo(Height / 2, 100, Easing.OutQuint)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
9
osu.Game/Graphics/Cursor/IHasOsuContextMenu.cs
Normal file
9
osu.Game/Graphics/Cursor/IHasOsuContextMenu.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
public interface IHasOsuContextMenu : IHasContextMenu<OsuContextMenuItem>
|
||||
{
|
||||
}
|
||||
}
|
@ -7,8 +7,8 @@ using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
public class OsuContextMenuContainer : ContextMenuContainer
|
||||
public class OsuContextMenuContainer : ContextMenuContainer<OsuContextMenuItem>
|
||||
{
|
||||
protected override ContextMenu<ContextMenuItem> CreateContextMenu() => new OsuContextMenu<ContextMenuItem>();
|
||||
protected override Menu<OsuContextMenuItem> CreateMenu() => new OsuContextMenu<OsuContextMenuItem>();
|
||||
}
|
||||
}
|
@ -84,6 +84,7 @@
|
||||
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
||||
<Compile Include="Graphics\Cursor\IHasOsuContextMenu.cs" />
|
||||
<Compile Include="Graphics\Cursor\OsuContextMenuContainer.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuTextFlowContainer.cs" />
|
||||
<Compile Include="Graphics\UserInterface\IconButton.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user