osu/osu.Game/Screens/Edit/EditorScreen.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

92 lines
2.4 KiB
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
2022-06-17 07:37:17 +00:00
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
2018-04-13 09:19:50 +00:00
2018-11-06 09:28:22 +00:00
namespace osu.Game.Screens.Edit
{
2018-03-14 06:18:21 +00:00
/// <summary>
2019-10-09 07:04:58 +00:00
/// TODO: eventually make this inherit Screen and add a local screen stack inside the Editor.
2018-03-14 06:18:21 +00:00
/// </summary>
public abstract class EditorScreen : VisibilityContainer
{
[Resolved]
protected EditorBeatmap EditorBeatmap { get; private set; }
2017-10-02 00:34:51 +00:00
protected override Container<Drawable> Content => content;
private readonly Container content;
2018-04-13 09:19:50 +00:00
public readonly EditorScreenMode Type;
protected EditorScreen(EditorScreenMode type)
{
Type = type;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
2018-04-13 09:19:50 +00:00
InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both };
}
2018-04-13 09:19:50 +00:00
protected override void PopIn() => this.FadeIn();
2018-04-13 09:19:50 +00:00
protected override void PopOut() => this.FadeOut();
#region Clipboard operations
public BindableBool CanCut { get; } = new BindableBool();
/// <summary>
/// Performs a "cut to clipboard" operation appropriate for the given screen.
/// </summary>
protected virtual void PerformCut()
{
}
public void Cut()
{
if (CanCut.Value)
PerformCut();
}
public BindableBool CanCopy { get; } = new BindableBool();
/// <summary>
/// Performs a "copy to clipboard" operation appropriate for the given screen.
/// </summary>
protected virtual void PerformCopy()
{
}
public virtual void Copy()
{
if (CanCopy.Value)
PerformCopy();
}
public BindableBool CanPaste { get; } = new BindableBool();
/// <summary>
/// Performs a "paste from clipboard" operation appropriate for the given screen.
/// </summary>
protected virtual void PerformPaste()
{
}
public virtual void Paste()
{
if (CanPaste.Value)
PerformPaste();
}
#endregion
}
}