Free cookie consent management tool by TermsFeed Policy Generator

source: tags/3.3.12/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Editors/ShapeMaterialCollectionEditor.cs @ 13398

Last change on this file since 13398 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 1.3 KB
Line 
1using System.Collections.Generic;
2using System.ComponentModel.Design;
3
4namespace Netron.Diagramming.Core {
5  /// <summary>
6  /// This editor is used to edit items from e.g. the <see cref="FolderMaterial"/> via the property grid. This is a generic editor so it
7  /// can be used to edit any collection of <see cref="IShapeMaterial"/> items.
8  /// </summary>
9  /// <typeparam name="T"></typeparam>
10  public class ShapeMaterialCollectionEditor<T> : CollectionEditor where T : IShapeMaterial {
11    /// <summary>
12    /// Initializes a new instance of the <see cref="T:ShapeMaterialCollectionEditor&lt;T&gt;"/> class.
13    /// </summary>
14    public ShapeMaterialCollectionEditor()
15      : base(typeof(List<T>)) { }
16
17    /// <summary>
18    /// Sets the items.
19    /// </summary>
20    /// <param name="editValue">The edit value.</param>
21    /// <param name="value">The value.</param>
22    /// <returns></returns>
23    protected override object SetItems(object editValue, object[] value) {
24      CollectionBase<IShapeMaterial> entries = editValue as CollectionBase<IShapeMaterial>;
25      entries.Clear();
26      for (int k = 0; k < value.Length; k++) {
27        entries.Add(value[k] as IShapeMaterial);
28      }
29      object retValue = base.SetItems(entries, value);
30      return retValue;
31    }
32  }
33}
Note: See TracBrowser for help on using the repository browser.