// 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.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using System; using System.Collections.Generic; namespace osu.Game.Graphics.Containers { public class OsuLinkFlowContainer : OsuLinkFlowContainer { public OsuLinkFlowContainer(Action defaultCreationParameters = null) : base(defaultCreationParameters) { } } public class OsuLinkFlowContainer : OsuTextFlowContainer where T : OsuSpriteLink, new() { public override bool HandleInput => true; public OsuLinkFlowContainer(Action defaultCreationParameters = null) : base(defaultCreationParameters) { } protected override SpriteText CreateSpriteText() => new T(); /// /// The colour for text (links override this). Will only be used for new text elements. /// public ColourInfo TextColour = Color4.White; public IEnumerable AddLink(string text, string url, Action creationParameters = null) { // TODO: Remove this and get word wrapping working text = text.Replace(' ', '_'); return AddText(text, link => { creationParameters?.Invoke(link); ((T)link).Url = url; }); } public new IEnumerable AddText(string text, Action creationParameters = null) { return base.AddText(text, sprite => { ((OsuSpriteLink)sprite).TextColour = TextColour; creationParameters?.Invoke(sprite); }); } } }