// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Graphics.Containers; namespace osu.Game.Screens.Ranking { /// /// A which tracks the size of a , to which the can be added or removed. /// public class ScorePanelTrackingContainer : CompositeDrawable { /// /// The that created this . /// public readonly ScorePanel Panel; internal ScorePanelTrackingContainer(ScorePanel panel) { Panel = panel; Attach(); } /// /// Detaches the from this , removing it as a child. /// This will continue tracking any size changes. /// /// If the is already detached. public void Detach() { if (InternalChildren.Count == 0) throw new InvalidOperationException("Score panel container is not attached."); RemoveInternal(Panel); } /// /// Attaches the to this , adding it as a child. /// /// If the is already attached. public void Attach() { if (InternalChildren.Count > 0) throw new InvalidOperationException("Score panel container is already attached."); AddInternal(Panel); } } }