Esempio n. 1
0
        protected DrawableCarouselItem(CarouselItem item)
        {
            Item = item;

            Height           = MAX_HEIGHT;
            RelativeSizeAxes = Axes.X;
            Alpha            = 0;
        }
Esempio n. 2
0
        public virtual void RemoveChild(CarouselItem i)
        {
            InternalChildren.Remove(i);

            // it's important we do the deselection after removing, so any further actions based on
            // State.ValueChanged make decisions post-removal.
            i.State.Value = CarouselItemState.Collapsed;
        }
        public override void RemoveChild(CarouselItem i)
        {
            base.RemoveChild(i);

            if (i != LastSelected)
            {
                updateSelectedIndex();
            }
        }
        protected virtual void PerformSelection()
        {
            CarouselItem nextToSelect =
                Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value) ??
                Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value);

            if (nextToSelect != null)
            {
                nextToSelect.State.Value = CarouselItemState.Selected;
            }
            else
            {
                updateSelected(null);
            }
        }
        protected override void ChildItemStateChanged(CarouselItem item, CarouselItemState value)
        {
            base.ChildItemStateChanged(item, value);

            switch (value)
            {
            case CarouselItemState.Selected:
                updateSelected(item);
                break;

            case CarouselItemState.NotSelected:
            case CarouselItemState.Collapsed:
                attemptSelection();
                break;
            }
        }
Esempio n. 6
0
        protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value)
        {
            // ensure we are the only item selected
            if (value == CarouselItemState.Selected)
            {
                foreach (CarouselItem b in InternalChildren)
                {
                    if (item == b)
                    {
                        continue;
                    }

                    b.State.Value = CarouselItemState.NotSelected;
                }

                State.Value = CarouselItemState.Selected;
            }
        }
Esempio n. 7
0
        public override int CompareTo(FilterCriteria criteria, CarouselItem other)
        {
            if (!(other is CarouselBeatmapSet otherSet))
            {
                return(base.CompareTo(criteria, other));
            }

            switch (criteria.Sort)
            {
            default:
            case SortMode.Artist:
                return(string.Compare(BeatmapSet.Metadata.Song.Author, otherSet.BeatmapSet.Metadata.Song.Author, StringComparison.InvariantCultureIgnoreCase));

            case SortMode.Title:
                return(string.Compare(BeatmapSet.Metadata.Song.Name, otherSet.BeatmapSet.Metadata.Song.Name, StringComparison.InvariantCultureIgnoreCase));

            case SortMode.Author:
                return(string.Compare(BeatmapSet.Metadata.Level.CreatorName, otherSet.BeatmapSet.Metadata.Level.CreatorName, StringComparison.InvariantCultureIgnoreCase));

            case SortMode.DateAdded:
                return(otherSet.BeatmapSet.DownloadedAt.CompareTo(BeatmapSet.DownloadedAt));
            }
        }
Esempio n. 8
0
 public virtual void AddChild(CarouselItem i)
 {
     i.State.ValueChanged += state => ChildItemStateChanged(i, state.NewValue);
     i.ChildID             = ++currentChildID;
     InternalChildren.Add(i);
 }
 public override void AddChild(CarouselItem i)
 {
     base.AddChild(i);
     attemptSelection();
 }
 private void updateSelected(CarouselItem newSelection)
 {
     LastSelected = newSelection;
     updateSelectedIndex();
 }
Esempio n. 11
0
 public virtual int CompareTo(FilterCriteria criteria, CarouselItem other) => ChildID.CompareTo(other.ChildID);