using System;
using System.Collections;
using DevComponents.UI.ContentManager;
namespace DevComponents.DotNetBar
{
///
/// Represents collection for BubbleBarTab objects.
///
public class BubbleBarTabCollection:CollectionBase
{
#region Private Variables
private BubbleBar m_Owner=null;
#endregion
#region Internal Implementation
public BubbleBarTabCollection(BubbleBar owner)
{
m_Owner=owner;
}
///
/// Adds new object to the collection.
///
/// Object to add.
/// Index of newly added object.
public int Add(BubbleBarTab tab)
{
return List.Add(tab);
}
///
/// Returns reference to the object in collection based on it's index.
///
public BubbleBarTab this[int index]
{
get {return (BubbleBarTab)(List[index]);}
set {List[index] = value;}
}
///
/// Inserts new object into the collection.
///
/// Position of the object.
/// Object to insert.
public void Insert(int index, BubbleBarTab value)
{
List.Insert(index, value);
}
///
/// Returns index of the object inside of the collection.
///
/// Reference to the object.
/// Index of the object.
public int IndexOf(BubbleBarTab value)
{
return List.IndexOf(value);
}
///
/// Returns whether collection contains specified object.
///
/// Object to look for.
/// true if object is part of the collection, otherwise false.
public bool Contains(BubbleBarTab value)
{
return List.Contains(value);
}
///
/// Removes specified object from the collection.
///
///
public void Remove(BubbleBarTab value)
{
List.Remove(value);
}
protected override void OnRemoveComplete(int index,object value)
{
base.OnRemoveComplete(index,value);
BubbleBarTab item=value as BubbleBarTab;
m_Owner.OnTabRemoved(item);
item.SetParent(null);
}
protected override void OnInsertComplete(int index,object value)
{
base.OnInsertComplete(index,value);
BubbleBarTab item=value as BubbleBarTab;
item.SetParent(m_Owner);
m_Owner.OnTabAdded(item);
}
///
/// Copies collection into the specified array.
///
/// Array to copy collection to.
/// Starting index.
public void CopyTo(BubbleBarTab[] array, int index)
{
List.CopyTo(array, index);
}
///
/// Copies contained items to the IBlock array.
///
/// Array to copy to.
internal void CopyTo(IBlock[] array)
{
List.CopyTo(array,0);
}
///
/// Copies contained items to the ISimpleTab array.
///
/// Array to copy to.
internal void CopyTo(ISimpleTab[] array)
{
List.CopyTo(array,0);
}
protected override void OnClear()
{
m_Owner.OnTabsCleared();
base.OnClear();
}
///
/// Returns next visible tab from the reference tab.
///
/// Reference tab.
/// Next visible tab or null if next visible tab cannot be determined.
internal BubbleBarTab GetNextVisibleTab(BubbleBarTab tabFrom)
{
int from=0;
if(tabFrom!=null)from=this.IndexOf(tabFrom)+1;
for(int i=from;i
/// Returns previous visible tab from the reference tab.
///
/// Reference tab.
/// Previous visible tab or null if Previous visible tab cannot be determined.
internal BubbleBarTab GetPreviousVisibleTab(BubbleBarTab tabFrom)
{
int from=0;
if(tabFrom!=null) from=this.IndexOf(tabFrom)-1;
for(int i=from;i>=0;i--)
{
if(this[i].Visible)
return this[i];
}
return null;
}
#endregion
}
}