osu/osu.Game/Overlays/Comments/CancellableCommentEditor.cs

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

49 lines
1.4 KiB
C#
Raw Normal View History

2020-02-11 17:47:51 +00:00
// 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.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2022-11-29 02:46:30 +00:00
using osu.Framework.Graphics.Sprites;
2020-02-11 17:47:51 +00:00
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
2022-11-29 02:46:30 +00:00
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Resources.Localisation.Web;
2020-02-11 17:47:51 +00:00
namespace osu.Game.Overlays.Comments
{
public abstract partial class CancellableCommentEditor : CommentEditor
{
2022-11-29 02:17:44 +00:00
public Action? OnCancel;
2020-02-11 17:47:51 +00:00
[BackgroundDependencyLoader]
private void load()
{
ButtonsContainer.Add(new CancelButton
{
2020-02-11 21:57:06 +00:00
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
2020-02-11 17:47:51 +00:00
Action = () => OnCancel?.Invoke()
});
}
2022-11-29 02:46:30 +00:00
private sealed partial class CancelButton : RoundedButton
2020-02-11 17:47:51 +00:00
{
public CancelButton()
{
2022-11-29 02:46:30 +00:00
Height = 25;
AutoSizeAxes = Axes.X;
2020-02-11 17:47:51 +00:00
}
2022-11-29 02:46:30 +00:00
protected override SpriteText CreateText() => new OsuSpriteText
2020-02-11 17:47:51 +00:00
{
2022-11-29 02:46:30 +00:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 },
Text = CommonStrings.ButtonsCancel
};
2020-02-11 17:47:51 +00:00
}
}
}