A game framework written with osu! in mind.
at master 41 lines 1.9 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4namespace osu.Framework.Graphics.Cursor 5{ 6 /// <summary> 7 /// Implementing this interface allows the implementing <see cref="Drawable"/> to display a custom tooltip if it is the child of a <see cref="TooltipContainer"/>. 8 /// Keep in mind that tooltips can only be displayed by a <see cref="TooltipContainer"/> if the <see cref="Drawable"/> implementing <see cref="IHasCustomTooltip"/> has <see cref="Drawable.HandlePositionalInput"/> set to true. 9 /// </summary> 10 public interface IHasCustomTooltip : ITooltipContentProvider 11 { 12 /// <summary> 13 /// The custom tooltip that should be displayed. 14 /// </summary> 15 /// <remarks> 16 /// A tooltip may be reused between different drawables with different content if they share the same tooltip type. 17 /// Therefore it is recommended for all displayed content in the tooltip to be provided by <see cref="TooltipContent"/> instead. 18 /// </remarks> 19 /// <returns>The custom tooltip that should be displayed.</returns> 20 ITooltip GetCustomTooltip(); 21 22 /// <summary> 23 /// Tooltip text that shows when hovering the drawable. 24 /// </summary> 25 object TooltipContent { get; } 26 } 27 28 /// <inheritdoc /> 29 public interface IHasCustomTooltip<TContent> : IHasCustomTooltip 30 { 31 ITooltip IHasCustomTooltip.GetCustomTooltip() => GetCustomTooltip(); 32 33 /// <inheritdoc cref="IHasCustomTooltip.GetCustomTooltip"/> 34 new ITooltip<TContent> GetCustomTooltip(); 35 36 object IHasCustomTooltip.TooltipContent => TooltipContent; 37 38 /// <inheritdoc cref="IHasCustomTooltip.TooltipContent"/> 39 new TContent TooltipContent { get; } 40 } 41}