You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,116 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HotSpotCollection.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using System.Web.UI;
|
||||
|
||||
namespace System.Web.UI.WebControls {
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Collection of HotSpots.</para>
|
||||
/// </devdoc>
|
||||
[
|
||||
Editor("System.Web.UI.Design.WebControls.HotSpotCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
|
||||
]
|
||||
|
||||
public sealed class HotSpotCollection : StateManagedCollection {
|
||||
private static readonly Type[] knownTypes = new Type[] {
|
||||
typeof(CircleHotSpot),
|
||||
typeof(RectangleHotSpot),
|
||||
typeof(PolygonHotSpot),
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Returns the HotSpot at a given index.</para>
|
||||
/// </devdoc>
|
||||
public HotSpot this[int index] {
|
||||
get {
|
||||
return (HotSpot)((IList)this)[index];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Adds a HotSpot to the collection.</para>
|
||||
/// </devdoc>
|
||||
public int Add(HotSpot spot) {
|
||||
return ((IList)this).Add(spot);
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Creates a known type of HotSpot.</para>
|
||||
/// </devdoc>
|
||||
protected override object CreateKnownType(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return new CircleHotSpot();
|
||||
case 1:
|
||||
return new RectangleHotSpot();
|
||||
case 2:
|
||||
return new PolygonHotSpot();
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(SR.GetString(SR.HotSpotCollection_InvalidTypeIndex));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Returns an ArrayList of known HotSpot types.</para>
|
||||
/// </devdoc>
|
||||
protected override Type[] GetKnownTypes() {
|
||||
return knownTypes;
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Inserts a HotSpot into the collection.</para>
|
||||
/// </devdoc>
|
||||
public void Insert(int index, HotSpot spot) {
|
||||
((IList)this).Insert(index, spot);
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Validates that an object is a HotSpot.</para>
|
||||
/// </devdoc>
|
||||
protected override void OnValidate(object o) {
|
||||
base.OnValidate(o);
|
||||
if (!(o is HotSpot))
|
||||
throw new ArgumentException(SR.GetString(SR.HotSpotCollection_InvalidType));
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Removes a HotSpot from the collection.</para>
|
||||
/// </devdoc>
|
||||
public void Remove(HotSpot spot) {
|
||||
((IList)this).Remove(spot);
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Removes a HotSpot from the collection at a given index.</para>
|
||||
/// </devdoc>
|
||||
public void RemoveAt(int index) {
|
||||
((IList)this).RemoveAt(index);
|
||||
}
|
||||
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>Marks a HotSpot as dirty so that it will record its entire state into view state.</para>
|
||||
/// </devdoc>
|
||||
protected override void SetDirtyObject(object o) {
|
||||
((HotSpot)o).SetDirty();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user