using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using FastReport.Utils;
namespace FastReport
{
///
/// Holds the list of objects of type.
///
public class ReportComponentCollection : FRCollectionBase
{
///
/// Gets or sets the element at the specified index.
///
/// Index of an element.
/// The element at the specified index.
public ReportComponentBase this[int index]
{
get { return List[index] as ReportComponentBase; }
set { List[index] = value; }
}
internal ReportComponentCollection SortByTop()
{
ReportComponentCollection result = new ReportComponentCollection();
CopyTo(result);
result.InnerList.Sort(new TopComparer());
return result;
}
///
/// Initializes a new instance of the class with default settings.
///
public ReportComponentCollection() : this(null)
{
}
///
/// Initializes a new instance of the class with specified owner.
///
public ReportComponentCollection(Base owner) : base(owner)
{
}
private class TopComparer : IComparer
{
public int Compare(object x, object y)
{
return (x as ReportComponentBase).Top.CompareTo((y as ReportComponentBase).Top);
}
}
}
}