using System;
using System.Collections.Generic;
using Avalonia.Controls.Templates;
namespace Avalonia.Controls.Generators
{
///
/// Creates containers for items and maintains a list of created containers.
///
public interface IItemContainerGenerator
{
///
/// Gets the currently realized containers.
///
IEnumerable Containers { get; }
///
/// Gets or sets the data template used to display the items in the control.
///
IDataTemplate? ItemTemplate { get; set; }
///
/// Gets the ContainerType, or null if its an untyped ContainerGenerator.
///
Type? ContainerType { get; }
///
/// Signaled whenever new containers are materialized.
///
event EventHandler? Materialized;
///
/// Event raised whenever containers are dematerialized.
///
event EventHandler? Dematerialized;
///
/// Event raised whenever containers are recycled.
///
event EventHandler? Recycled;
///
/// Creates a container control for an item.
///
///
/// The index of the item of data in the control's items.
///
/// The item.
/// The created controls.
ItemContainerInfo Materialize(int index, object item);
///
/// Removes a set of created containers.
///
///
/// The index of the first item in the control's items.
///
/// The the number of items to remove.
/// The removed containers.
IEnumerable Dematerialize(int startingIndex, int count);
///
/// Inserts space for newly inserted containers in the index.
///
/// The index at which space should be inserted.
/// The number of blank spaces to create.
void InsertSpace(int index, int count);
///
/// Removes a set of created containers and updates the index of later containers to fill
/// the gap.
///
///
/// The index of the first item in the control's items.
///
/// The the number of items to remove.
/// The removed containers.
IEnumerable RemoveRange(int startingIndex, int count);
bool TryRecycle(int oldIndex, int newIndex, object item);
///
/// Clears all created containers and returns the removed controls.
///
/// The removed controls.
IEnumerable Clear();
///
/// Gets the container control representing the item with the specified index.
///
/// The index.
/// The container, or null if no container created.
IControl? ContainerFromIndex(int index);
///
/// Gets the index of the specified container control.
///
/// The container.
/// The index of the container, or -1 if not found.
int IndexFromContainer(IControl container);
}
}