Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas N <andreas@mono-cvs.ximian.com>2003-07-10 20:59:29 +0400
committerAndreas N <andreas@mono-cvs.ximian.com>2003-07-10 20:59:29 +0400
commita0081a1f49e5d5b4da4967fca3e0af6d564e84b4 (patch)
treea26c0ed5ef49cacbff2c8d755133bbf3f8edc54d /mcs/class/System/System.ComponentModel
parent3bc45899693a7d6379ee3ccf90349bb1b7b7baeb (diff)
2003-07-10 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* TypeConverter.cs: Implemented missing methods * TypeDescriptor.cs: Redirections added svn path=/trunk/mcs/; revision=16109
Diffstat (limited to 'mcs/class/System/System.ComponentModel')
-rw-r--r--mcs/class/System/System.ComponentModel/ChangeLog5
-rwxr-xr-xmcs/class/System/System.ComponentModel/TypeConverter.cs29
-rw-r--r--mcs/class/System/System.ComponentModel/TypeDescriptor.cs57
3 files changed, 57 insertions, 34 deletions
diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog
index 916a8108761..5c695f6b150 100644
--- a/mcs/class/System/System.ComponentModel/ChangeLog
+++ b/mcs/class/System/System.ComponentModel/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-10 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * TypeConverter.cs: Implemented missing methods
+ * TypeDescriptor.cs: Redirections added
+
2003-07-05 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* EnumConverter.cs: Fixed signature
diff --git a/mcs/class/System/System.ComponentModel/TypeConverter.cs b/mcs/class/System/System.ComponentModel/TypeConverter.cs
index 2df285fa0fb..fd91454d1b1 100755
--- a/mcs/class/System/System.ComponentModel/TypeConverter.cs
+++ b/mcs/class/System/System.ComponentModel/TypeConverter.cs
@@ -219,6 +219,12 @@ namespace System.ComponentModel
return true;
}
+ protected PropertyDescriptorCollection SortProperties (PropertyDescriptorCollection props, string[] names)
+ {
+ props.Sort (names);
+ return props;
+ }
+
public class StandardValuesCollection : ICollection, IEnumerable
{
private ICollection values;
@@ -291,6 +297,29 @@ namespace System.ComponentModel
public override bool IsReadOnly {
get { return Attributes.Contains (ReadOnlyAttribute.Yes); }
}
+
+ public override bool ShouldSerializeValue (object component)
+ {
+ return false;
+ }
+
+ public override bool CanResetValue (object component)
+ {
+ DefaultValueAttribute Attrib = ((DefaultValueAttribute) Attributes[typeof (DefaultValueAttribute)]);
+ if (Attrib == null) {
+ return false;
+ }
+ return (Attrib.Value == GetValue (component));
+ }
+
+ public override void ResetValue (object component)
+ {
+ DefaultValueAttribute Attrib = ((DefaultValueAttribute) Attributes[typeof (DefaultValueAttribute)]);
+ if (Attrib != null) {
+ SetValue (component, Attrib.Value);
+ }
+
+ }
}
}
}
diff --git a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
index ae9ec11a2a0..807a0fa22b4 100644
--- a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
+++ b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
@@ -290,22 +290,19 @@ public sealed class TypeDescriptor
throw new NotImplementedException ();
}
- [MonoTODO]
public static EventDescriptorCollection GetEvents (object component)
{
- throw new NotImplementedException ();
+ return GetEvents (component, false);
}
- [MonoTODO]
public static EventDescriptorCollection GetEvents (Type componentType)
{
- throw new NotImplementedException ();
+ return GetEvents (componentType, null);
}
- [MonoTODO]
public static EventDescriptorCollection GetEvents (object component, Attribute [] attributes)
{
- throw new NotImplementedException ();
+ return GetEvents (component, attributes, false);
}
[MonoTODO]
@@ -335,34 +332,21 @@ public sealed class TypeDescriptor
public static PropertyDescriptorCollection GetProperties (Type componentType)
{
- PropertyInfo [] props = componentType.GetProperties ();
- DerivedPropertyDescriptor [] propsDescriptor = new DerivedPropertyDescriptor [props.Length];
- int i = 0;
- foreach (PropertyInfo prop in props) {
- DerivedPropertyDescriptor propDescriptor = new DerivedPropertyDescriptor (prop.Name,
- null, 0);
- propDescriptor.SetReadOnly (!prop.CanWrite);
- propDescriptor.SetComponentType (componentType);
- propDescriptor.SetPropertyType (prop.PropertyType);
- propsDescriptor [i++] = propDescriptor;
- }
-
- return new PropertyDescriptorCollection (propsDescriptor);
+ return GetProperties (componentType, null);
}
- [MonoTODO]
public static PropertyDescriptorCollection GetProperties (object component, Attribute [] attributes)
{
- Type type = component.GetType ();
- if (typeof (ICustomTypeDescriptor).IsAssignableFrom (type))
- return ((ICustomTypeDescriptor) component).GetProperties (attributes);
-
- throw new NotImplementedException ();
+ return GetProperties (component, attributes, false);
}
[MonoTODO]
public static PropertyDescriptorCollection GetProperties (object component, Attribute [] attributes, bool noCustomTypeDesc)
{
+ Type type = component.GetType ();
+ if (typeof (ICustomTypeDescriptor).IsAssignableFrom (type))
+ return ((ICustomTypeDescriptor) component).GetProperties (attributes);
+
throw new NotImplementedException ();
}
@@ -380,15 +364,20 @@ public sealed class TypeDescriptor
public static PropertyDescriptorCollection GetProperties (Type componentType,
Attribute [] attributes)
{
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public static PropertyDescriptorCollection GetProperties (Type componentType,
- Attribute [] attributes,
- bool noCustomTypeDesc)
- {
- throw new NotImplementedException ();
+ PropertyInfo [] props = componentType.GetProperties ();
+ DerivedPropertyDescriptor [] propsDescriptor = new DerivedPropertyDescriptor [props.Length];
+ int i = 0;
+ foreach (PropertyInfo prop in props)
+ {
+ DerivedPropertyDescriptor propDescriptor = new DerivedPropertyDescriptor (prop.Name,
+ null, 0);
+ propDescriptor.SetReadOnly (!prop.CanWrite);
+ propDescriptor.SetComponentType (componentType);
+ propDescriptor.SetPropertyType (prop.PropertyType);
+ propsDescriptor [i++] = propDescriptor;
+ }
+
+ return new PropertyDescriptorCollection (propsDescriptor);
}
[MonoTODO]