A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
2.6 KiB

// -----------------------------------------------------------------------
// <copyright file="IItemContainerGenerator.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Controls.Generators
{
using System;
using System.Collections;
using System.Collections.Generic;
using Templates;
/// <summary>
/// Creates containers for items and maintains a list of created containers.
/// </summary>
public interface IItemContainerGenerator
{
/// <summary>
/// Signalled whenever new containers are initialized.
/// </summary>
IObservable<ItemContainers> ContainersInitialized { get; }
/// <summary>
/// Creates container controls for a collection of items.
/// </summary>
/// <param name="startingIndex">
/// The index of the first item of the data in the containing collection.
/// </param>
/// <param name="items">The items.</param>
/// <param name="itemTemplate">An optional item template.</param>
/// <returns>The created controls.</returns>
IList<IControl> CreateContainers(
int startingIndex,
IEnumerable items,
IDataTemplate itemTemplate);
/// <summary>
/// Removes a set of created containers from the index and returns the removed controls.
/// </summary>
/// <param name="startingIndex">
/// The index of the first item of the data in the containing collection.
/// </param>
/// <param name="items">The items.</param>
/// <returns>The removed controls.</returns>
IList<IControl> RemoveContainers(int startingIndex, IEnumerable items);
/// <summary>
/// Clears the created containers from the index and returns the removed controls.
/// </summary>
/// <returns>The removed controls.</returns>
IList<IControl> ClearContainers();
/// <summary>
/// Gets the container control representing the item with the specified index.
/// </summary>
/// <param name="index">The index.</param>
/// <returns>The container, or null if no container created.</returns>
IControl ContainerFromIndex(int index);
/// <summary>
/// Gets the index of the specified container control.
/// </summary>
/// <param name="container">The container.</param>
/// <returns>The index of the container, or -1 if not found.</returns>
int IndexFromContainer(IControl container);
}
}