RaUI/Source/ryControls/WeifenLuo.WinFormsUI/Docking/DockPaneCollection.cs

57 lines
1.4 KiB
C#
Raw Normal View History

using System.Collections.ObjectModel;
using System.Collections.Generic;
#pragma warning disable CS1591 // ȱ<>ٶԹ<D9B6><D4B9><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>Ա<EFBFBD><D4B1> XML ע<><D7A2>
namespace WeifenLuo.WinFormsUI.Docking
{
public class DockPaneCollection : ReadOnlyCollection<DockPane>
{
internal DockPaneCollection()
: base(new List<DockPane>())
{
}
internal int Add(DockPane pane)
{
if (Items.Contains(pane))
return Items.IndexOf(pane);
Items.Add(pane);
return Count - 1;
}
internal void AddAt(DockPane pane, int index)
{
if (index < 0 || index > Items.Count - 1)
return;
if (Contains(pane))
return;
Items.Insert(index, pane);
}
internal void Dispose()
{
if (PatchController.EnableNestedDisposalFix == true)
{
List<DockPane> collection = new List<DockPane>(Items);
foreach (var dockPane in collection)
{
dockPane.Close();
}
collection.Clear();
return;
}
for (int i=Count - 1; i>=0; i--)
this[i].Close();
}
internal void Remove(DockPane pane)
{
Items.Remove(pane);
}
}
}