// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; namespace osu.Game.Screens.Select.Carousel { public abstract class CarouselItem { public virtual float TotalHeight => 0; public readonly BindableBool Filtered = new BindableBool(); public readonly Bindable State = new Bindable(CarouselItemState.NotSelected); /// /// This item is not in a hidden state. /// public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered.Value; protected CarouselItem() { Filtered.ValueChanged += filtered => { if (filtered.NewValue && State.Value == CarouselItemState.Selected) State.Value = CarouselItemState.NotSelected; }; } /// /// Used as a default sort method for s of differing types. /// internal ulong ChildID; /// /// Create a fresh drawable version of this item. /// public abstract DrawableCarouselItem CreateDrawableRepresentation(); public virtual void Filter(FilterCriteria criteria) { } public virtual int CompareTo(FilterCriteria criteria, CarouselItem other) => ChildID.CompareTo(other.ChildID); } public enum CarouselItemState { Collapsed, NotSelected, Selected, } }