mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-15 03:20:30 +00:00
36 lines
833 B
C#
36 lines
833 B
C#
// 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.
|
|
|
|
#nullable disable
|
|
|
|
using System;
|
|
using osu.Framework.Bindables;
|
|
using osu.Framework.Input.Events;
|
|
|
|
namespace osu.Framework.Graphics.Containers
|
|
{
|
|
public partial class ClickableContainer : Container
|
|
{
|
|
private Action action;
|
|
|
|
public Action Action
|
|
{
|
|
get => action;
|
|
set
|
|
{
|
|
action = value;
|
|
Enabled.Value = action != null;
|
|
}
|
|
}
|
|
|
|
public readonly BindableBool Enabled = new BindableBool();
|
|
|
|
protected override bool OnClick(ClickEvent e)
|
|
{
|
|
if (Enabled.Value)
|
|
Action?.Invoke();
|
|
return true;
|
|
}
|
|
}
|
|
}
|