Last change
on this file since 2768 was
2768,
checked in by mkommend, 14 years ago
|
added solution folders and sources for the netron library (ticket #867)
|
File size:
1.7 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 | using System.ComponentModel;
|
---|
5 | namespace Netron.Diagramming.Core
|
---|
6 | {
|
---|
7 | /// <summary>
|
---|
8 | /// Type descriptor provider for the <see cref="DiagramControlBase"/> class.
|
---|
9 | /// </summary>
|
---|
10 | class ControlProvider : TypeDescriptionProvider
|
---|
11 | {
|
---|
12 | #region Fields
|
---|
13 |
|
---|
14 | /// <summary>
|
---|
15 | /// control descriptor
|
---|
16 | /// </summary>
|
---|
17 | private static ControlDescriptor controlDescriptor;
|
---|
18 |
|
---|
19 |
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | #region Properties
|
---|
23 |
|
---|
24 |
|
---|
25 | #endregion
|
---|
26 |
|
---|
27 | #region Constructor
|
---|
28 | public ControlProvider()
|
---|
29 | {
|
---|
30 | controlDescriptor = new ControlDescriptor(this, typeof(DiagramControlBase));
|
---|
31 | }
|
---|
32 | #endregion
|
---|
33 |
|
---|
34 | #region Methods
|
---|
35 | /// <summary>
|
---|
36 | /// Gets a custom type descriptor for the given type and object.
|
---|
37 | /// </summary>
|
---|
38 | /// <param name="objectType">The type of object for which to retrieve the type descriptor.</param>
|
---|
39 | /// <param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor"></see>.</param>
|
---|
40 | /// <returns>
|
---|
41 | /// An <see cref="T:System.ComponentModel.ICustomTypeDescriptor"></see> that can provide metadata for the type.
|
---|
42 | /// </returns>
|
---|
43 | public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
|
---|
44 | {
|
---|
45 | if(typeof(DiagramControlBase).IsInstanceOfType(instance) )
|
---|
46 | {
|
---|
47 | return controlDescriptor;
|
---|
48 | }
|
---|
49 | else //if nothing found use the base descriptor
|
---|
50 | return base.GetTypeDescriptor(objectType, instance);
|
---|
51 |
|
---|
52 | }
|
---|
53 | #endregion
|
---|
54 |
|
---|
55 | }
|
---|
56 |
|
---|
57 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.