osu/osu.Game/Overlays/Comments/ShowChildrenButton.cs

35 lines
970 B
C#
Raw Normal View History

2019-10-09 08:07:56 +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 osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Framework.Bindables;
namespace osu.Game.Overlays.Comments
{
2019-10-14 21:32:21 +00:00
public abstract class ShowChildrenButton : OsuHoverContainer
2019-10-09 08:07:56 +00:00
{
public readonly BindableBool Expanded = new BindableBool(true);
2019-10-14 21:32:21 +00:00
protected ShowChildrenButton()
2019-10-09 08:07:56 +00:00
{
AutoSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
Expanded.BindValueChanged(OnExpandedChanged, true);
base.LoadComplete();
}
protected abstract void OnExpandedChanged(ValueChangedEvent<bool> expanded);
protected override bool OnClick(ClickEvent e)
{
Expanded.Value = !Expanded.Value;
2019-10-14 13:43:43 +00:00
return true;
2019-10-09 08:07:56 +00:00
}
}
}