2022-07-24 03:20:27 +08: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.Graphics.Sprites;
|
|
|
|
using osu.Game.Localisation;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Dialog
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Base class for various confirmation dialogs that concern deletion actions.
|
|
|
|
/// Differs from <see cref="ConfirmDialog"/> in that the confirmation button is a "dangerous" one
|
|
|
|
/// (requires the confirm button to be held).
|
|
|
|
/// </summary>
|
2023-02-28 04:57:59 +08:00
|
|
|
public abstract partial class DangerousActionDialog : PopupDialog
|
2022-07-24 03:20:27 +08:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The action which performs the deletion.
|
|
|
|
/// </summary>
|
2023-03-06 03:57:26 +08:00
|
|
|
protected Action? DangerousAction { get; set; }
|
2022-07-24 03:20:27 +08:00
|
|
|
|
2023-02-28 04:57:59 +08:00
|
|
|
protected DangerousActionDialog()
|
2022-07-24 03:20:27 +08:00
|
|
|
{
|
|
|
|
HeaderText = DeleteConfirmationDialogStrings.HeaderText;
|
|
|
|
|
|
|
|
Icon = FontAwesome.Regular.TrashAlt;
|
|
|
|
|
|
|
|
Buttons = new PopupDialogButton[]
|
|
|
|
{
|
|
|
|
new PopupDialogDangerousButton
|
|
|
|
{
|
|
|
|
Text = DeleteConfirmationDialogStrings.Confirm,
|
2023-03-06 03:57:26 +08:00
|
|
|
Action = () => DangerousAction?.Invoke()
|
2022-07-24 03:20:27 +08:00
|
|
|
},
|
|
|
|
new PopupDialogCancelButton
|
|
|
|
{
|
|
|
|
Text = DeleteConfirmationDialogStrings.Cancel
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|