OLD | NEW |
| (Empty) |
1 /// Copyright (c) Microsoft Corporation. All rights reserved. | |
2 | |
3 using System; | |
4 using System.Collections; | |
5 using System.ComponentModel; | |
6 using System.Runtime.InteropServices; | |
7 | |
8 namespace Microsoft.VisualStudio.Project | |
9 { | |
10 /// <summary> | |
11 /// Enables a managed object to expose properties and attributes for COM
objects. | |
12 /// </summary> | |
13 [ComVisible(true)] | |
14 public class LocalizableProperties : ICustomTypeDescriptor | |
15 { | |
16 #region ICustomTypeDescriptor | |
17 public virtual AttributeCollection GetAttributes() | |
18 { | |
19 AttributeCollection col = TypeDescriptor.GetAttributes(t
his, true); | |
20 return col; | |
21 } | |
22 | |
23 public virtual EventDescriptor GetDefaultEvent() | |
24 { | |
25 EventDescriptor ed = TypeDescriptor.GetDefaultEvent(this
, true); | |
26 return ed; | |
27 } | |
28 | |
29 public virtual PropertyDescriptor GetDefaultProperty() | |
30 { | |
31 PropertyDescriptor pd = TypeDescriptor.GetDefaultPropert
y(this, true); | |
32 return pd; | |
33 } | |
34 | |
35 public virtual object GetEditor(Type editorBaseType) | |
36 { | |
37 object o = TypeDescriptor.GetEditor(this, editorBaseType
, true); | |
38 return o; | |
39 } | |
40 | |
41 public virtual EventDescriptorCollection GetEvents() | |
42 { | |
43 EventDescriptorCollection edc = TypeDescriptor.GetEvents
(this, true); | |
44 return edc; | |
45 } | |
46 | |
47 public virtual EventDescriptorCollection GetEvents(System.Attrib
ute[] attributes) | |
48 { | |
49 EventDescriptorCollection edc = TypeDescriptor.GetEvents
(this, attributes, true); | |
50 return edc; | |
51 } | |
52 | |
53 public virtual object GetPropertyOwner(PropertyDescriptor pd) | |
54 { | |
55 return this; | |
56 } | |
57 | |
58 public virtual PropertyDescriptorCollection GetProperties() | |
59 { | |
60 PropertyDescriptorCollection pcol = GetProperties(null); | |
61 return pcol; | |
62 } | |
63 | |
64 public virtual PropertyDescriptorCollection GetProperties(System
.Attribute[] attributes) | |
65 { | |
66 ArrayList newList = new ArrayList(); | |
67 PropertyDescriptorCollection props = TypeDescriptor.GetP
roperties(this, attributes, true); | |
68 | |
69 for(int i = 0; i < props.Count; i++) | |
70 newList.Add(CreateDesignPropertyDescriptor(props
[i])); | |
71 | |
72 return new PropertyDescriptorCollection((PropertyDescrip
tor[])newList.ToArray(typeof(PropertyDescriptor))); ; | |
73 } | |
74 | |
75 public virtual DesignPropertyDescriptor CreateDesignPropertyDesc
riptor(PropertyDescriptor propertyDescriptor) | |
76 { | |
77 return new DesignPropertyDescriptor(propertyDescriptor); | |
78 } | |
79 | |
80 public virtual string GetComponentName() | |
81 { | |
82 string name = TypeDescriptor.GetComponentName(this, true
); | |
83 return name; | |
84 } | |
85 | |
86 public virtual TypeConverter GetConverter() | |
87 { | |
88 TypeConverter tc = TypeDescriptor.GetConverter(this, tru
e); | |
89 return tc; | |
90 } | |
91 | |
92 public virtual string GetClassName() | |
93 { | |
94 return this.GetType().FullName; | |
95 } | |
96 | |
97 #endregion ICustomTypeDescriptor | |
98 } | |
99 } | |
OLD | NEW |