// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays; using osu.Game.Screens.Edit; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace osu.Game.Graphics.Sprites { public class OsuLinkSpriteText : OsuSpriteText { private readonly OsuHoverContainer content; public override bool HandleInput => content.Action != null; protected override Container Content => content ?? (Container)this; protected override IEnumerable FlowingChildren => Children; private string url; public string Url { get { return url; } set { if (!string.IsNullOrEmpty(value)) { url = value; content.Action = OnLinkClicked; } } } public OsuLinkSpriteText() { AddInternal(content = new OsuHoverContainer { AutoSizeAxes = Axes.Both, }); } public ColourInfo TextColour { get { return Content.Colour; } set { Content.Colour = value; } } protected virtual void OnLinkClicked() => Process.Start(Url); } }