1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-30 18:07:25 +08:00
osu-lazer/osu.Game/Rulesets/Edit/ExpandableButton.cs

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

37 lines
1.0 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.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Rulesets.Edit
{
internal class ExpandableButton : RoundedButton, IExpandable
{
public BindableBool Expanded { get; } = new BindableBool();
[Resolved(canBeNull: true)]
private IExpandingContainer? expandingContainer { get; set; }
protected override void LoadComplete()
{
base.LoadComplete();
expandingContainer?.Expanded.BindValueChanged(containerExpanded =>
{
Expanded.Value = containerExpanded.NewValue;
}, true);
Expanded.BindValueChanged(expanded =>
{
if (expanded.NewValue)
Show();
else
Hide();
}, true);
}
}
}