mirror of
https://github.com/ppy/osu.git
synced 2024-12-21 10:32:55 +08:00
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
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 osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Cursor;
|
|
using osu.Framework.Localisation;
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
namespace osu.Game.Graphics.Containers
|
|
{
|
|
public class OsuClickableContainer : ClickableContainer, IHasTooltip
|
|
{
|
|
private readonly HoverSampleSet sampleSet;
|
|
|
|
private readonly Container content = new Container { RelativeSizeAxes = Axes.Both };
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
protected virtual HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
|
|
|
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Default)
|
|
{
|
|
this.sampleSet = sampleSet;
|
|
}
|
|
|
|
public virtual LocalisableString TooltipText { get; set; }
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
if (AutoSizeAxes != Axes.None)
|
|
{
|
|
content.RelativeSizeAxes = (Axes.Both & ~AutoSizeAxes);
|
|
content.AutoSizeAxes = AutoSizeAxes;
|
|
}
|
|
|
|
InternalChildren = new Drawable[]
|
|
{
|
|
content,
|
|
CreateHoverSounds(sampleSet)
|
|
};
|
|
}
|
|
}
|
|
}
|