[Mono-devel-list] Please review and commit
A-Soft Technologies
A-Soft at A-SoftTech.com
Thu Jun 12 08:59:12 EDT 2003
Could someone review and commit these new classes/ implementations/ patches.
Actually this implements a great deal of the System.Componentmodel
Namespace, removing all those MonoTODOs ;) and NotImplementedExceptions
It also adds three new files to the System.Componentmodel Namespace, which
are attatched to this mail ( there is a diff for the list.unix included)
I hope all problems are already sorted out. But I only tried to compile
against MS, never Mono, so better try before commiting.
A.Nahr
Index: list.unix
===================================================================
RCS file: /mono/mcs/class/System/list.unix,v
retrieving revision 1.42
diff -u -r1.42 list.unix
--- list.unix 6 Jun 2003 16:15:21 -0000 1.42
+++ list.unix 12 Jun 2003 12:48:16 -0000
@@ -153,7 +153,9 @@
System.ComponentModel/EventDescriptor.cs
System.ComponentModel/EventHandlerList.cs
System.ComponentModel/ExpandableObjectConverter.cs
+System.ComponentModel/ExtenderProvidedPropertyAttribute.cs
System.ComponentModel/IBindingList.cs
+System.ComponentModel/IComNativeDescriptorHandler.cs
System.ComponentModel/IComponent.cs
System.ComponentModel/IContainer.cs
System.ComponentModel/ICustomTypeDescriptor.cs
@@ -230,6 +232,7 @@
System.ComponentModel/ReferenceConverter.cs
System.ComponentModel/SByteConverter.cs
System.ComponentModel/SingleConverter.cs
+System.ComponentModel/SyntaxCheck.cs
System.ComponentModel/TimeSpanConverter.cs
System.ComponentModel/ToolboxItemFilterAttribute.cs
System.ComponentModel/ToolboxItemFilterType.cs
Index: AmbientValueAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/AmbientValueAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 AmbientValueAttribute.cs
--- AmbientValueAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ AmbientValueAttribute.cs 12 Jun 2003 12:50:05 -0000
@@ -2,91 +2,102 @@
// System.ComponentModel.AmbientValueAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- [AttributeUsage(AttributeTargets.All)]
- public sealed class AmbientValueAttribute : Attribute
+ [AttributeUsage(AttributeTargets.All)]
+ public sealed class AmbientValueAttribute : Attribute
{
- [MonoTODO]
+
+ private object AmbientValue;
+
public AmbientValueAttribute (bool value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (byte value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (char value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (double value)
{
+ AmbientValue = value;
}
- [MonoTODO]
- public AmbientValueAttribute (short value)
+ public AmbientValueAttribute (short value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (int value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (long value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (object value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (float value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (string value)
{
+ AmbientValue = value;
}
- [MonoTODO]
public AmbientValueAttribute (Type type, string value)
{
+ // TODO check if this implementation is correct
+ try
+ {
+ AmbientValue = Convert.ChangeType (value, type);
+ }
+ catch
+ {
+ AmbientValue = null;
+ }
}
public object Value {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return AmbientValue; }
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is AmbientValueAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((AmbientValueAttribute) obj).Value == AmbientValue;
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~AmbientValueAttribute()
- {
+ if (AmbientValue == null)
+ return 0;
+ return AmbientValue.GetHashCode();
}
}
}
Index: ArrayConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/ArrayConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 ArrayConverter.cs
--- ArrayConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ArrayConverter.cs 12 Jun 2003 12:50:05 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.ArrayConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,35 +15,33 @@
{
public class ArrayConverter : CollectionConverter
{
- [MonoTODO]
+
public ArrayConverter()
{
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ if (value != null)
+ // TODO check if the check for Array is correct
+ if (value is Array)
+ return "(Array)";
+ return base.ConvertTo (context, culture, value,
destinationType);
}
public override PropertyDescriptorCollection GetProperties
(ITypeDescriptorContext context,
- object value,
- Attribute[] attributes)
+ object value, Attribute[] attributes)
{
- throw new NotImplementedException();
+ // LAMESPEC MS seems to always parse an
PropertyDescriptorCollection without any PropertyDescriptors
+ return PropertyDescriptorCollection.Empty;
}
public override bool GetPropertiesSupported (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
- ~ArrayConverter()
- {
- }
}
}
Index: BaseNumberConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 BaseNumberConverter.cs
--- BaseNumberConverter.cs 2 Nov 2002 20:29:17 -0000 1.1
+++ BaseNumberConverter.cs 12 Jun 2003 12:50:07 -0000
@@ -1,9 +1,70 @@
//
// System.ComponentModel.BaseNumberConverter.cs
//
+// Author:
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
+// (C) 2002/2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
+//
+
+using System.Globalization;
namespace System.ComponentModel {
- public class BaseNumberConverter : TypeConverter {
+ public abstract class BaseNumberConverter : TypeConverter {
+
+ protected Type InnerType;
+
+ protected BaseNumberConverter()
+ {
+ }
+
+ public override bool
CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context,
+ System.Type sourceType)
+ {
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override bool
CanConvertTo(System.ComponentModel.ITypeDescriptorContext context,
+ System.Type t)
+ {
+ if (t == typeof (string))
+ return true;
+ return base.CanConvertTo (context, t);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context,
+ CultureInfo culture, object value)
+ {
+ if (value.GetType() == typeof (string))
+ {
+ try
+ {
+ return Convert.ChangeType (value, InnerType,
culture.NumberFormat);
+ }
+ catch (Exception e)
+ {
+ // LAMESPEC MS just seems to pass the internal
Exception on to the user
+ // so it throws a pure Exception here. We should
probably throw a
+ // ArgumentException or something like that
+ throw e;
+ }
+ }
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context,
+ CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value.GetType() == InnerType)
+ {
+ return Convert.ChangeType (value, typeof (string),
culture.NumberFormat);
+ }
+ return base.ConvertTo (context, culture, value,
destinationType);
+ }
}
}
Index: BindableAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/BindableAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 BindableAttribute.cs
--- BindableAttribute.cs 23 Jul 2002 03:20:22 -0000 1.1
+++ BindableAttribute.cs 12 Jun 2003 12:50:07 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.BindableAttribute.cs
//
// Author:
-// Tim Coleman (tim at timcoleman.com)
+// Tim Coleman (tim at timcoleman.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// Copyright (C) Tim Coleman, 2002
+// (C) 2003 Andreas Nahr
//
//
@@ -14,8 +16,8 @@
#region Fields
- BindableSupport flags;
- bool bindable;
+ //BindableSupport flags;
+ private bool bindable;
#endregion // Fields
@@ -27,8 +29,13 @@
public BindableAttribute (BindableSupport flags)
{
- this.flags = flags;
- this.bindable = false;
+ //this.flags = flags;
+ if (flags == BindableSupport.No)
+ this.bindable = false;
+ if (flags == BindableSupport.Yes)
+ this.bindable = true;
+ if (flags == BindableSupport.Default)
+ this.bindable = true;
}
public BindableAttribute (bool bindable)
@@ -48,22 +55,23 @@
#region Methods
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException ();
+ if (!(obj is BindableAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((BindableAttribute) obj).Bindable.Equals (bindable);
}
- [MonoTODO]
public override int GetHashCode ()
{
- throw new NotImplementedException ();
+ return bindable.GetHashCode ();
}
- [MonoTODO]
public override bool IsDefaultAttribute ()
{
- throw new NotImplementedException ();
+ return Equals (Default);
}
#endregion // Methods
Index: BooleanConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/BooleanConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 BooleanConverter.cs
--- BooleanConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ BooleanConverter.cs 12 Jun 2003 12:50:07 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.BooleanConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,47 +15,49 @@
{
public class BooleanConverter : TypeConverter
{
- [MonoTODO]
+
public BooleanConverter()
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ if (value.GetType() == typeof (string))
+ {
+ string Test = ((String) value).ToLower (culture);
+ if (Test.Equals ("true"))
+ return true;
+ else if (Test.Equals ("false"))
+ return false;
+ else
+ throw new FormatException ("No valid boolean value");
+ }
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override StandardValuesCollection GetStandardValues
(ITypeDescriptorContext context)
{
- throw new NotImplementedException();
+ return new StandardValuesCollection (new string[2] {"True",
"False"} );
}
- [MonoTODO]
public override bool GetStandardValuesExclusive (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
public override bool GetStandardValuesSupported (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
- ~BooleanConverter()
- {
- }
}
}
Index: BrowsableAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs,v
retrieving revision 1.2
diff -u -r1.2 BrowsableAttribute.cs
--- BrowsableAttribute.cs 30 Jan 2003 00:57:31 -0000 1.2
+++ BrowsableAttribute.cs 12 Jun 2003 12:50:07 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.BrowsableAttribute.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
//
@@ -12,15 +14,14 @@
[AttributeUsage (AttributeTargets.All)]
public sealed class BrowsableAttribute : Attribute {
- bool browsable;
+ private bool browsable;
- public static readonly BrowsableAttribute No;
- public static readonly BrowsableAttribute Yes;
+ public static readonly BrowsableAttribute Default = new
BrowsableAttribute (true);
+ public static readonly BrowsableAttribute No = new BrowsableAttribute
(false);
+ public static readonly BrowsableAttribute Yes = new BrowsableAttribute
(true);
- static BrowsableAttribute ()
+ public BrowsableAttribute ()
{
- No = new BrowsableAttribute (false);
- Yes = new BrowsableAttribute (false);
}
public BrowsableAttribute (bool browsable)
@@ -33,6 +34,25 @@
return browsable;
}
}
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is BrowsableAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((BrowsableAttribute) obj).Browsable == browsable;
+ }
+
+ public override int GetHashCode ()
+ {
+ return browsable.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
}
}
Index: ByteConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/ByteConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 ByteConverter.cs
--- ByteConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ByteConverter.cs 12 Jun 2003 12:50:07 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.ByteConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class ByteConverter : BaseNumberConverter
+ public class ByteConverter : BaseNumberConverter
{
- [MonoTODO]
public ByteConverter()
{
- }
-
- [MonoTODO]
- ~ByteConverter()
- {
+ InnerType = typeof (Byte);
}
}
}
Index: CategoryAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/CategoryAttribute.cs,v
retrieving revision 1.3
diff -u -r1.3 CategoryAttribute.cs
--- CategoryAttribute.cs 28 Apr 2002 13:31:38 -0000 1.3
+++ CategoryAttribute.cs 12 Jun 2003 12:50:09 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.CategoryAttribute.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
//
@@ -12,216 +14,289 @@
[AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
public class CategoryAttribute : Attribute {
- string category;
- static CategoryAttribute action, appearance, behaviour, data, def;
- static CategoryAttribute design, drag_drop, focus, format, key;
- static CategoryAttribute layout, mouse, window_style;
-
- public CategoryAttribute (string category)
- {
- this.category = category;
- }
-
- public CategoryAttribute ()
- {
- this.category = "Misc";
- }
-
- [MonoTODO]
- protected virtual string GetLocalizedString (string value)
- {
- // FIXME: IMPLEMENT
-
- return category;
- }
-
- public string Category {
- get {
- return category;
- }
- }
-
- public static CategoryAttribute Action {
- get {
- if (action != null)
- return action;
-
- lock (typeof (CategoryAttribute)){
- if (action == null)
- action = new CategoryAttribute ("Action");
- }
-
- return action;
- }
- }
-
- public static CategoryAttribute Appearance {
- get {
- if (appearance != null)
- return appearance;
-
- lock (typeof (CategoryAttribute)){
- if (appearance == null)
- appearance = new CategoryAttribute ("Appearance");
- }
-
- return appearance;
- }
- }
-
- public static CategoryAttribute Behaviour {
- get {
- if (behaviour != null)
- return behaviour;
-
- lock (typeof (CategoryAttribute)){
- if (behaviour == null)
- behaviour = new CategoryAttribute ("Action");
- }
-
- return behaviour;
- }
- }
-
- public static CategoryAttribute Data {
- get {
- if (data != null)
- return data;
-
- lock (typeof (CategoryAttribute)){
- if (data == null)
- data = new CategoryAttribute ("Data");
- }
-
- return data;
- }
- }
-
- public static CategoryAttribute Default {
- get {
- if (def != null)
- return def;
-
- lock (typeof (CategoryAttribute)){
- if (def == null)
- def = new CategoryAttribute ("Default");
- }
-
- return def;
- }
- }
-
- public static CategoryAttribute Design {
- get {
- if (design != null)
- return design;
-
- lock (typeof (CategoryAttribute)){
- if (design == null)
- design = new CategoryAttribute ("Design");
- }
-
- return design;
- }
- }
-
- public static CategoryAttribute DragDrop {
- get {
- if (drag_drop != null)
- return drag_drop;
-
- lock (typeof (CategoryAttribute)){
- if (drag_drop == null)
- drag_drop = new CategoryAttribute ("Drag Drop");
- }
-
- return drag_drop;
- }
- }
-
- public static CategoryAttribute Focus {
- get {
- if (focus != null)
- return focus;
-
- lock (typeof (CategoryAttribute)){
- if (focus == null)
- focus = new CategoryAttribute ("Focus");
- }
-
- return focus;
- }
- }
-
- public static CategoryAttribute Format {
- get {
- if (format != null)
- return format;
-
- lock (typeof (CategoryAttribute)){
- if (format == null)
- format = new CategoryAttribute ("Format");
- }
-
- return format;
- }
- }
-
- public static CategoryAttribute Key {
- get {
- if (key != null)
- return key;
-
- lock (typeof (CategoryAttribute)){
- if (key == null)
- key = new CategoryAttribute ("Key");
- }
-
- return key;
- }
- }
-
- public static CategoryAttribute Layout {
- get {
- if (layout != null)
- return layout;
-
- lock (typeof (CategoryAttribute)){
- if (layout == null)
- layout = new CategoryAttribute ("Layout");
- }
-
- return layout;
- }
- }
-
- public static CategoryAttribute Mouse {
- get {
- if (mouse != null)
- return mouse;
-
- lock (typeof (CategoryAttribute)){
- if (mouse == null)
- mouse = new CategoryAttribute ("Mouse");
- }
-
- return mouse;
- }
- }
-
- public static CategoryAttribute WindowStyle {
- get {
- if (window_style != null)
- return window_style;
-
- lock (typeof (CategoryAttribute)){
- if (window_style == null)
- window_style = new CategoryAttribute ("Window Style");
- }
-
- return window_style;
- }
- }
+ private string category;
+ private bool IsLocalized = false;
+
+ public static readonly CategoryAttribute Default = new
CategoryAttribute ();
+ public static readonly CategoryAttribute Action = new
CategoryAttribute ("Action");
+ public static readonly CategoryAttribute Appearance = new
CategoryAttribute ("Appearance");
+ public static readonly CategoryAttribute Behavior = new
CategoryAttribute ("Behavior");
+ public static readonly CategoryAttribute Data = new
CategoryAttribute ("Data");
+ public static readonly CategoryAttribute Design = new
CategoryAttribute ("Design");
+ public static readonly CategoryAttribute DragDrop = new
CategoryAttribute ("Drag Drop");
+ public static readonly CategoryAttribute Focus = new
CategoryAttribute ("Focus");
+ public static readonly CategoryAttribute Format = new
CategoryAttribute ("Format");
+ public static readonly CategoryAttribute Key = new
CategoryAttribute ("Key");
+ public static readonly CategoryAttribute Layout = new
CategoryAttribute ("Layout");
+ public static readonly CategoryAttribute Mouse = new
CategoryAttribute ("Mouse");
+ public static readonly CategoryAttribute WindowStyle = new
CategoryAttribute ("Window Style");
+
+
+ public CategoryAttribute () : this ("Misc")
+ {
+ }
+
+
+ public CategoryAttribute (string category)
+ {
+ this.category = category;
+ }
+
+ protected virtual string GetLocalizedString (string value)
+ {
+ // FIXME: Check if other implementation exists
+ return null;
+ }
+
+ public string Category {
+ get {
+ if (IsLocalized == false)
+ {
+ IsLocalized = true;
+ string LocalizedString = GetLocalizedString (category);
+ if (LocalizedString != null)
+ category = LocalizedString;
+ }
+
+ return category;
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is CategoryAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((CategoryAttribute) obj).Category.Equals(category);
+ }
+
+ public override int GetHashCode ()
+ {
+ if (category == null)
+ return 0;
+ return category.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+
+// OLD IMPLEMENTATION - redid the implementation without storing any of the
static
+// members which require to do locks to keep in sync
+// Please check if this is needed (incase it is needed quite some classes
in this
+// namespace written by me would need patches!
+//
+// static CategoryAttribute action, appearance, behaviour, data, def;
+// static CategoryAttribute design, drag_drop, focus, format, key;
+// static CategoryAttribute layout, mouse, window_style;
+//
+// public CategoryAttribute (string category)
+// {
+// this.category = category;
+// }
+//
+// public CategoryAttribute ()
+// {
+// this.category = "Misc";
+// }
+//
+// [MonoTODO]
+// protected virtual string GetLocalizedString (string value)
+// {
+// // FIXME: IMPLEMENT
+//
+// return category;
+// }
+//
+// public string Category {
+// get {
+// return category;
+// }
+// }
+//
+// public static CategoryAttribute Action {
+// get {
+// if (action != null)
+// return action;
+//
+// lock (typeof (CategoryAttribute)){
+// if (action == null)
+// action = new CategoryAttribute ("Action");
+// }
+//
+// return action;
+// }
+// }
+//
+// public static CategoryAttribute Appearance {
+// get {
+// if (appearance != null)
+// return appearance;
+//
+// lock (typeof (CategoryAttribute)){
+// if (appearance == null)
+// appearance = new CategoryAttribute ("Appearance");
+// }
+//
+// return appearance;
+// }
+// }
+//
+// public static CategoryAttribute Behaviour {
+// get {
+// if (behaviour != null)
+// return behaviour;
+//
+// lock (typeof (CategoryAttribute)){
+// if (behaviour == null)
+// behaviour = new CategoryAttribute ("Action");
+// }
+//
+// return behaviour;
+// }
+// }
+//
+// public static CategoryAttribute Data {
+// get {
+// if (data != null)
+// return data;
+//
+// lock (typeof (CategoryAttribute)){
+// if (data == null)
+// data = new CategoryAttribute ("Data");
+// }
+//
+// return data;
+// }
+// }
+//
+// public static CategoryAttribute Default {
+// get {
+// if (def != null)
+// return def;
+//
+// lock (typeof (CategoryAttribute)){
+// if (def == null)
+// def = new CategoryAttribute ("Default");
+// }
+//
+// return def;
+// }
+// }
+//
+// public static CategoryAttribute Design {
+// get {
+// if (design != null)
+// return design;
+//
+// lock (typeof (CategoryAttribute)){
+// if (design == null)
+// design = new CategoryAttribute ("Design");
+// }
+//
+// return design;
+// }
+// }
+//
+// public static CategoryAttribute DragDrop {
+// get {
+// if (drag_drop != null)
+// return drag_drop;
+//
+// lock (typeof (CategoryAttribute)){
+// if (drag_drop == null)
+// drag_drop = new CategoryAttribute ("Drag Drop");
+// }
+//
+// return drag_drop;
+// }
+// }
+//
+// public static CategoryAttribute Focus {
+// get {
+// if (focus != null)
+// return focus;
+//
+// lock (typeof (CategoryAttribute)){
+// if (focus == null)
+// focus = new CategoryAttribute ("Focus");
+// }
+//
+// return focus;
+// }
+// }
+//
+// public static CategoryAttribute Format {
+// get {
+// if (format != null)
+// return format;
+//
+// lock (typeof (CategoryAttribute)){
+// if (format == null)
+// format = new CategoryAttribute ("Format");
+// }
+//
+// return format;
+// }
+// }
+//
+// public static CategoryAttribute Key {
+// get {
+// if (key != null)
+// return key;
+//
+// lock (typeof (CategoryAttribute)){
+// if (key == null)
+// key = new CategoryAttribute ("Key");
+// }
+//
+// return key;
+// }
+// }
+//
+// public static CategoryAttribute Layout {
+// get {
+// if (layout != null)
+// return layout;
+//
+// lock (typeof (CategoryAttribute)){
+// if (layout == null)
+// layout = new CategoryAttribute ("Layout");
+// }
+//
+// return layout;
+// }
+// }
+//
+// public static CategoryAttribute Mouse {
+// get {
+// if (mouse != null)
+// return mouse;
+//
+// lock (typeof (CategoryAttribute)){
+// if (mouse == null)
+// mouse = new CategoryAttribute ("Mouse");
+// }
+//
+// return mouse;
+// }
+// }
+//
+// public static CategoryAttribute WindowStyle {
+// get {
+// if (window_style != null)
+// return window_style;
+//
+// lock (typeof (CategoryAttribute)){
+// if (window_style == null)
+// window_style = new CategoryAttribute ("Window Style");
+// }
+//
+// return window_style;
+// }
+// }
}
}
Index: ChangeLog
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/ChangeLog,v
retrieving revision 1.66
diff -u -r1.66 ChangeLog
--- ChangeLog 20 Mar 2003 09:49:03 -0000 1.66
+++ ChangeLog 12 Jun 2003 12:50:10 -0000
@@ -1,3 +1,87 @@
+2003-06-12 Andreas Nahr <ClassDevelopment at A-SoftTech.com>
+
+ * AmbientValueAttribute.cs
+ * ArrayConverter.cs
+ * BaseNumberConverter.cs
+ * BindableAttribute.cs
+ * BooleanConverter.cs
+ * BrowsableAttribute.cs
+ * ByteConverter.cs
+ * CategoryAttribute.cs
+ * CharConverter.cs
+ * CollectionConverter.cs
+ * CultureInfoConverter.cs
+ * DateTimeConverter.cs
+ * DecimalConverter.cs
+ * DefaultEventAttribute.cs
+ * DefaultPropertyAttribute.cs
+ * DefaultValueAttribute.cs
+ * DescriptionAttribute.cs
+ * DesignerCategoryAttribute.cs
+ * DesignerSerializationVisibilityAttribute.cs
+ * DesignOnlyAttribute.cs
+ * DesignTimeVisibleAttribute.cs
+ * DoubleConverter.cs
+ * EditorBrowsableAttribute.cs
+ * ExpandableObjectConverter.cs
+ * ExtenderProvidedPropertyAttribute.cs
+ * GuidConverter.cs
+ * ImmutableObjectAttribute.cs
+ * InstallerTypeAttribute.cs
+ * Int16Converter.cs
+ * Int32Converter.cs
+ * Int64Converter.cs
+ * LicenseProviderAttribute.cs
+ * LocalizableAttribute.cs
+ * MergablePropertyAttribute.cs
+ * NotifyParentPropertyAttribute.cs
+ * ParenthesizePropertyNameAttribute.cs
+ * PropertyTabAttribute.cs
+ * ProvidePropertyAttribute.cs
+ * RecommendedAsConfigurableAttribute.cs
+ * RefreshPropertiesAttribute.cs
+ * SByteConverter.cs
+ * SingleConverter.cs
+ * TimeSpanConverter.cs
+ * ToolboxItemFilterAttribute.cs
+ * TypeConverter.cs
+ * TypeConverterAttribute.cs
+ * TypeListConverter.cs
+ * UInt16Converter.cs
+ * UInt32Converter.cs
+ * UInt64Converter.cs: All Attributes and Converter Classes in
+ System.Componentmodel implemented completely or implementation added
+
+ * InheritanceAttribute.cs
+ * InheritanceLevel.cs: Fixed wrong namespace assignments
+
+ * ExtenderProvidedPropertyAttribute.cs
+ * IComNativeDescriptorHandler.cs
+ * SyntaxCheck.cs: Added and implemented
+
+ * Component.cs
+ * ComponentCollection.cs
+ * ComponentEditor.cs
+ * Container.cs
+ * EventDescriptor.cs
+ * EventDescriptorCollection.cs
+ * IComNativeDescriptorHandler.cs
+ * IComponent.cs
+ * InvalidEnumArgumentException.cs
+ * MarshalByValueComponent.cs
+ * MemberDescriptor.cs
+ * PropertyDescriptor.cs
+ * PropertyDescriptorCollection.cs
+ * TypeDescriptor.cs: Missing implementation added
+
+ * DesignerAttribute.cs: Fixed implementation
+ * EditorAttribute.cs: Fixed implementation
+
+ * ReadOnlyAttribute.cs: Improved Hashcode generation
+
+ * RunInstallerAttribute.cs
+ * ListBindableAttribute: Improved Hashcode, cleaned class
+
2003-03-20 Dick Porter <dick at ximian.com>
* Win32Exception.cs: Made the fallback error more useful by
Index: CharConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/CharConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 CharConverter.cs
--- CharConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ CharConverter.cs 12 Jun 2003 12:50:11 -0000
@@ -2,49 +2,54 @@
// System.ComponentModel.CharConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
namespace System.ComponentModel
{
- public class CharConverter : TypeConverter
+ public class CharConverter : TypeConverter
{
- [MonoTODO]
+
public CharConverter()
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ if (value.GetType() == typeof (string))
+ {
+ string Test = (String) value;
+ if (Test.Length != 1)
+ // LAMESPEC: MS does throw FormatException here
+ throw new FormatException ("String has to be exactly
one char long");
+ return Test[0];
+ }
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
- {
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~CharConverter()
+ CultureInfo culture, object value, Type destinationType)
{
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value is char)
+ return new string ((char) value, 1);
+ return base.ConvertTo (context, culture, value,
destinationType);
}
}
}
Index: CollectionConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/CollectionConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 CollectionConverter.cs
--- CollectionConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ CollectionConverter.cs 12 Jun 2003 12:50:11 -0000
@@ -2,48 +2,45 @@
// System.ComponentModel.CollectionConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
+using System.Collections;
using System.Globalization;
namespace System.ComponentModel
{
public class CollectionConverter : TypeConverter
{
- [MonoTODO]
+
public CollectionConverter()
{
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ if (value != null)
+ // TODO check if the check for ICollection is correct
+ if (value is ICollection)
+ return "(Collection)";
+ return base.ConvertTo (context, culture, value,
destinationType);
}
- [MonoTODO]
public override PropertyDescriptorCollection GetProperties
(ITypeDescriptorContext context,
- object value,
- Attribute[] attributes)
+ object value, Attribute[] attributes)
{
- throw new NotImplementedException();
+ return null;
}
- [MonoTODO]
public override bool GetPropertiesSupported (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~CollectionConverter()
- {
+ return false;
}
}
}
Index: Component.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/Component.cs,v
retrieving revision 1.8
diff -u -r1.8 Component.cs
--- Component.cs 28 Aug 2002 02:30:24 -0000 1.8
+++ Component.cs 12 Jun 2003 12:50:12 -0000
@@ -1,13 +1,16 @@
//
// System.ComponentModel.Component.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
using System;
+using System.ComponentModel;
namespace System.ComponentModel {
@@ -18,11 +21,12 @@
// <remarks>
// Longer description
// </remarks>
+ [DesignerCategory ("Component")]
public class Component : MarshalByRefObject, IComponent, IDisposable {
- EventHandlerList event_handlers;
- ISite mySite;
- object disposedEvent = new object ();
+ private EventHandlerList event_handlers;
+ private ISite mySite;
+ private object disposedEvent = new object ();
// <summary>
// Component Constructor
@@ -35,14 +39,22 @@
// <summary>
// Get IContainer of this Component
// </summary>
+ [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
public IContainer Container {
- get {
+ get
+ {
+ if (mySite == null)
+ return null;
return mySite.Container;
}
}
+ [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
protected bool DesignMode {
- get {
+ get
+ {
+ if (mySite == null)
+ return false;
return mySite.DesignMode;
}
}
@@ -63,6 +75,7 @@
}
}
+ [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
public virtual ISite Site {
get {
return mySite;
@@ -126,7 +139,8 @@
}
// <summary>
// This event is called when the component is explicitly disposed.
- // </summary>
+ // </summary>
+ [Browsable (false), EditorBrowsable
(EditorBrowsableState.Advanced)]
public event EventHandler Disposed
{
add {
Index: ComponentCollection.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ComponentCollection.cs,v
retrieving revision 1.5
diff -u -r1.5 ComponentCollection.cs
--- ComponentCollection.cs 28 Aug 2002 02:30:24 -0000 1.5
+++ ComponentCollection.cs 12 Jun 2003 12:50:12 -0000
@@ -1,51 +1,64 @@
//
// System.ComponentModel.ComponentCollection.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
-// Tim Coleman (tim at timcoleman.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Tim Coleman (tim at timcoleman.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
// Copyright (C) Tim Coleman, 2002
+// (C) 2003 Andreas Nahr
//
using System.Collections;
using System.Runtime.InteropServices;
+using System.Reflection;
namespace System.ComponentModel {
- [ComVisible (true)]
+ [ComVisible (true)] //, DefaultMember ("Item")] // FIXME Indexed property
cannot be DefaultMember???
public class ComponentCollection : ReadOnlyCollectionBase {
+
+
#region Constructors
- [MonoTODO]
public ComponentCollection (IComponent[] components)
{
- throw new NotImplementedException ();
+ InnerList.AddRange (components);
}
#endregion // Constructors
#region Properties
- public virtual IComponent this [string name] {
- [MonoTODO]
- get { throw new NotImplementedException (); }
+ public virtual IComponent this [int index] {
+ get
+ {
+ return (IComponent) InnerList[index];
+ }
}
- public virtual IComponent this [int index] {
- [MonoTODO]
- get { throw new NotImplementedException (); }
+ public virtual IComponent this [string name] {
+ get
+ {
+ foreach (IComponent C in InnerList)
+ {
+ if (C.Site != null)
+ if (C.Site.Name == name)
+ return C;
+ }
+ return null;
+ }
}
#endregion // Properties
#region Methods
- [MonoTODO]
public void CopyTo (IComponent[] array, int index)
{
- throw new NotImplementedException ();
+ InnerList.CopyTo (array,index);
}
#endregion // Methods
Index: ComponentEditor.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/ComponentEditor.cs,v
retrieving revision 1.1
diff -u -r1.1 ComponentEditor.cs
--- ComponentEditor.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ComponentEditor.cs 12 Jun 2003 12:50:12 -0000
@@ -2,32 +2,27 @@
// System.ComponentModel.ComponentEditor
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
public abstract class ComponentEditor
{
- [MonoTODO]
protected ComponentEditor()
{
}
- [MonoTODO]
public bool EditComponent (object component)
{
- throw new NotImplementedException();
+ return EditComponent (null, component);
}
- public abstract bool EditComponent (ITypeDescriptorContext context,
- object component);
+ public abstract bool EditComponent (ITypeDescriptorContext context,
object component);
- [MonoTODO]
- ~ComponentEditor()
- {
- }
}
}
Index: Container.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/Container.cs,v
retrieving revision 1.6
diff -u -r1.6 Container.cs
--- Container.cs 28 Aug 2002 02:30:24 -0000 1.6
+++ Container.cs 12 Jun 2003 12:50:13 -0000
@@ -1,12 +1,16 @@
//
// System.ComponentModel.Container.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
+using System.Collections;
+
namespace System.ComponentModel {
// <summary>
@@ -17,7 +21,9 @@
//
// </remarks>
public class Container : IContainer, IDisposable {
- ComponentCollection cc;
+
+ private ArrayList c = new ArrayList ();
+ //ComponentCollection cc;
// <summary>
// Auxiliary class to support the default behaviour of CreateSite
@@ -31,9 +37,9 @@
// </remarks>
class DefaultSite : ISite {
- IComponent component;
- IContainer container;
- string name;
+ private IComponent component;
+ private IContainer container;
+ private string name;
public DefaultSite (string name, IComponent component, IContainer
container)
{
@@ -89,27 +95,28 @@
}
public virtual ComponentCollection Components {
- get {
- return cc;
+ get
+ {
+ Array a = c.ToArray(typeof (IComponent));
+ return new ComponentCollection((IComponent[]) a);
}
}
// <summary>
// Adds an IComponent to the Container
// </summary>
- [MonoTODO]
public virtual void Add (IComponent component)
{
- // FIXME: Add this component to the ComponentCollection.cc
+ Add (component, null);
}
// <summary>
// Adds an IComponent to the Container. With a name binding.
// </summary>
- [MonoTODO]
public virtual void Add (IComponent component, string name)
{
- // FIXME: Add this component to the ComponentCollection.cc
+ component.Site = CreateSite (component, name);
+ c.Add (component);
}
// <summary>
@@ -117,6 +124,12 @@
// <summary>
protected virtual ISite CreateSite (IComponent component, string name)
{
+ foreach (IComponent Comp in c)
+ {
+ if (Comp.Site != null)
+ if (Comp.Site.Name == name)
+ throw new ArgumentException ("duplicate component
name", "name");
+ }
return new DefaultSite (name, component, this);
}
@@ -138,7 +151,7 @@
//??
}
- cc = null;
+ c = null;
}
~Container ()
@@ -154,10 +167,9 @@
return null;
}
- [MonoTODO]
public virtual void Remove (IComponent component)
{
- // FIXME: Add this component to the ComponentCollection.cc
+ c.Remove (component);
}
}
Index: CultureInfoConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/CultureInfoConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 CultureInfoConverter.cs
--- CultureInfoConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ CultureInfoConverter.cs 12 Jun 2003 12:50:13 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.CultureInfoConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,63 +15,76 @@
{
public class CultureInfoConverter : TypeConverter
{
- [MonoTODO]
+
public CultureInfoConverter()
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context,
- Type destinationType)
+ Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ return true;
+ return base.CanConvertTo (context, destinationType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ if (value.GetType() == typeof (string))
+ {
+ string CultureString = (String) value;
+ try
+ {
+ // try to create a new CultureInfo if form is RFC 1766
+ return new CultureInfo (CultureString);
+ }
+ catch
+ {
+ // try to create a new CultureInfo if form is verbose
name
+ foreach (CultureInfo CI in CultureInfo.GetCultures
(CultureTypes.AllCultures))
+ // LAMESPEC MS seems to use EnglishName (culture
invariant) - check this
+ if (CI.EnglishName.ToString().IndexOf
(CultureString) > 0)
+ return CI;
+ }
+ throw new ArgumentException ("Culture incorrect or not
available in this environment.", "value");
+ }
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value is CultureInfo)
+ // LAMESPEC MS seems to use EnglishName (culture
invariant) - check this
+ return ((CultureInfo) value).EnglishName;
+ return base.ConvertTo (context, culture, value,
destinationType);
}
- [MonoTODO]
public override StandardValuesCollection GetStandardValues
(ITypeDescriptorContext context)
{
- throw new NotImplementedException();
+ return new StandardValuesCollection (CultureInfo.GetCultures
(CultureTypes.AllCultures));
}
- [MonoTODO]
public override bool GetStandardValuesExclusive (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
+ return false;
}
- [MonoTODO]
public override bool GetStandardValuesSupported (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
- ~CultureInfoConverter()
- {
- }
}
}
Index: DateTimeConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DateTimeConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 DateTimeConverter.cs
--- DateTimeConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ DateTimeConverter.cs 12 Jun 2003 12:50:13 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.DateTimeConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,45 +15,81 @@
{
public class DateTimeConverter : TypeConverter
{
- [MonoTODO]
+
public DateTimeConverter()
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context,
- Type destinationType)
+ Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ return true;
+ return base.CanConvertTo (context, destinationType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ if (value.GetType() == typeof (string))
+ {
+ string DateString = (String) value;
+ try
+ {
+ if (culture == null)
+ // try to parse string
+ return DateTime.Parse (DateString);
+ else
+ // try to parse string
+ return DateTime.Parse (DateString,
culture.DateTimeFormat);
+ }
+ catch
+ {
+ throw new FormatException (DateString + "is not a valid
DateTime value.");
+ }
+ }
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException();
- }
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value is DateTime)
+ {
+
+ CultureInfo CurrentCulture = culture;
+ if (CurrentCulture == null)
+ CurrentCulture = CultureInfo.CurrentCulture;
+ DateTime ConvertTime = (DateTime) value;
+
+ if
(CurrentCulture.Equals(CultureInfo.InvariantCulture))
+ {
+ if (ConvertTime.Equals(ConvertTime.Date))
+ return ConvertTime.ToString("yyyy-mm-dd");
+ else
+ return ConvertTime.ToString ();
+ }
+ else
+ {
+ if (ConvertTime.Equals(ConvertTime.Date))
+ return ConvertTime.ToString
(CurrentCulture.DateTimeFormat.ShortDatePattern);
+ else
+ return ConvertTime.ToString
(CurrentCulture.DateTimeFormat.ShortDatePattern +
+ " " +
CurrentCulture.DateTimeFormat.ShortTimePattern);
+ }
- [MonoTODO]
- ~DateTimeConverter()
- {
+ }
+ return base.ConvertTo (context, culture, value,
destinationType);
}
}
}
Index: DecimalConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/DecimalConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 DecimalConverter.cs
--- DecimalConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ DecimalConverter.cs 12 Jun 2003 12:50:14 -0000
@@ -2,41 +2,33 @@
// System.ComponentModel.DecimalConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
namespace System.ComponentModel
{
- public class DecimalConverter : BaseNumberConverter
+ public class DecimalConverter : BaseNumberConverter
{
- [MonoTODO]
public DecimalConverter()
{
}
- [MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context,
- Type destinationType)
+ Type destinationType)
{
- throw new NotImplementedException();
+ return base.CanConvertTo (context, destinationType);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
- {
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~DecimalConverter()
+ CultureInfo culture, object value, Type destinationType)
{
+ return base.ConvertTo(context, culture, value, destinationType);
}
}
}
Index: DefaultEventAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 DefaultEventAttribute.cs
--- DefaultEventAttribute.cs 13 Jul 2002 13:39:39 -0000 1.1
+++ DefaultEventAttribute.cs 12 Jun 2003 12:50:14 -0000
@@ -3,8 +3,10 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
@@ -16,6 +18,8 @@
{
private string eventName;
+ public static readonly DefaultEventAttribute Default = new
DefaultEventAttribute (null);
+
public DefaultEventAttribute (string name)
{
eventName = name;
@@ -31,12 +35,14 @@
if (!(o is DefaultEventAttribute))
return false;
- return (((DefaultEventAttribute) o).eventName == eventName);
+ return (((DefaultEventAttribute) o).Name.Equals (eventName));
}
public override int GetHashCode ()
{
- return base.GetHashCode ();
+ if (eventName == null)
+ return 0;
+ return eventName.GetHashCode ();
}
}
}
Index: DefaultPropertyAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 DefaultPropertyAttribute.cs
--- DefaultPropertyAttribute.cs 6 Jul 2002 17:52:51 -0000 1.1
+++ DefaultPropertyAttribute.cs 12 Jun 2003 12:50:14 -0000
@@ -3,8 +3,10 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
@@ -16,6 +18,8 @@
{
private string property_name;
+ public static readonly DefaultPropertyAttribute Default = new
DefaultPropertyAttribute (null);
+
public DefaultPropertyAttribute (string name)
{
property_name = name;
@@ -31,12 +35,14 @@
if (!(o is DefaultPropertyAttribute))
return false;
- return (((DefaultPropertyAttribute) o).Name == property_name);
+ return (((DefaultPropertyAttribute) o).Name.Equals (property_name));
}
public override int GetHashCode ()
{
- return base.GetHashCode ();
+ if (property_name == null)
+ return 0;
+ return property_name.GetHashCode ();
}
}
}
Index: DefaultValueAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs,v
retrieving revision 1.2
diff -u -r1.2 DefaultValueAttribute.cs
--- DefaultValueAttribute.cs 20 Nov 2002 02:16:47 -0000 1.2
+++ DefaultValueAttribute.cs 12 Jun 2003 12:50:14 -0000
@@ -1,133 +1,106 @@
-using System;
-
-namespace System.ComponentModel
-{
- /// <summary>
- /// Specifies the default value for a property.
- /// </summary>
-
- [MonoTODO("Needs testing. DefaultValueAttribute(System.Type type, string
value) is not implemented. Value has no description.")]
- [AttributeUsage(AttributeTargets.All)]
- public sealed class DefaultValueAttribute : Attribute
- {
-
- private object defaultValue;
-
- /// <summary>
- /// FIXME: Summary description for Value.
- /// </summary>
- public object Value
- {
- get
- {
- return defaultValue;
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class.
- /// </summary>
- /// <param name="value">An System.Object that represents the default
value.</param>
- public DefaultValueAttribute(object value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a System.Boolean
value.
- /// </summary>
- /// <param name="value">An System.Boolean that represents the default
value.</param>
- public DefaultValueAttribute(bool value)
- {
- defaultValue = value;
- }
-
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using an 8-bit unsigned
integer.
- /// </summary>
- /// <param name="value">An 8-bit unsigned integer that is the default
value.</param>
- public DefaultValueAttribute(byte value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a Unicode character.
- /// </summary>
- /// <param name="value">A Unicode character that is the default
value.</param>
- public DefaultValueAttribute(char value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a double-precision
floating point number.
- /// </summary>
- /// <param name="value">A double-precision floating point number that is
the default value.</param>
- public DefaultValueAttribute(double value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a 32-bit signed
integer.
- /// </summary>
- /// <param name="value">A 32-bit signed integer that is the default
value.</param>
- public DefaultValueAttribute(int value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a 64-bit signed
integer.
- /// </summary>
- /// <param name="value">A 64-bit signed integer that is the default
value.</param>
- public DefaultValueAttribute(long value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a 16-bit signed
integer.
- /// </summary>
- /// <param name="value">A 16-bit signed integer that is the default
value.</param>
- public DefaultValueAttribute(short value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a single-precision
floating point number.
- /// </summary>
- /// <param name="value">A single-precision floating point number that is
the default value.</param>
- public DefaultValueAttribute(System.Single value)
- {
- defaultValue = value;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class using a System.String.
- /// </summary>
- /// <param name="value">A System.String that is the default
value.</param>
- public DefaultValueAttribute(string value)
- {
- defaultValue = value;
- }
-
- /*
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.DefaultValueAttribute class, converting the specified
value to the specified type, and using an invariant culture as the
translation context.
- /// </summary>
- /// <param name="type">A System.Type that represents the type to convert
the value to.</param>
- /// <param name="value">A System.String that can be converted to the type
using the System.ComponentModel.TypeConverter for the type and the U.S.
English culture.</param>
- public DefaultValueAttribute(System.Type type, string value)
- {
- //FIXME
- throw new NotImplementedException();
- }
- */
- }
-
-}
-
+//
+// System.ComponentModel.DefaultValueAttribute
+//
+// Author:
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.All)]
+ public sealed class DefaultValueAttribute : Attribute
+ {
+
+ private object DefaultValue;
+
+ public DefaultValueAttribute (bool value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (byte value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (char value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (double value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (short value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (int value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (long value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (object value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (float value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (string value)
+ {
+ DefaultValue = value;
+ }
+
+ public DefaultValueAttribute (Type type, string value)
+ {
+ // FIXME check if this implementation is correct
+ try
+ {
+ DefaultValue = Convert.ChangeType (value, type);
+ }
+ catch
+ {
+ DefaultValue = null;
+ }
+ }
+
+ public object Value
+ {
+ get { return DefaultValue; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DefaultValueAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((DefaultValueAttribute) obj).Value.Equals
(DefaultValue);
+ }
+
+ public override int GetHashCode()
+ {
+ if (DefaultValue == null)
+ return 0;
+ return DefaultValue.GetHashCode();
+ }
+ }
+}
+
+
+
+
Index: DescriptionAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 DescriptionAttribute.cs
--- DescriptionAttribute.cs 27 Oct 2001 19:38:07 -0000 1.1
+++ DescriptionAttribute.cs 12 Jun 2003 12:50:14 -0000
@@ -1,27 +1,30 @@
//
// System.ComponentModel.DescriptionAttribute.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
//
namespace System.ComponentModel {
- [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ [AttributeUsage (AttributeTargets.All)]
public class DescriptionAttribute : Attribute {
- string desc;
+ private string desc;
+
+ public static readonly DescriptionAttribute Default = new
DescriptionAttribute ();
- public DescriptionAttribute (string name)
+ public DescriptionAttribute () : this ("")
{
- desc = name;
}
- public DescriptionAttribute ()
+ public DescriptionAttribute (string name)
{
- desc = "";
+ desc = name;
}
public virtual string Description {
@@ -42,5 +45,21 @@
desc = value;
}
}
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DescriptionAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((DescriptionAttribute) obj).Description.Equals (desc);
+ }
+
+ public override int GetHashCode ()
+ {
+ if (desc == null)
+ return 0;
+ return desc.GetHashCode ();
+ }
}
}
Index: DesignerAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DesignerAttribute.cs,v
retrieving revision 1.5
diff -u -r1.5 DesignerAttribute.cs
--- DesignerAttribute.cs 19 Nov 2002 16:36:55 -0000 1.5
+++ DesignerAttribute.cs 12 Jun 2003 12:50:15 -0000
@@ -2,87 +2,90 @@
// System.ComponentModel.DesignerAttribute.cs
//
// Author:
-// Alejandro Sánchez Acosta (raciel at es.gnu.org)
+// Alejandro Sánchez Acosta (raciel at es.gnu.org)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Alejandro Sánchez Acosta
+// (C) 2003 Andreas Nahr
//
-namespace System.ComponentModel {
+namespace System.ComponentModel
+{
- /// <summary>
- /// Designer Attribute for classes.
- /// </summary>
+ /// <summary>
+ /// Designer Attribute for classes.
+ /// </summary>
- /// <remarks>
- /// </remarks>
+ /// <remarks>
+ /// </remarks>
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
- public sealed class DesignerAttribute : Attribute
- {
- string name;
- string basetypename;
- Type type;
- Type basetype;
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
+ public sealed class DesignerAttribute : Attribute
+ {
+ private string name;
+ private string basetypename;
- public DesignerAttribute (string designerTypeName)
- {
- name = designerTypeName;
- }
-
- public DesignerAttribute (Type designerType)
- {
- type = designerType;
- }
-
- public DesignerAttribute (string designerTypeName, string
designerBaseTypeName)
- {
- name = designerTypeName;
- basetypename = designerBaseTypeName;
- }
-
- public DesignerAttribute (string designerTypeName, Type
designerBaseType)
- {
- name = designerTypeName;
- basetype = designerBaseType;
- }
-
- public DesignerAttribute (Type designerType, Type designerBaseType)
- {
- type = designerType;
- basetype = designerBaseType;
- }
-
- public string DesignerBaseTypeName {
- get {
- return basetypename;
- }
- }
-
- public string DesignerTypeName {
- get {
- return name;
- }
- }
-
- public override object TypeId {
- get {
- return this.GetType ();
- }
- }
+ public DesignerAttribute (string designerTypeName)
+ {
+ name = designerTypeName;
+ }
+
+ public DesignerAttribute (Type designerType)
+ : this (designerType.AssemblyQualifiedName)
+ {
+ }
+
+ public DesignerAttribute (string designerTypeName, Type
designerBaseType)
+ : this (designerTypeName,
designerBaseType.AssemblyQualifiedName)
+ {
+ }
+
+ public DesignerAttribute (Type designerType, Type designerBaseType)
+ : this (designerType.AssemblyQualifiedName,
designerBaseType.AssemblyQualifiedName)
+ {
+ }
+
+ public DesignerAttribute (string designerTypeName, string
designerBaseTypeName)
+ {
+ name = designerTypeName;
+ basetypename = designerBaseTypeName;
+ }
+
+ public string DesignerBaseTypeName
+ {
+ get
+ {
+ return basetypename;
+ }
+ }
+
+ public string DesignerTypeName
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ public override object TypeId
+ {
+ get
+ {
+ return this.GetType ();
+ }
+ }
- public override bool Equals (object obj)
- {
- if (!(obj is DesignerAttribute))
- return false;
- return (((DesignerAttribute) obj).name == name) &&
- (((DesignerAttribute) obj).basetype == basetype) &&
- (((DesignerAttribute) obj).type == type) &&
- (((DesignerAttribute) obj).basetypename == basetypename);
- }
-
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
- }
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DesignerAttribute))
+ return false;
+ return ((DesignerAttribute) obj).DesignerBaseTypeName.Equals
(basetypename) &&
+ ((DesignerAttribute) obj).DesignerTypeName.Equals (name);
+ }
+
+ public override int GetHashCode ()
+ {
+ return string.Concat(name, basetypename).GetHashCode ();
+ }
+ }
}
Index: DesignerCategoryAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DesignerCategoryAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 DesignerCategoryAttribute.cs
--- DesignerCategoryAttribute.cs 5 Feb 2003 16:07:23 -0000 1.1
+++ DesignerCategoryAttribute.cs 12 Jun 2003 12:50:15 -0000
@@ -1,8 +1,11 @@
//
// System.ComponentModel.DesignerCategoryAttribute.cs
//
-// Author:
-// Alan Tam Siu Lung (Tam at SiuLung.com)
+// Authors:
+// Alan Tam Siu Lung (Tam at SiuLung.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel {
@@ -17,15 +20,15 @@
[AttributeUsage(AttributeTargets.Class)]
public sealed class DesignerCategoryAttribute : Attribute
{
- string category;
- public static readonly DesignerCategoryAttribute Component;
- public static readonly DesignerCategoryAttribute Form;
- public static readonly DesignerCategoryAttribute Generic;
- static readonly DesignerCategoryAttribute Default;
+ private string category;
+
+ public static readonly DesignerCategoryAttribute Component = new
DesignerCategoryAttribute ("Component");
+ public static readonly DesignerCategoryAttribute Form = new
DesignerCategoryAttribute ("Form");
+ public static readonly DesignerCategoryAttribute Generic = new
DesignerCategoryAttribute ("Designer");
+ public static readonly DesignerCategoryAttribute Default = new
DesignerCategoryAttribute ();
- public DesignerCategoryAttribute ()
+ public DesignerCategoryAttribute () : this ("")
{
- this.category = "";
}
public DesignerCategoryAttribute (string category)
@@ -51,17 +54,19 @@
return false;
if (obj == this)
return true;
- return ((DesignerCategoryAttribute) obj).category == category;
+ return ((DesignerCategoryAttribute) obj).Category.Equals (category);
}
public override int GetHashCode ()
{
+ if (category == null)
+ return 0;
return category.GetHashCode ();
}
public override bool IsDefaultAttribute ()
{
- return category == DesignerCategoryAttribute.Default.Category; // FIXME
+ return Equals (Default);
}
}
}
Index: DesignerSerializationVisibilityAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility
Attribute.cs,v
retrieving revision 1.2
diff -u -r1.2 DesignerSerializationVisibilityAttribute.cs
--- DesignerSerializationVisibilityAttribute.cs 1 Apr 2002 06:07:39 -0000
1.2
+++ DesignerSerializationVisibilityAttribute.cs 12 Jun 2003 12:50:15 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.DesignerSerializationVisibilityAttribute.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
//
@@ -12,31 +14,48 @@
[AttributeUsage (AttributeTargets.Property)]
public sealed class DesignerSerializationVisibilityAttribute : Attribute {
- DesignerSerializationVisibility visibility;
- static DesignerSerializationVisibilityAttribute ()
- {
- Content = new DesignerSerializationVisibilityAttribute (
- DesignerSerializationVisibility.Content);
- Hidden = new DesignerSerializationVisibilityAttribute (
- DesignerSerializationVisibility.Hidden);
- Visible = new DesignerSerializationVisibilityAttribute (
- DesignerSerializationVisibility.Visible);
- }
+ private DesignerSerializationVisibility visibility;
+
+ public static readonly DesignerSerializationVisibilityAttribute
Default=
+ new DesignerSerializationVisibilityAttribute
(DesignerSerializationVisibility.Visible);
+ public static readonly DesignerSerializationVisibilityAttribute Content =
+ new DesignerSerializationVisibilityAttribute
(DesignerSerializationVisibility.Content);
+ public static readonly DesignerSerializationVisibilityAttribute Hidden =
+ new DesignerSerializationVisibilityAttribute
(DesignerSerializationVisibility.Hidden);
+ public static readonly DesignerSerializationVisibilityAttribute Visible=
+ new DesignerSerializationVisibilityAttribute
(DesignerSerializationVisibility.Visible);
+
public DesignerSerializationVisibilityAttribute
(DesignerSerializationVisibility vis)
{
visibility = vis;
}
- public static readonly DesignerSerializationVisibilityAttribute Content;
- public static readonly DesignerSerializationVisibilityAttribute Hidden;
- public static readonly DesignerSerializationVisibilityAttribute Visible;
public DesignerSerializationVisibility Visibility {
get {
return visibility;
}
}
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DesignerSerializationVisibilityAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((DesignerSerializationVisibilityAttribute)
obj).Visibility.Equals (visibility);
+ }
+
+ public override int GetHashCode ()
+ {
+ return visibility.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
}
}
Index: DesignOnlyAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs,v
retrieving revision 1.2
diff -u -r1.2 DesignOnlyAttribute.cs
--- DesignOnlyAttribute.cs 3 Apr 2002 06:28:49 -0000 1.2
+++ DesignOnlyAttribute.cs 12 Jun 2003 12:50:15 -0000
@@ -1,27 +1,24 @@
//
// System.ComponentModel.DesignOnlyAttribute.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
-//
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel {
[AttributeUsage (AttributeTargets.Property)]
public sealed class DesignOnlyAttribute : Attribute {
- bool design_only;
-
- public static readonly DesignOnlyAttribute No;
- public static readonly DesignOnlyAttribute Yes;
- static DesignOnlyAttribute ()
- {
- No = new DesignOnlyAttribute (false);
- Yes = new DesignOnlyAttribute (false);
- }
+ private bool design_only;
+
+ public static readonly DesignOnlyAttribute Default = new
DesignOnlyAttribute (false);
+ public static readonly DesignOnlyAttribute No = new DesignOnlyAttribute
(false);
+ public static readonly DesignOnlyAttribute Yes = new DesignOnlyAttribute
(true);
public DesignOnlyAttribute (bool design_only)
{
@@ -33,5 +30,24 @@
return design_only;
}
}
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DesignOnlyAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((DesignOnlyAttribute) obj).IsDesignOnly.Equals
(design_only);
+ }
+
+ public override int GetHashCode ()
+ {
+ return design_only.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return design_only == DesignOnlyAttribute.Default.IsDesignOnly;
+ }
}
}
Index: DesignTimeVisibleAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 DesignTimeVisibleAttribute.cs
--- DesignTimeVisibleAttribute.cs 12 Nov 2002 02:05:34 -0000 1.1
+++ DesignTimeVisibleAttribute.cs 12 Jun 2003 12:50:16 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.DesignTimeVisibleAttribute.cs
//
-// Author:
-// Tim Coleman (tim at timcoleman.com)
+// Authors:
+// Tim Coleman (tim at timcoleman.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// Copyright (C) Tim Coleman, 2002
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel {
@@ -13,7 +15,7 @@
{
#region Fields
- bool visible;
+ private bool visible;
public static readonly DesignTimeVisibleAttribute Default = new
DesignTimeVisibleAttribute (true);
public static readonly DesignTimeVisibleAttribute No = new
DesignTimeVisibleAttribute (false);
@@ -45,22 +47,24 @@
#region Methods
- [MonoTODO]
- public override bool Equals (object value)
+
+ public override bool Equals (object obj)
{
- throw new NotImplementedException ();
+ if (!(obj is DesignTimeVisibleAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((DesignTimeVisibleAttribute) obj).Visible.Equals
(visible);
}
- [MonoTODO]
public override int GetHashCode ()
{
- throw new NotImplementedException ();
+ return visible.GetHashCode ();
}
- [MonoTODO]
public override bool IsDefaultAttribute ()
{
- throw new NotImplementedException ();
+ return Equals (Default);
}
#endregion // Methods
Index: DoubleConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/DoubleConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 DoubleConverter.cs
--- DoubleConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ DoubleConverter.cs 12 Jun 2003 12:50:16 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.DoubleConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class DoubleConverter : BaseNumberConverter
- {
- [MonoTODO]
- public DoubleConverter()
- {
- }
-
- [MonoTODO]
- ~DoubleConverter()
- {
- }
- }
+ public class DoubleConverter : BaseNumberConverter
+ {
+ public DoubleConverter()
+ {
+ InnerType = typeof (Double);
+ }
+ }
}
Index: EditorAttribute.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/EditorAttribute.cs,v
retrieving revision 1.4
diff -u -r1.4 EditorAttribute.cs
--- EditorAttribute.cs 19 Nov 2002 16:36:55 -0000 1.4
+++ EditorAttribute.cs 12 Jun 2003 12:50:16 -0000
@@ -3,8 +3,10 @@
//
// Author:
// Alejandro Sánchez Acosta (raciel at es.gnu.org)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Alejandro Sánchez Acosta
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel {
@@ -18,8 +20,6 @@
string name;
string basename;
- Type baseType;
- Type nametype;
public EditorAttribute ()
{
@@ -33,15 +33,13 @@
}
public EditorAttribute (string typeName, Type baseType)
+ : this (typeName, baseType.AssemblyQualifiedName)
{
- name = typeName;
- this.baseType = baseType;
}
public EditorAttribute (Type type, Type baseType)
+ : this (type.AssemblyQualifiedName,
baseType.AssemblyQualifiedName)
{
- nametype = type;
- this.baseType = baseType;
}
public string EditorBaseTypeName {
@@ -67,19 +65,13 @@
if (!(obj is EditorAttribute))
return false;
- return (((EditorAttribute) obj).name == name) &&
- (((EditorAttribute) obj).basename == basename) &&
- (((EditorAttribute) obj).baseType == baseType) &&
- (((EditorAttribute) obj).nametype == nametype);
-
+ return ((EditorAttribute) obj).EditorBaseTypeName.Equals (basename) &&
+ ((EditorAttribute) obj).EditorTypeName.Equals (name);
}
public override int GetHashCode ()
{
- if (name == null)
- return 0;
-
- return name.GetHashCode ();
+ return string.Concat(name, basename).GetHashCode ();
}
}
}
Index: EditorBrowsableAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 EditorBrowsableAttribute.cs
--- EditorBrowsableAttribute.cs 8 May 2002 14:51:40 -0000 1.1
+++ EditorBrowsableAttribute.cs 12 Jun 2003 12:50:16 -0000
@@ -1,53 +1,56 @@
-using System;
-
-namespace System.ComponentModel
-{
-
- /// <summary>
- /// Specifies that a property or method is viewable in an editor. This
class cannot be inherited.
- /// </summary>
- [MonoTODO("Missing description for State. Only minimal testing.")]
- [AttributeUsage(
- AttributeTargets.Class|
- AttributeTargets.Constructor|
- AttributeTargets.Delegate|
- AttributeTargets.Enum|
- AttributeTargets.Event|
- AttributeTargets.Field|
- AttributeTargets.Interface|
- AttributeTargets.Method|
- AttributeTargets.Property|
- AttributeTargets.Struct)]
- public sealed class EditorBrowsableAttribute : Attribute
- {
- private System.ComponentModel.EditorBrowsableState state;
-
- /// <summary>
- /// FIXME: Summary description for State.
- /// </summary>
- public System.ComponentModel.EditorBrowsableState State
- {
- get
- {
- return state;
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.EditorBrowsableAttribute class with an
System.ComponentModel.EditorBrowsableState.
- /// </summary>
- /// <param name="state">The System.ComponentModel.EditorBrowsableState to
set System.ComponentModel.EditorBrowsableAttribute.State to.</param>
- public
EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState state)
- {
- this.state = state;
- }
-
- /// <summary>
- /// Initializes a new instance of the
System.ComponentModel.EditorBrowsableAttribute class with an
System.ComponentModel.EditorBrowsableState ==
System.ComponentModel.EditorBrowsableState.Always.
- /// </summary>
- public EditorBrowsableAttribute()
- {
- this.state = System.ComponentModel.EditorBrowsableState.Always;
- }
- }
-}
+//
+// System.ComponentModel.EditorBrowsableAttribute.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+//
+
+using System.ComponentModel;
+
+namespace System.ComponentModel
+{
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Constructor
| AttributeTargets.Delegate |
+ AttributeTargets.Enum | AttributeTargets.Event |
AttributeTargets.Field | AttributeTargets.Interface |
+ AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Struct)]
+ public sealed class EditorBrowsableAttribute : Attribute
+ {
+ private EditorBrowsableState state;
+
+ public EditorBrowsableAttribute ()
+ {
+ this.state = EditorBrowsableState.Always;
+ }
+
+ public EditorBrowsableAttribute
(System.ComponentModel.EditorBrowsableState state)
+ {
+ this.state = state;
+ }
+
+
+ public EditorBrowsableState State
+ {
+ get
+ {
+ return state;
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is EditorBrowsableAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((EditorBrowsableAttribute) obj).State.Equals (state);
+ }
+
+ public override int GetHashCode ()
+ {
+ return state.GetHashCode ();
+ }
+ }
+}
\ No newline at end of file
Index: EventDescriptor.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/EventDescriptor.cs,v
retrieving revision 1.3
diff -u -r1.3 EventDescriptor.cs
--- EventDescriptor.cs 8 May 2002 13:21:10 -0000 1.3
+++ EventDescriptor.cs 12 Jun 2003 12:50:17 -0000
@@ -2,15 +2,21 @@
// System.ComponentModel.EventDescriptor.cs
//
// Authors:
-// Rodrigo Moya (rodrigo at ximian.com)
+// Rodrigo Moya (rodrigo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. 2002
+// (C) 2003 Andreas Nahr
//
+using System.Runtime.InteropServices;
+
namespace System.ComponentModel
{
+ [ComVisibleAttribute (true)]
public abstract class EventDescriptor : MemberDescriptor
{
+
protected EventDescriptor (MemberDescriptor desc) : base (desc)
{
}
@@ -19,8 +25,21 @@
{
}
- protected EventDescriptor(string str, Attribute[] attrs) : base (str,
attrs)
+ protected EventDescriptor (string str, Attribute[] attrs) : base (str,
attrs)
{
}
+
+ public abstract void AddEventHandler (object component,
System.Delegate value);
+
+ public abstract void RemoveEventHandler(object component,
System.Delegate value);
+
+ public abstract System.Type ComponentType { get; }
+
+ public abstract System.Type EventType { get; }
+
+ public abstract bool IsMulticast
+ {
+ get;
+ }
}
}
Index: EventDescriptorCollection.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs,v
retrieving revision 1.5
diff -u -r1.5 EventDescriptorCollection.cs
--- EventDescriptorCollection.cs 23 Aug 2002 05:37:58 -0000 1.5
+++ EventDescriptorCollection.cs 12 Jun 2003 12:50:17 -0000
@@ -1,15 +1,20 @@
//
// System.ComponentModel.EventDescriptorCollection.cs
//
-// Author: Rodrigo Moya (rodrigo at ximian.com)
+// Authors:
+// Rodrigo Moya (rodrigo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc.
+// (C) 2003 Andreas Nahr
//
using System.Collections;
+using System.Runtime.InteropServices;
namespace System.ComponentModel
{
+ [ComVisible (true)]
public class EventDescriptorCollection : IList, ICollection, IEnumerable
{
private ArrayList eventList;
@@ -33,9 +38,14 @@
return eventList.Contains (value);
}
- [MonoTODO]
- public virtual EventDescriptor Find (string name, bool ignoreCase) {
- throw new NotImplementedException ();
+ public virtual EventDescriptor Find (string name, bool ignoreCase)
+ {
+ foreach (EventDescriptor e in eventList)
+ {
+ if (0 == String.Compare (name, e.Name, ignoreCase))
+ return e;
+ }
+ return null;
}
public IEnumerator GetEnumerator () {
@@ -58,15 +68,14 @@
eventList.RemoveAt (index);
}
-
- [MonoTODO]
public virtual EventDescriptorCollection Sort () {
- throw new NotImplementedException ();
+ eventList.Sort ();
+ return this;
}
- [MonoTODO]
public virtual EventDescriptorCollection Sort (IComparer comparer) {
- throw new NotImplementedException ();
+ eventList.Sort (comparer);
+ return this;
}
[MonoTODO]
@@ -75,8 +84,7 @@
}
[MonoTODO]
- public virtual EventDescriptorCollection Sort (string[] order,
- IComparer comparer) {
+ public virtual EventDescriptorCollection Sort (string[] order, IComparer
comparer) {
throw new NotImplementedException ();
}
@@ -97,9 +105,9 @@
}
public virtual EventDescriptor this[string name] {
- [MonoTODO]
- get {
- throw new NotImplementedException ();
+ get
+ {
+ return Find (name, false);
}
}
Index: ExpandableObjectConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs,v
retrieving revision 1.2
diff -u -r1.2 ExpandableObjectConverter.cs
--- ExpandableObjectConverter.cs 23 Jul 2002 03:59:22 -0000 1.2
+++ ExpandableObjectConverter.cs 12 Jun 2003 12:50:20 -0000
@@ -25,7 +25,8 @@
#region Methods
[MonoTODO]
- public override PropertyDescriptorCollection GetProperties
(ITypeDescriptorContext context, object value, Attribute[] attributes)
+ public override PropertyDescriptorCollection GetProperties
(ITypeDescriptorContext context,
+ object value, Attribute[] attributes)
{
throw new NotImplementedException ();
}
Index: GuidConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/GuidConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 GuidConverter.cs
--- GuidConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ GuidConverter.cs 12 Jun 2003 12:50:21 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.GuidConverter
//
-// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Author:
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,45 +15,56 @@
{
public class GuidConverter : TypeConverter
{
- [MonoTODO]
+
public GuidConverter()
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context,
- Type destinationType)
+ Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ return true;
+ return base.CanConvertTo (context, destinationType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ if (value.GetType() == typeof (string))
+ {
+ string GuidString = (string) value;
+ try
+ {
+ return new Guid (GuidString);
+ }
+ catch
+ {
+ throw new FormatException (GuidString + "is not a valid
GUID.");
+ }
+ }
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
- {
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~GuidConverter()
+ CultureInfo culture, object value, Type destinationType)
{
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value.GetType() == typeof (Guid))
+ {
+ // LAMESPEC MS seems to always parse "D" type
+ return ((Guid) value).ToString("D");
+ }
+ return base.ConvertTo (context, culture, value,
destinationType);
}
}
}
Index: IComponent.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/IComponent.cs,v
retrieving revision 1.2
diff -u -r1.2 IComponent.cs
--- IComponent.cs 12 May 2002 03:15:56 -0000 1.2
+++ IComponent.cs 12 Jun 2003 12:50:22 -0000
@@ -1,16 +1,26 @@
//
// System.ComponentModel.IComponent.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
using System;
+using System.ComponentModel.Design.Serialization;
+
namespace System.ComponentModel {
+ [TypeConverter (typeof (System.ComponentModel.ComponentConverter)),
+ //FIXME: The compiler complains about the same type of Attribute
applied two times, but according to docs this class HAS the same type of
attribute applied two times
+ // also this compiled without problems in MS.Net 1.0 but does no longer
in 1.1
+ //Designer ("System.Windows.Forms.Design.ComponentDocumentDesigner,
System.Design, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof
(System.ComponentModel.Design.IRootDesigner)),
+ Designer ("System.ComponentModel.Design.ComponentDesigner,
System.Design, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof
(System.ComponentModel.Design.IDesigner)),
+ RootDesignerSerializer
("System.ComponentModel.Design.Serialization.RootCodeDomSerializer,
System.Design, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a",
"System.ComponentModel.Design.Serialization.CodeDomSerializer,
System.Design, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", true)]
public interface IComponent : IDisposable {
ISite Site {
Index: ImmutableObjectAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ImmutableObjectAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 ImmutableObjectAttribute.cs
--- ImmutableObjectAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ImmutableObjectAttribute.cs 12 Jun 2003 12:50:23 -0000
@@ -2,50 +2,53 @@
// System.ComponentModel.ImmutableObjectAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.All)]
- public sealed class ImmutableObjectAttribute : Attribute
+ public sealed class ImmutableObjectAttribute : Attribute
{
- public static readonly ImmutableObjectAttribute No;
- public static readonly ImmutableObjectAttribute Yes;
- [MonoTODO]
+ private bool immutable;
+
+ public static readonly ImmutableObjectAttribute Default = new
ImmutableObjectAttribute (false);
+ public static readonly ImmutableObjectAttribute No = new
ImmutableObjectAttribute (false);
+ public static readonly ImmutableObjectAttribute Yes = new
ImmutableObjectAttribute (true);
+
+
public ImmutableObjectAttribute (bool immutable)
{
+ this.immutable=immutable;
}
public bool Immutable {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return this.immutable; }
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is ImmutableObjectAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((ImmutableObjectAttribute) obj).Immutable.Equals
(immutable);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
+ return immutable.GetHashCode ();
}
- [MonoTODO]
public override bool IsDefaultAttribute()
{
- throw new NotImplementedException();
+ return Equals (Default);
}
- [MonoTODO]
- ~ImmutableObjectAttribute()
- {
- }
}
}
Index: InheritanceAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/InheritanceAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 InheritanceAttribute.cs
--- InheritanceAttribute.cs 29 Mar 2003 13:01:31 -0000 1.1
+++ InheritanceAttribute.cs 12 Jun 2003 12:50:23 -0000
@@ -1,66 +1,71 @@
//
-// System.ComponentModel.Design.InheritanceAttribute
+// System.ComponentModel.InheritanceAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
-namespace System.ComponentModel.Design
+namespace System.ComponentModel
{
- [AttributeUsage(AttributeTargets.Property |
- AttributeTargets.Field
- | AttributeTargets.Event)]
- public sealed class InheritanceAttribute : Attribute
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Event)]
+ public sealed class InheritanceAttribute : Attribute
{
- [MonoTODO]
+
+ private InheritanceLevel level;
+
+ public static readonly InheritanceAttribute Default = new
InheritanceAttribute ();
+ public static readonly InheritanceAttribute Inherited = new
InheritanceAttribute (InheritanceLevel.Inherited);
+ public static readonly InheritanceAttribute InheritedReadOnly = new
InheritanceAttribute (InheritanceLevel.InheritedReadOnly);
+ public static readonly InheritanceAttribute NotInherited = new
InheritanceAttribute (InheritanceLevel.NotInherited);
+
+
public InheritanceAttribute()
{
+ this.level = InheritanceLevel.NotInherited;
}
- [MonoTODO]
+
public InheritanceAttribute (InheritanceLevel inheritanceLevel)
{
+ this.level = inheritanceLevel;
}
- public static readonly InheritanceAttribute Default;
- public static readonly InheritanceAttribute Inherited;
- public static readonly InheritanceAttribute InheritedReadOnly;
- public static readonly InheritanceAttribute NotInherited;
-
+
public InheritanceLevel InheritanceLevel {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return level; }
}
- [MonoTODO]
- public override bool Equals (object value)
+
+ public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is InheritanceAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((InheritanceAttribute) obj).InheritanceLevel.Equals
(level);
}
- [MonoTODO]
+
public override int GetHashCode()
{
- throw new NotImplementedException();
+ return level.GetHashCode ();
}
- [MonoTODO]
+
public override bool IsDefaultAttribute()
{
- throw new NotImplementedException();
+ return Equals (Default);
}
- [MonoTODO]
+
public override string ToString()
{
- throw new NotImplementedException();
+ return this.level.ToString ();
}
- [MonoTODO]
- ~InheritanceAttribute()
- {
- }
}
}
Index: InheritanceLevel.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/InheritanceLevel.cs,v
retrieving revision 1.1
diff -u -r1.1 InheritanceLevel.cs
--- InheritanceLevel.cs 29 Mar 2003 13:01:31 -0000 1.1
+++ InheritanceLevel.cs 12 Jun 2003 12:50:23 -0000
@@ -1,16 +1,18 @@
//
-// System.ComponentModel.Design.InheritanceLevel
+// System.ComponentModel.InheritanceLevel
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
-namespace System.ComponentModel.Design
+namespace System.ComponentModel
{
[Serializable]
- public enum InheritanceLevel
+ public enum InheritanceLevel
{
Inherited,
InheritedReadOnly,
Index: InstallerTypeAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/InstallerTypeAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 InstallerTypeAttribute.cs
--- InstallerTypeAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ InstallerTypeAttribute.cs 12 Jun 2003 12:50:24 -0000
@@ -2,46 +2,57 @@
// System.ComponentModel.InstallerTypeAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.Class)]
- public class InstallerTypeAttribute : Attribute
+ public class InstallerTypeAttribute : Attribute
{
- [MonoTODO]
+
+ private Type installer;
+
public InstallerTypeAttribute (string typeName)
{
+ // MS behavior
+ try
+ {
+ this.installer = Type.GetType (typeName);
+ }
+ catch
+ {
+ this.installer = null;
+ }
}
- [MonoTODO]
public InstallerTypeAttribute (Type installerType)
{
+ this.installer = installerType;
}
public virtual Type InstallerType {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return installer; }
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is InstallerTypeAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((InstallerTypeAttribute) obj).InstallerType.Equals
(installer);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~InstallerTypeAttribute()
- {
+ if (installer == null)
+ return 0;
+ return installer.GetHashCode ();
}
}
}
Index: Int16Converter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/Int16Converter.cs,v
retrieving revision 1.1
diff -u -r1.1 Int16Converter.cs
--- Int16Converter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ Int16Converter.cs 12 Jun 2003 12:50:24 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.Int16Converter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class Int16Converter : BaseNumberConverter
- {
- [MonoTODO]
- public Int16Converter()
- {
- }
-
- [MonoTODO]
- ~Int16Converter()
- {
- }
- }
+ public class Int16Converter : BaseNumberConverter
+ {
+ public Int16Converter()
+ {
+ InnerType = typeof (Int16);
+ }
+ }
}
Index: Int32Converter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/Int32Converter.cs,v
retrieving revision 1.1
diff -u -r1.1 Int32Converter.cs
--- Int32Converter.cs 2 Nov 2002 20:29:17 -0000 1.1
+++ Int32Converter.cs 12 Jun 2003 12:50:24 -0000
@@ -1,10 +1,21 @@
//
// System.ComponentModel.Int32Converter
//
+// Authors:
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
-namespace System.ComponentModel {
- public class Int32Converter : BaseNumberConverter {
-
- }
+namespace System.ComponentModel
+{
+ public class Int32Converter : BaseNumberConverter
+ {
+ public Int32Converter()
+ {
+ InnerType = typeof (Int32);
+ }
+ }
}
Index: Int64Converter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/Int64Converter.cs,v
retrieving revision 1.1
diff -u -r1.1 Int64Converter.cs
--- Int64Converter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ Int64Converter.cs 12 Jun 2003 12:50:24 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.Int64Converter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class Int64Converter : BaseNumberConverter
- {
- [MonoTODO]
- public Int64Converter()
- {
- }
-
- [MonoTODO]
- ~Int64Converter()
- {
- }
- }
+ public class Int64Converter : BaseNumberConverter
+ {
+ public Int64Converter()
+ {
+ InnerType = typeof (Int64);
+ }
+ }
}
Index: InvalidEnumArgumentException.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs
,v
retrieving revision 1.1
diff -u -r1.1 InvalidEnumArgumentException.cs
--- InvalidEnumArgumentException.cs 2 Nov 2002 21:07:40 -0000 1.1
+++ InvalidEnumArgumentException.cs 12 Jun 2003 12:50:24 -0000
@@ -1,42 +1,36 @@
//
// System.ComponentModel.InvalidEnumArgumentException.cs
//
-// Author:
+// Authors:
// Duncan Mak (duncan at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
using System;
namespace System.ComponentModel
{
- [Serializable]
+
public class InvalidEnumArgumentException : ArgumentException
{
- string msg = String.Empty;
-
- public InvalidEnumArgumentException () : base ()
- {
- }
- public InvalidEnumArgumentException (string message)
+ public InvalidEnumArgumentException ()
+ : base ()
{
- msg = message;
}
- public InvalidEnumArgumentException (string argumentName, int
invalidValue, Type enumClass)
+ public InvalidEnumArgumentException (string message)
+ : base (message)
{
- msg = argumentName + " is invalid because this value, " + invalidValue +
" is not of type " + enumClass.Name;
}
- public override string Message {
- get {
- if (ParamName == String.Empty)
- return msg;
- else
- return ParamName + ": " + msg;
- }
+ public InvalidEnumArgumentException (string argumentName, int
invalidValue, Type enumClass)
+ : base (argumentName + " is invalid because this value, " +
invalidValue +
+ " is not of type " + enumClass.Name, argumentName)
+ {
}
}
}
Index: LicenseProviderAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/LicenseProviderAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 LicenseProviderAttribute.cs
--- LicenseProviderAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ LicenseProviderAttribute.cs 12 Jun 2003 12:50:26 -0000
@@ -2,59 +2,71 @@
// System.ComponentModel.LicenseProviderAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.Class)]
- public sealed class LicenseProviderAttribute : Attribute
+ public sealed class LicenseProviderAttribute : Attribute
{
- [MonoTODO]
+
+ private Type Provider;
+
+ public static readonly LicenseProviderAttribute Default = new
LicenseProviderAttribute ();
+
public LicenseProviderAttribute()
{
+ this.Provider = null;
}
- [MonoTODO]
public LicenseProviderAttribute (string typeName)
{
- throw new NotImplementedException();
+ try
+ {
+ this.Provider = Type.GetType (typeName);
+ }
+ catch
+ {
+ this.Provider = null;
+ }
}
- [MonoTODO]
public LicenseProviderAttribute (Type type)
{
- throw new NotImplementedException();
+ this.Provider = type;
}
- [MonoTODO]
public Type LicenseProvider {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return Provider; }
}
public override object TypeId {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get
+ {
+ // Seems to be MS implementation
+ return (base.ToString() + Provider.ToString());
+ }
}
- [MonoTODO]
- public override bool Equals (object value)
- {
- throw new NotImplementedException();
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LicenseProviderAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((LicenseProviderAttribute) obj).LicenseProvider.Equals
(Provider);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~LicenseProviderAttribute()
- {
+ if (Provider == null)
+ return 0;
+ return Provider.GetHashCode ();
}
}
}
Index: ListBindableAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 ListBindableAttribute.cs
--- ListBindableAttribute.cs 4 Nov 2002 20:11:42 -0000 1.1
+++ ListBindableAttribute.cs 12 Jun 2003 12:50:27 -0000
@@ -3,8 +3,10 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
@@ -14,29 +16,23 @@
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited =
true)]
public sealed class ListBindableAttribute : Attribute
{
- public static readonly ListBindableAttribute Default = new
ListBindableAttribute (true, true);
- public static readonly ListBindableAttribute No = new
ListBindableAttribute (false, true);
- public static readonly ListBindableAttribute Yes = new
ListBindableAttribute (true, true);
+ public static readonly ListBindableAttribute Default = new
ListBindableAttribute (true);
+ public static readonly ListBindableAttribute No = new
ListBindableAttribute (false);
+ public static readonly ListBindableAttribute Yes = new
ListBindableAttribute (true);
- bool deflt;
bool bindable;
-
- private ListBindableAttribute (bool listBindable, bool deflt)
- {
- this.deflt = deflt;
- bindable = listBindable;
- }
public ListBindableAttribute (bool listBindable)
{
- deflt = false;
- bindable = true;
+ bindable = listBindable;
}
public ListBindableAttribute (BindableSupport flags)
{
- bindable = (flags == BindableSupport.Yes);
- deflt = (flags == BindableSupport.Default);
+ if (flags == BindableSupport.No)
+ bindable = false;
+ else
+ bindable = true;
}
public override bool Equals (object obj)
@@ -44,18 +40,17 @@
if (!(obj is ListBindableAttribute))
return false;
- return (((ListBindableAttribute) obj).bindable == bindable &&
- ((ListBindableAttribute) obj).deflt == deflt);
+ return ((ListBindableAttribute) obj).ListBindable.Equals (bindable);
}
public override int GetHashCode ()
{
- return base.GetHashCode ();
+ return bindable.GetHashCode ();
}
public override bool IsDefaultAttribute ()
{
- return deflt;
+ return Equals (Default);
}
public bool ListBindable
Index: LocalizableAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 LocalizableAttribute.cs
--- LocalizableAttribute.cs 27 Oct 2001 19:38:07 -0000 1.1
+++ LocalizableAttribute.cs 12 Jun 2003 12:50:28 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.LocalizableAttribute.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
//
@@ -14,16 +16,13 @@
[AttributeUsage (AttributeTargets.Property)]
public sealed class LocalizableAttribute : Attribute {
- bool localizable;
+
+ private bool localizable;
- public static readonly LocalizableAttribute No;
- public static readonly LocalizableAttribute Yes;
+ public static readonly LocalizableAttribute Default = new
LocalizableAttribute (false);
+ public static readonly LocalizableAttribute No = new LocalizableAttribute
(false);
+ public static readonly LocalizableAttribute Yes = new
LocalizableAttribute (true);
- static LocalizableAttribute ()
- {
- No = new LocalizableAttribute (false);
- Yes = new LocalizableAttribute (false);
- }
public LocalizableAttribute (bool localizable)
{
@@ -35,6 +34,24 @@
return localizable;
}
}
-
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LocalizableAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((LocalizableAttribute) obj).IsLocalizable.Equals
(localizable);
+ }
+
+ public override int GetHashCode ()
+ {
+ return localizable.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
}
}
Index: MarshalByValueComponent.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs,v
retrieving revision 1.4
diff -u -r1.4 MarshalByValueComponent.cs
--- MarshalByValueComponent.cs 14 Mar 2003 07:00:24 -0000 1.4
+++ MarshalByValueComponent.cs 12 Jun 2003 12:50:28 -0000
@@ -1,22 +1,30 @@
//
// System.ComponentModel.MarshalByValueComponent.cs
//
-// Author:
-// Rodrigo Moya (rodrigo at ximian.com)
+// Authors:
+// Rodrigo Moya (rodrigo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc
+// (C) 2003 Andreas Nahr
//
using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
namespace System.ComponentModel
{
/// <summary>
/// Implements IComponent and provides the base implementation for
remotable components that are marshaled by value (a copy of the serialized
object is passed).
/// </summary>
+ [DesignerCategory ("Component"), TypeConverter (typeof
(ComponentConverter)),
+ Designer ("System.Windows.Forms.Design.ComponentDocumentDesigner,
System.Design, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof (IRootDesigner))]
public class MarshalByValueComponent : IComponent, IDisposable,
IServiceProvider
{
- EventHandlerList eventList;
+ private EventHandlerList eventList;
+ private ISite mySite;
+ private object disposedEvent = new object ();
public MarshalByValueComponent ()
{
@@ -49,33 +57,43 @@
return null;
}
+ [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
public virtual IContainer Container {
- [MonoTODO]
get {
- return null;
+ if (mySite == null)
+ return null;
+ return mySite.Container;
}
}
+ [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
public virtual bool DesignMode {
- [MonoTODO]
- get {
- return false;
+ get
+ {
+ if (mySite == null)
+ return false;
+ return mySite.DesignMode;
}
}
+ [Browsable (false), DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
public virtual ISite Site {
- [MonoTODO]
get {
- // TODO: need to get Site
- return null;
+ return mySite;
}
- [MonoTODO]
set {
- // TODO: need to set Site
+ mySite = value;
}
}
+ public override string ToString ()
+ {
+ if (mySite == null)
+ return GetType ().ToString ();
+ return String.Format ("{0} [{1}]", mySite.Name, GetType
().ToString ());
+ }
+
protected EventHandlerList Events {
get {
if (eventList == null)
@@ -85,6 +103,16 @@
}
}
- public event EventHandler Disposed;
+ public event EventHandler Disposed
+ {
+ add
+ {
+ Events.AddHandler (disposedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler (disposedEvent, value);
+ }
+ }
}
}
Index: MemberDescriptor.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/MemberDescriptor.cs,v
retrieving revision 1.4
diff -u -r1.4 MemberDescriptor.cs
--- MemberDescriptor.cs 20 Jul 2002 08:39:12 -0000 1.4
+++ MemberDescriptor.cs 12 Jun 2003 12:50:30 -0000
@@ -1,120 +1,217 @@
//
// System.ComponentModel.MemberDescriptor.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
-namespace System.ComponentModel {
-
- public abstract class MemberDescriptor {
- string name;
- Attribute [] attrs;
- AttributeCollection attrCollection;
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel
+{
+
+ [ComVisible (true)]
+ public abstract class MemberDescriptor
+ {
+
+ private string name;
+ private string displayName;
+ private Attribute [] attrs;
+ private AttributeCollection attrCollection;
- protected MemberDescriptor (string name, Attribute [] attrs)
- {
- this.name = name;
- this.attrs = attrs;
- }
-
- protected MemberDescriptor (MemberDescriptor reference, Attribute []
attrs)
- {
- name = reference.name;
- this.attrs = attrs;
- }
-
- protected MemberDescriptor (string name)
- {
- this.name = name;
- }
-
- protected MemberDescriptor (MemberDescriptor reference)
- {
- name = reference.name;
- attrs = reference.attrs;
- }
-
- protected virtual Attribute [] AttributeArray {
- get {
- return attrs;
- }
-
- set {
- attrs = value;
- }
- }
-
- public virtual AttributeCollection Attributes
- {
- get {
- if (attrCollection == null)
- attrCollection = new AttributeCollection (attrs);
- return attrCollection;
- }
- }
+ protected MemberDescriptor (string name, Attribute [] attrs)
+ {
+ this.name = name;
+ this.displayName = name;
+ this.attrs = attrs;
+ }
+
+ protected MemberDescriptor (MemberDescriptor reference, Attribute
[] attrs)
+ {
+ name = reference.name;
+ this.displayName = name;
+ this.attrs = attrs;
+ }
+
+ protected MemberDescriptor (string name)
+ {
+ this.name = name;
+ this.displayName = name;
+ }
+
+ protected MemberDescriptor (MemberDescriptor reference)
+ {
+ name = reference.name;
+ this.displayName = name;
+ attrs = reference.attrs;
+ }
+
+ protected virtual Attribute [] AttributeArray
+ {
+ get
+ {
+ return attrs;
+ }
+
+ set
+ {
+ attrs = value;
+ }
+ }
+
+ [MonoTODO]
+ protected virtual void FillAttributes(System.Collections.IList
attributeList)
+ {
+ // LAMESPEC/FIXME - I don't think this is correct, but didn't
really understand
+ // what this sub is good for
+ attributeList = this.attrs;
+ return;
+ }
+
+ public virtual AttributeCollection Attributes
+ {
+ get
+ {
+ if (attrCollection == null)
+ attrCollection = CreateAttributeCollection ();
+ return attrCollection;
+ }
+ }
+
+ protected virtual AttributeCollection CreateAttributeCollection()
+ {
+ return new AttributeCollection (attrs);
+ }
- public virtual string Category {
- get {
- return ((CategoryAttribute) Attributes [typeof
(CategoryAttribute)]).Category;
- }
- }
-
- public virtual string Description {
- get {
- foreach (Attribute attr in attrs){
- if (attr is DescriptionAttribute)
- return ((DescriptionAttribute) attr).Description;
- }
-
- return "";
- }
- }
-
- public virtual bool DesignTimeOnly {
- get {
- foreach (Attribute attr in attrs){
- if (attr is DesignOnlyAttribute)
- return ((DesignOnlyAttribute) attr).IsDesignOnly;
- }
-
- return false;
- }
- }
-
- //
- // FIXME: Is there any difference between DisplayName and Name?
- //
- [MonoTODO ("Does this diff from Name ?")]
- public virtual string DisplayName {
- get {
- return name;
- }
- }
-
- public virtual string Name {
- get {
- return name;
- }
- }
-
- public virtual bool IsBrowsable {
- get {
- foreach (Attribute attr in attrs){
- if (attr is BrowsableAttribute)
- return ((BrowsableAttribute) attr).Browsable;
- }
-
- return false;
- }
- }
-
- protected virtual int NameHashCode {
- get {
- return name.GetHashCode ();
- }
- }
- }
+ public virtual string Category
+ {
+ get
+ {
+ return ((CategoryAttribute) Attributes [typeof
(CategoryAttribute)]).Category;
+ }
+ }
+
+ public virtual string Description
+ {
+ get
+ {
+ foreach (Attribute attr in attrs)
+ {
+ if (attr is DescriptionAttribute)
+ return ((DescriptionAttribute) attr).Description;
+ }
+ return "";
+ }
+ }
+
+ public virtual bool DesignTimeOnly
+ {
+ get
+ {
+ foreach (Attribute attr in attrs)
+ {
+ if (attr is DesignOnlyAttribute)
+ return ((DesignOnlyAttribute) attr).IsDesignOnly;
+ }
+
+ return false;
+ }
+ }
+
+ public virtual string DisplayName
+ {
+ get
+ {
+ return displayName;
+ }
+ }
+
+ public virtual string Name
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ public virtual bool IsBrowsable
+ {
+ get
+ {
+ foreach (Attribute attr in attrs)
+ {
+ if (attr is BrowsableAttribute)
+ return ((BrowsableAttribute) attr).Browsable;
+ }
+
+ return false;
+ }
+ }
+
+ protected virtual int NameHashCode
+ {
+ get
+ {
+ return name.GetHashCode ();
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return name.GetHashCode ();
+ }
+
+ [MonoTODO ("Probably not correctly implemented (too harsh?)")]
+ public override bool Equals(object obj)
+ {
+ if (!(obj is MemberDescriptor))
+ return false;
+ if (obj == this)
+ return true;
+ return (((MemberDescriptor) obj).AttributeArray == attrs) &&
+ (((MemberDescriptor) obj).Attributes == attrCollection) &&
+ (((MemberDescriptor) obj).DisplayName == displayName) &&
+ (((MemberDescriptor) obj).Name == name);
+ }
+
+ protected static ISite GetSite(object component)
+ {
+ if (component is Component)
+ return ((Component) component).Site;
+ else
+ return null;
+ }
+
+ [MonoTODO]
+ protected static object GetInvokee(Type componentClass, object
component)
+ {
+ // FIXME WHAT should that do???
+ throw new NotImplementedException ();
+ }
+
+ protected static MethodInfo FindMethod(Type componentClass, string
name,
+ Type[ ] args, Type returnType)
+ {
+ return FindMethod (componentClass, name, args, returnType,
true);
+ }
+
+ protected static MethodInfo FindMethod(Type componentClass, string
name,
+ Type[ ] args, Type returnType, bool publicOnly)
+ {
+ BindingFlags bf;
+ if (publicOnly == true)
+ bf = BindingFlags.Public;
+ else
+ bf = BindingFlags.NonPublic | BindingFlags.Public;
+ // FIXME returnType is not taken into account. AFAIK methods
are not allowed to only
+ // differ by return type anyway
+ return componentClass.GetMethod (name, bf, null,
CallingConventions.Any, args, null);
+ }
+ }
}
Index: MergablePropertyAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/MergablePropertyAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 MergablePropertyAttribute.cs
--- MergablePropertyAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ MergablePropertyAttribute.cs 12 Jun 2003 12:50:30 -0000
@@ -2,50 +2,51 @@
// System.ComponentModel.MergablePropertyAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.All)]
- public sealed class MergablePropertyAttribute : Attribute
+ public sealed class MergablePropertyAttribute : Attribute
{
- public static readonly MergablePropertyAttribute No;
- public static readonly MergablePropertyAttribute Yes;
- [MonoTODO]
+ private bool mergable;
+
+ public static readonly MergablePropertyAttribute Default = new
MergablePropertyAttribute (true);
+ public static readonly MergablePropertyAttribute No = new
MergablePropertyAttribute (false);
+ public static readonly MergablePropertyAttribute Yes = new
MergablePropertyAttribute (true);
+
public MergablePropertyAttribute (bool allowMerge)
{
+ this.mergable = allowMerge;
}
public bool AllowMerge {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return mergable; }
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is MergablePropertyAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((MergablePropertyAttribute) obj).AllowMerge.Equals
(mergable);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
+ return mergable.GetHashCode ();
}
- [MonoTODO]
public override bool IsDefaultAttribute()
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~MergablePropertyAttribute()
- {
+ return Equals (Default);
}
}
}
Index: NotifyParentPropertyAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.c
s,v
retrieving revision 1.1
diff -u -r1.1 NotifyParentPropertyAttribute.cs
--- NotifyParentPropertyAttribute.cs 23 Jul 2002 03:20:22 -0000 1.1
+++ NotifyParentPropertyAttribute.cs 12 Jun 2003 12:50:30 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.NotifyParentPropertyAttribute.cs
//
-// Author:
-// Tim Coleman (tim at timcoleman.com)
+// Authors:
+// Tim Coleman (tim at timcoleman.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// Copyright (C) Tim Coleman, 2002
+// (C) 2003 Andreas Nahr
//
//
@@ -14,13 +16,13 @@
#region Fields
- bool notifyParent;
+ private bool notifyParent;
#endregion // Fields
+ public static readonly NotifyParentPropertyAttribute Default = new
NotifyParentPropertyAttribute (false);
public static readonly NotifyParentPropertyAttribute No = new
NotifyParentPropertyAttribute (false);
public static readonly NotifyParentPropertyAttribute Yes = new
NotifyParentPropertyAttribute (true);
- public static readonly NotifyParentPropertyAttribute Default = new
NotifyParentPropertyAttribute (false);
#region Constructors
@@ -41,22 +43,23 @@
#region Methods
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException ();
+ if (!(obj is NotifyParentPropertyAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((NotifyParentPropertyAttribute)
obj).NotifyParent.Equals (notifyParent);
}
- [MonoTODO]
public override int GetHashCode ()
{
- throw new NotImplementedException ();
+ return notifyParent.GetHashCode ();
}
- [MonoTODO]
public override bool IsDefaultAttribute ()
{
- throw new NotImplementedException ();
+ return Equals (Default);
}
#endregion // Methods
Index: ParenthesizePropertyNameAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ParenthesizePropertyNameAttribu
te.cs,v
retrieving revision 1.1
diff -u -r1.1 ParenthesizePropertyNameAttribute.cs
--- ParenthesizePropertyNameAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ParenthesizePropertyNameAttribute.cs 12 Jun 2003 12:50:31 -0000
@@ -2,54 +2,56 @@
// System.ComponentModel.ParenthesizePropertyNameAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.All)]
- public sealed class ParenthesizePropertyNameAttribute : Attribute
+ public sealed class ParenthesizePropertyNameAttribute : Attribute
{
- public static readonly ParenthesizePropertyNameAttribute Default;
- [MonoTODO]
+ private bool parenthesis;
+
+ public static readonly ParenthesizePropertyNameAttribute Default = new
ParenthesizePropertyNameAttribute();
+
+
public ParenthesizePropertyNameAttribute()
{
+ this.parenthesis = false;
}
- [MonoTODO]
public ParenthesizePropertyNameAttribute (bool needParenthesis)
{
+ this.parenthesis = needParenthesis;
}
public bool NeedParenthesis {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return parenthesis; }
}
- [MonoTODO]
public override bool Equals (object o)
{
- throw new NotImplementedException();
+ if (!(o is ParenthesizePropertyNameAttribute))
+ return false;
+ if (o == this)
+ return true;
+ return ((ParenthesizePropertyNameAttribute)
o).NeedParenthesis.Equals (parenthesis);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
+ return parenthesis.GetHashCode ();
}
- [MonoTODO]
public override bool IsDefaultAttribute()
{
- throw new NotImplementedException();
+ return Equals (Default);
}
- [MonoTODO]
- ~ParenthesizePropertyNameAttribute()
- {
- }
}
}
Index: PropertyDescriptor.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs,v
retrieving revision 1.5
diff -u -r1.5 PropertyDescriptor.cs
--- PropertyDescriptor.cs 29 Oct 2002 21:52:54 -0000 1.5
+++ PropertyDescriptor.cs 12 Jun 2003 12:50:32 -0000
@@ -1,17 +1,22 @@
//
// System.ComponentModel.PropertyDescriptor.cs
//
-// Author:
-// Miguel de Icaza (miguel at ximian.com)
+// Authors:
+// Miguel de Icaza (miguel at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
+// (C) 2003 Andreas Nahr
//
using System;
using System.Collections;
+using System.Reflection;
+using System.Runtime.InteropServices;
namespace System.ComponentModel {
+ [ComVisible (true)]
public abstract class PropertyDescriptor : MemberDescriptor {
protected PropertyDescriptor (MemberDescriptor reference)
@@ -95,6 +100,12 @@
notifiers [component] = handler;
}
+ [MonoTODO]
+ public virtual void RemoveValueChanged(object component,
System.EventHandler handler)
+ {
+ throw new NotImplementedException();
+ }
+
protected virtual void OnValueChanged (object component, EventArgs e)
{
if (notifiers == null)
@@ -117,5 +128,62 @@
public abstract bool CanResetValue (object component);
public abstract bool ShouldSerializeValue (object component);
+
+ protected object CreateInstance(System.Type type)
+ {
+ return Assembly.GetExecutingAssembly ().CreateInstance
(type.Name);
+ }
+
+ [MonoTODO ("Not correctly implemented")]
+ public override bool Equals(object obj)
+ {
+ if (!(obj is PropertyDescriptor))
+ return false;
+ if (obj == this)
+ return true;
+ return (((PropertyDescriptor) obj).AttributeArray ==
this.AttributeArray) &&
+ (((PropertyDescriptor) obj).Attributes == this.Attributes)
&&
+ (((PropertyDescriptor) obj).DisplayName ==
this.DisplayName) &&
+ (((PropertyDescriptor) obj).Name == this.Name);
+ }
+
+ public PropertyDescriptorCollection GetChildProperties()
+ {
+ return GetChildProperties (null, null);
+ }
+
+ public PropertyDescriptorCollection GetChildProperties(object
instance)
+ {
+ return GetChildProperties (instance, null);
+ }
+
+ public PropertyDescriptorCollection GetChildProperties(Attribute[]
filter)
+ {
+ return GetChildProperties (null, filter);
+ }
+
+ [MonoTODO ("Incorrect implementation")]
+ public override int GetHashCode()
+ {
+ return Name.GetHashCode ();
+ }
+
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection
GetChildProperties(object instance,
+ Attribute[] filter)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public virtual object GetEditor(Type editorBaseType)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected Type GetTypeFromName(string typeName)
+ {
+ return Type.GetType (typeName);
+ }
}
}
Index: PropertyDescriptorCollection.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
,v
retrieving revision 1.4
diff -u -r1.4 PropertyDescriptorCollection.cs
--- PropertyDescriptorCollection.cs 28 Jul 2002 18:36:22 -0000 1.4
+++ PropertyDescriptorCollection.cs 12 Jun 2003 12:50:33 -0000
@@ -1,283 +1,253 @@
+//
+// System.ComponentModel.PropertyDescriptorCollection.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo at ximian.com)
+// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// (C) Rodrigo Moya, 2002
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
-// System.ComponentModel.PropertyDescriptorCollection.cs
-//
-// Authors:
-// Rodrigo Moya (rodrigo at ximian.com)
-// Gonzalo Paniagua Javier (gonzalo at ximian.com)
-//
-// (C) Rodrigo Moya, 2002
-// (c) 2002 Ximian, Inc. (http://www.ximian.com)
-//
-
using System.Collections;
-
namespace System.ComponentModel
-{
- /// <summary>
- /// Represents a collection of PropertyDescriptor objects.
- /// </summary>
+{
+ /// <summary>
+ /// Represents a collection of PropertyDescriptor objects.
+ /// </summary>
+ //[DefaultMember ("Item")]
public class PropertyDescriptorCollection : IList, ICollection,
IEnumerable, IDictionary
- {
- public static readonly PropertyDescriptorCollection Empty =
- new PropertyDescriptorCollection (null);
-
- ArrayList properties;
+ {
+ public static readonly PropertyDescriptorCollection Empty =
+ new PropertyDescriptorCollection (null);
+ ArrayList properties;
bool readOnly;
-
- public PropertyDescriptorCollection (PropertyDescriptor[] properties)
- {
- this.properties = new ArrayList ();
- if (properties == null)
- return;
-
- foreach (PropertyDescriptor p in properties)
- this.properties.Add (p);
- }
-
- public int Add (PropertyDescriptor value)
- {
- properties.Add (value);
- return properties.Count - 1;
- }
-
- int IList.Add (object value)
- {
- return Add ((PropertyDescriptor) value);
- }
-
- void IDictionary.Add (object key, object value)
- {
- Add ((PropertyDescriptor) value);
- }
-
- public void Clear ()
- {
- properties.Clear ();
- }
-
- void IList.Clear ()
- {
- Clear ();
- }
-
- void IDictionary.Clear ()
- {
- Clear ();
- }
-
- public bool Contains (PropertyDescriptor value)
- {
- return properties.Contains (value);
- }
-
- bool IList.Contains (object value)
- {
- return Contains ((PropertyDescriptor) value);
- }
-
- bool IDictionary.Contains (object value)
- {
- return Contains ((PropertyDescriptor) value);
- }
-
- public void CopyTo (Array array, int index)
- {
- properties.CopyTo (array, index);
- }
-
- public virtual PropertyDescriptor Find (string name, bool ignoreCase)
- {
- foreach (PropertyDescriptor p in properties) {
- if (0 == String.Compare (name, p.Name, ignoreCase))
- return p;
- }
- return null;
- }
-
- public virtual IEnumerator GetEnumerator ()
- {
- return properties.GetEnumerator ();
- }
-
- [MonoTODO]
- IDictionaryEnumerator IDictionary.GetEnumerator ()
- {
- throw new NotImplementedException ();
- }
-
- public int IndexOf (PropertyDescriptor value)
- {
- return properties.IndexOf (value);
- }
-
- int IList.IndexOf (object value)
- {
- return IndexOf ((PropertyDescriptor) value);
- }
-
- [MonoTODO]
- public void Insert (int index, PropertyDescriptor value)
- {
- throw new NotImplementedException ();
- }
-
- void IList.Insert (int index, object value)
- {
- Insert (index, (PropertyDescriptor) value);
- }
-
- public void Remove (PropertyDescriptor value)
- {
- properties.Remove (value);
- }
-
- void IDictionary.Remove (object value)
- {
- Remove ((PropertyDescriptor) value);
- }
-
- void IList.Remove (object value)
- {
- Remove ((PropertyDescriptor) value);
- }
-
- public void RemoveAt (int index)
- {
- properties.RemoveAt (index);
- }
-
- void IList.RemoveAt (int index)
- {
- RemoveAt (index);
- }
-
- [MonoTODO]
- public virtual PropertyDescriptorCollection Sort ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public virtual PropertyDescriptorCollection Sort (IComparer ic)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected void InternalSort (IComparer ic)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected void InternalSort (string [] order)
- {
- throw new NotImplementedException ();
- }
-
- bool IDictionary.IsFixedSize
- {
- get {
- return !readOnly;
- }
- }
-
- bool IList.IsFixedSize
- {
- get {
- return !readOnly;
- }
- }
-
- public bool IsReadOnly
- {
- get {
- return readOnly;
- }
- }
-
- public bool IsSynchronized
- {
- get {
- return false;
- }
- }
-
- public int Count
- {
- get {
- return properties.Count;
- }
- }
-
- object ICollection.SyncRoot
- {
- get {
- return null;
- }
- }
-
- ICollection IDictionary.Keys
- {
- get {
- string [] keys = new string [properties.Count];
- int i = 0;
- foreach (PropertyDescriptor p in properties)
- keys [i++] = p.Name;
- return keys;
- }
- }
-
- ICollection IDictionary.Values
- {
- get {
- return (ICollection) properties.Clone ();
- }
- }
-
- object IDictionary.this [object key]
- {
- get {
- if (!(key is string))
- return null;
- return this [(string) key];
- }
- set {
- if (!(key is string) || (value as PropertyDescriptor) == null)
+
+ public PropertyDescriptorCollection (PropertyDescriptor[] properties)
+ {
+ this.properties = new ArrayList ();
+ if (properties == null)
+ return;
+
+ foreach (PropertyDescriptor p in properties)
+ this.properties.Add (p);
+ }
+ public int Add (PropertyDescriptor value)
+ {
+ properties.Add (value);
+ return properties.Count - 1;
+ }
+ int IList.Add (object value)
+ {
+ return Add ((PropertyDescriptor) value);
+ }
+ void IDictionary.Add (object key, object value)
+ {
+ Add ((PropertyDescriptor) value);
+ }
+ public void Clear ()
+ {
+ properties.Clear ();
+ }
+ void IList.Clear ()
+ {
+ Clear ();
+ }
+ void IDictionary.Clear ()
+ {
+ Clear ();
+ }
+ public bool Contains (PropertyDescriptor value)
+ {
+ return properties.Contains (value);
+ }
+ bool IList.Contains (object value)
+ {
+ return Contains ((PropertyDescriptor) value);
+ }
+ bool IDictionary.Contains (object value)
+ {
+ return Contains ((PropertyDescriptor) value);
+ }
+ public void CopyTo (Array array, int index)
+ {
+ properties.CopyTo (array, index);
+ }
+ public virtual PropertyDescriptor Find (string name, bool ignoreCase)
+ {
+ foreach (PropertyDescriptor p in properties) {
+ if (0 == String.Compare (name, p.Name, ignoreCase))
+ return p;
+ }
+ return null;
+ }
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return properties.GetEnumerator ();
+ }
+ [MonoTODO]
+ IDictionaryEnumerator IDictionary.GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+ public int IndexOf (PropertyDescriptor value)
+ {
+ return properties.IndexOf (value);
+ }
+ int IList.IndexOf (object value)
+ {
+ return IndexOf ((PropertyDescriptor) value);
+ }
+ public void Insert (int index, PropertyDescriptor value)
+ {
Insert (index, value);
+ }
+ void IList.Insert (int index, object value)
+ {
+ Insert (index, (PropertyDescriptor) value);
+ }
+ public void Remove (PropertyDescriptor value)
+ {
+ properties.Remove (value);
+ }
+ void IDictionary.Remove (object value)
+ {
+ Remove ((PropertyDescriptor) value);
+ }
+ void IList.Remove (object value)
+ {
+ Remove ((PropertyDescriptor) value);
+ }
+ public void RemoveAt (int index)
+ {
+ properties.RemoveAt (index);
+ }
+ void IList.RemoveAt (int index)
+ {
+ RemoveAt (index);
+ }
+ public virtual PropertyDescriptorCollection Sort ()
+ {
+ properties.Sort ();
+ return this;
+ }
+ public virtual PropertyDescriptorCollection Sort (IComparer comparer)
+ {
+ properties.Sort (comparer);
+ return this;
+ }
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection Sort (string[] order)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection Sort (string[] order,
IComparer comparer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InternalSort (IComparer ic)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void InternalSort (string [] order)
+ {
+ throw new NotImplementedException ();
+ }
+ bool IDictionary.IsFixedSize
+ {
+ get {
+ return !readOnly;
+ }
+ }
+ bool IList.IsFixedSize
+ {
+ get {
+ return !readOnly;
+ }
+ }
+ public bool IsReadOnly
+ {
+ get {
+ return readOnly;
+ }
+ }
+ public bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+ public int Count
+ {
+ get {
+ return properties.Count;
+ }
+ }
+ object ICollection.SyncRoot
+ {
+ get {
+ return null;
+ }
+ }
+ ICollection IDictionary.Keys
+ {
+ get {
+ string [] keys = new string [properties.Count];
+ int i = 0;
+ foreach (PropertyDescriptor p in properties)
+ keys [i++] = p.Name;
+ return keys;
+ }
+ }
+ ICollection IDictionary.Values
+ {
+ get {
+ return (ICollection) properties.Clone ();
+ }
+ }
+ object IDictionary.this [object key]
+ {
+ get {
+ if (!(key is string))
+ return null;
+ return this [(string) key];
+ }
+ set {
+ if (!(key is string) || (value as PropertyDescriptor) == null)
throw new ArgumentException ();
-
- int idx = properties.IndexOf (value);
- if (idx == -1)
- Add ((PropertyDescriptor) value);
- else
+ int idx = properties.IndexOf (value);
+ if (idx == -1)
+ Add ((PropertyDescriptor) value);
+ else
properties [idx] = value;
-
- }
- }
- public virtual PropertyDescriptor this [string s]
- {
- get {
- return Find (s, false);
- }
- }
-
- object IList.this [int index]
- {
- get {
- return properties [index];
- }
-
- set {
- properties [index] = value;
- }
- }
-
- public virtual PropertyDescriptor this [int index]
- {
- get {
- return (PropertyDescriptor) properties [index];
}
}
- }
+ public virtual PropertyDescriptor this [string s]
+ {
+ get {
+ return Find (s, false);
+ }
+ }
+ object IList.this [int index]
+ {
+ get {
+ return properties [index];
+ }
+ set {
+ properties [index] = value;
+ }
+ }
+ public virtual PropertyDescriptor this [int index]
+ {
+ get {
+ return (PropertyDescriptor) properties [index];
+ }
+ }
+ }
}
Index: PropertyTabAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/PropertyTabAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 PropertyTabAttribute.cs
--- PropertyTabAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ PropertyTabAttribute.cs 12 Jun 2003 12:50:33 -0000
@@ -2,93 +2,121 @@
// System.ComponentModel.PropertyTabAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.All)]
- public class PropertyTabAttribute : Attribute
+ public class PropertyTabAttribute : Attribute
{
- [MonoTODO]
+
+ private Type[] tabs;
+ private PropertyTabScope[] scopes;
+
+
public PropertyTabAttribute()
{
+ tabs = null;
+ scopes = null;
}
- [MonoTODO]
public PropertyTabAttribute (string tabClassName)
{
+ string[] tabArray = {tabClassName};
+ this.InitializeArrays (tabArray, null);
}
- [MonoTODO]
public PropertyTabAttribute (Type tabClass)
{
+ Type[] tabArray = {tabClass};
+ this.InitializeArrays (tabArray, null);
}
- [MonoTODO]
- public PropertyTabAttribute (string tabClassName,
- PropertyTabScope tabScope)
+ public PropertyTabAttribute (string tabClassName, PropertyTabScope
tabScope)
{
+ string[] tabArray = {tabClassName};
+ PropertyTabScope[] scopeArray = {tabScope};
+ this.InitializeArrays (tabArray, scopeArray);
}
- [MonoTODO]
- public PropertyTabAttribute (Type tabClass,
- PropertyTabScope tabScope)
+ public PropertyTabAttribute (Type tabClass, PropertyTabScope tabScope)
{
+ Type[] tabArray = {tabClass};
+ PropertyTabScope[] scopeArray = {tabScope};
+ this.InitializeArrays (tabArray, scopeArray);
}
public Type[] TabClasses {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return tabs; }
}
public PropertyTabScope[] TabScopes {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return scopes; }
}
- [MonoTODO]
public override bool Equals (object other)
{
- throw new NotImplementedException();
+ if (!(other is PropertyTabAttribute))
+ return false;
+ if (other == this)
+ return true;
+ return ((PropertyTabAttribute) other).TabClasses.Equals (tabs)
&&
+ ((PropertyTabAttribute) other).TabScopes.Equals (scopes);
}
- [MonoTODO]
public bool Equals (PropertyTabAttribute other)
{
- throw new NotImplementedException();
+ return this.Equals (other);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
+ int Hash = 0;
+ if (tabs != null)
+ Hash = Hash ^ tabs.GetHashCode ();
+ if (scopes != null)
+ Hash = Hash ^ scopes.GetHashCode ();
+ return Hash;
}
protected string[] TabClassNames {
- [MonoTODO]
- get { throw new NotImplementedException(); }
- }
-
- [MonoTODO]
- protected void InitializeArrays (string[] tabClassNames,
- PropertyTabScope[] tabScopes)
- {
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- protected void InitializeArrays (Type[] tabClasses,
- PropertyTabScope[] tabScopes)
- {
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~PropertyTabAttribute()
- {
+ get
+ {
+ // FIXME untested, maybe wrong
+ string[] tabClassName = (string[]) (Array.CreateInstance
(typeof (string), tabs.Length));
+ for (int x = 0; x < tabs.Length; x++)
+ tabClassName[x] = tabs[x].AssemblyQualifiedName;
+ return tabClassName;
+ }
+ }
+
+ protected void InitializeArrays (string[] tabClassNames,
PropertyTabScope[] tabScopes)
+ {
+ // FIXME untested, maybe wrong
+ Type[] tabClasses = (Type[]) (Array.CreateInstance (typeof
(Type), tabClassNames.Length));
+ for (int x = 0; x < tabClassNames.Length; x++)
+ try
+ {
+ tabClasses[x] = Type.GetType (tabClassNames[x]);
+ }
+ catch
+ {
+ tabClasses[x] = null;
+ }
+ tabs = tabClasses;
+ scopes = tabScopes;
+ }
+
+ protected void InitializeArrays (Type[] tabClasses, PropertyTabScope[]
tabScopes)
+ {
+ // FIXME untested, maybe wrong
+ tabs = tabClasses;
+ scopes = tabScopes;
}
}
}
Index: ProvidePropertyAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ProvidePropertyAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 ProvidePropertyAttribute.cs
--- ProvidePropertyAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ProvidePropertyAttribute.cs 12 Jun 2003 12:50:34 -0000
@@ -2,58 +2,63 @@
// System.ComponentModel.ProvidePropertyAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.Class)]
- public sealed class ProvidePropertyAttribute : Attribute
+ public sealed class ProvidePropertyAttribute : Attribute
{
- [MonoTODO]
- public ProvidePropertyAttribute (string propertyName,
- string receiverTypeName)
+
+ private string Property;
+ private string Receiver;
+
+ public ProvidePropertyAttribute (string propertyName, string
receiverTypeName)
{
+ Property = propertyName;
+ Receiver = receiverTypeName;
}
- [MonoTODO]
- public ProvidePropertyAttribute (string propertyName,
- Type receiverType)
+ public ProvidePropertyAttribute (string propertyName, Type receiverType)
{
+ Property = propertyName;
+ Receiver = receiverType.AssemblyQualifiedName;
}
public string PropertyName {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return Property; }
}
public string ReceiverTypeName {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return Receiver; }
}
public override object TypeId {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get
+ {
+ // seems to be MS implementation
+ return base.TypeId + Property;
+ }
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is ProvidePropertyAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((ProvidePropertyAttribute) obj).PropertyName.Equals
(Property) &&
+ ((ProvidePropertyAttribute) obj).ReceiverTypeName.Equals
(Receiver);
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~ProvidePropertyAttribute()
- {
+ return String.Concat(Property , Receiver).GetHashCode ();
}
}
}
Index: ReadOnlyAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs,v
retrieving revision 1.2
diff -u -r1.2 ReadOnlyAttribute.cs
--- ReadOnlyAttribute.cs 20 Jul 2002 08:39:12 -0000 1.2
+++ ReadOnlyAttribute.cs 12 Jun 2003 12:50:34 -0000
@@ -1,5 +1,5 @@
//
-// ReadOnlyAttribute.cs
+// System.ComponentModel.ReadOnlyAttribute.cs
//
// Author:
// Chris J Breisch (cjbreisch at altavista.net)
@@ -35,7 +35,7 @@
public override int GetHashCode ()
{
- return base.GetHashCode ();
+ return read_only.GetHashCode ();
}
public override bool Equals (object o)
@@ -43,7 +43,7 @@
if (!(o is ReadOnlyAttribute))
return false;
- return (((ReadOnlyAttribute) o).read_only == read_only);
+ return (((ReadOnlyAttribute) o).IsReadOnly.Equals (read_only));
}
public override bool IsDefaultAttribute ()
Index: RecommendedAsConfigurableAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttrib
ute.cs,v
retrieving revision 1.2
diff -u -r1.2 RecommendedAsConfigurableAttribute.cs
--- RecommendedAsConfigurableAttribute.cs 23 Jul 2002 08:47:47 -0000 1.2
+++ RecommendedAsConfigurableAttribute.cs 12 Jun 2003 12:50:34 -0000
@@ -1,65 +1,72 @@
-//
-// System.ComponentModel.RecommendedAsConfigurableAttribute
-//
-// Authors:
-// Tim Coleman (tim at timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-using System;
-
-namespace System.ComponentModel {
- [AttributeUsage (AttributeTargets.Property)]
- public class RecommendedAsConfigurableAttribute : Attribute {
-
- #region Fields
-
- bool recommendedAsConfigurable;
-
- public static readonly RecommendedAsConfigurableAttribute Default = new
RecommendedAsConfigurableAttribute (false);
- public static readonly RecommendedAsConfigurableAttribute No = new
RecommendedAsConfigurableAttribute (false);
- public static readonly RecommendedAsConfigurableAttribute Yes = new
RecommendedAsConfigurableAttribute (true);
-
- #endregion // Fields
-
- #region Constructors
-
- public RecommendedAsConfigurableAttribute (bool
recommendedAsConfigurable)
- {
- this.recommendedAsConfigurable = recommendedAsConfigurable;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public bool RecommendedAsConfigurable {
- get { return recommendedAsConfigurable; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- public override bool Equals (object obj)
- {
- if (!(obj is RecommendedAsConfigurableAttribute))
- return false;
-
- return ((RecommendedAsConfigurableAttribute)
obj).RecommendedAsConfigurable == recommendedAsConfigurable;
- }
-
- [MonoTODO]
- public override int GetHashCode ()
- {
- throw new NotImplementedException ();
- }
-
- public override bool IsDefaultAttribute ()
- {
- return (!recommendedAsConfigurable);
- }
- #endregion // Methods
- }
-}
+//
+// System.ComponentModel.RecommendedAsConfigurableAttribute
+//
+// Authors:
+// Tim Coleman (tim at timcoleman.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// Copyright (C) Tim Coleman, 2002
+// (C) 2003 Andreas Nahr
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public class RecommendedAsConfigurableAttribute : Attribute {
+
+ #region Fields
+
+ private bool recommendedAsConfigurable;
+
+ public static readonly RecommendedAsConfigurableAttribute Default = new
RecommendedAsConfigurableAttribute (false);
+ public static readonly RecommendedAsConfigurableAttribute No = new
RecommendedAsConfigurableAttribute (false);
+ public static readonly RecommendedAsConfigurableAttribute Yes = new
RecommendedAsConfigurableAttribute (true);
+
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public RecommendedAsConfigurableAttribute (bool
recommendedAsConfigurable)
+ {
+ this.recommendedAsConfigurable = recommendedAsConfigurable;
+ }
+
+ #endregion // Constructors
+
+
+ #region Properties
+
+ public bool RecommendedAsConfigurable {
+ get { return recommendedAsConfigurable; }
+ }
+
+ #endregion // Properties
+
+
+ #region Methods
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is RecommendedAsConfigurableAttribute))
+ return false;
+ return ((RecommendedAsConfigurableAttribute)
obj).RecommendedAsConfigurable.Equals (recommendedAsConfigurable);
+ }
+
+
+ public override int GetHashCode ()
+ {
+ return recommendedAsConfigurable.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+
+ #endregion // Methods
+ }
+}
+
Index: RefreshPropertiesAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 RefreshPropertiesAttribute.cs
--- RefreshPropertiesAttribute.cs 4 Nov 2002 20:05:50 -0000 1.1
+++ RefreshPropertiesAttribute.cs 12 Jun 2003 12:50:35 -0000
@@ -1,10 +1,12 @@
//
// System.ComponentModel.RefreshPropertiesAttribute.cs
//
-// Author:
-// Tim Coleman (tim at timcoleman.com)
+// Authors:
+// Tim Coleman (tim at timcoleman.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// Copyright (C) Tim Coleman, 2002
+// (C) 2003 Andreas Nahr
//
//
@@ -41,21 +43,23 @@
#region Methods
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException ();
+ if (!(obj is RefreshPropertiesAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return ((RefreshPropertiesAttribute)
obj).RefreshProperties.Equals (refresh);
}
- [MonoTODO]
public override int GetHashCode ()
{
- throw new NotImplementedException ();
+ return refresh.GetHashCode ();
}
public override bool IsDefaultAttribute ()
{
- return (this == RefreshPropertiesAttribute.Default);
+ return Equals (Default);
}
#endregion // Methods
Index: RunInstallerAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/RunInstallerAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 RunInstallerAttribute.cs
--- RunInstallerAttribute.cs 4 Mar 2003 20:27:43 -0000 1.1
+++ RunInstallerAttribute.cs 12 Jun 2003 12:50:35 -0000
@@ -1,10 +1,12 @@
//
-// System.ComponentModel.RunInstallerAttribute
+// System.ComponentModel.RunInstallerAttribute.cs
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
@@ -30,17 +32,17 @@
if (!(obj is RunInstallerAttribute))
return false;
- return (((RunInstallerAttribute) obj).runInstaller == runInstaller);
+ return ((RunInstallerAttribute) obj).RunInstaller.Equals (runInstaller);
}
public override int GetHashCode ()
{
- return base.GetHashCode ();
+ return runInstaller.GetHashCode ();
}
public override bool IsDefaultAttribute ()
{
- return (runInstaller == false); // false is the Default
+ return Equals (Default);
}
public bool RunInstaller
Index: SByteConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/SByteConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 SByteConverter.cs
--- SByteConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ SByteConverter.cs 12 Jun 2003 12:50:35 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.SByteConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class SByteConverter : BaseNumberConverter
- {
- [MonoTODO]
- public SByteConverter()
- {
- }
-
- [MonoTODO]
- ~SByteConverter()
- {
- }
- }
+ public class SByteConverter : BaseNumberConverter
+ {
+ public SByteConverter()
+ {
+ InnerType = typeof (SByte);
+ }
+ }
}
Index: SingleConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/SingleConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 SingleConverter.cs
--- SingleConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ SingleConverter.cs 12 Jun 2003 12:50:35 -0000
@@ -2,24 +2,20 @@
// System.ComponentModel.SingleConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class SingleConverter : BaseNumberConverter
- {
- [MonoTODO]
- public SingleConverter()
- {
- }
-
- [MonoTODO]
- ~SingleConverter()
- {
- }
-
- }
+ public class SingleConverter : BaseNumberConverter
+ {
+ public SingleConverter()
+ {
+ InnerType = typeof (Single);
+ }
+ }
}
Index: TimeSpanConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/TimeSpanConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 TimeSpanConverter.cs
--- TimeSpanConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ TimeSpanConverter.cs 12 Jun 2003 12:50:35 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.TimeSpanConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,46 +15,59 @@
{
public class TimeSpanConverter : TypeConverter
{
- [MonoTODO]
+
public TimeSpanConverter()
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context,
- Type destinationType)
+ Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ return true;
+ return base.CanConvertTo (context, destinationType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ if (value.GetType() == typeof (string))
+ {
+ string TimeSpanString = (string) value;
+ try
+ {
+ // LAMESPEC Doc says TimeSpan uses Ticks, but MS uses
time format:
+ // [ws][-][d.]hh:mm:ss[.ff][ws]
+ return TimeSpan.Parse (TimeSpanString);
+ }
+ catch
+ {
+ throw new FormatException (TimeSpanString + "is not
valid for a TimeSpan.");
+ }
+ }
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value.GetType() == typeof (TimeSpan))
+ {
+ // LAMESPEC Doc says TimeSpan uses Ticks, but MS
uses time format
+ // [ws][-][d.]hh:mm:ss[.ff][ws]
+ return ((TimeSpan) value).ToString();
+ }
+ return base.ConvertTo (context, culture, value,
destinationType);
}
-
- [MonoTODO]
- ~TimeSpanConverter()
- {
- }
-
}
}
Index: ToolboxItemFilterAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/ToolboxItemFilterAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 ToolboxItemFilterAttribute.cs
--- ToolboxItemFilterAttribute.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ ToolboxItemFilterAttribute.cs 12 Jun 2003 12:50:36 -0000
@@ -2,64 +2,68 @@
// System.ComponentModel.ToolboxItemFilterAttribute
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
[AttributeUsage(AttributeTargets.Class)]
[Serializable]
- public sealed class ToolboxItemFilterAttribute : Attribute
+ public sealed class ToolboxItemFilterAttribute : Attribute
{
- [MonoTODO]
+
+ private string Filter;
+ private ToolboxItemFilterType ItemFilterType;
+
+
public ToolboxItemFilterAttribute (string filterString)
{
+ Filter = filterString;
+ ItemFilterType = ToolboxItemFilterType.Allow;
}
- [MonoTODO]
- public ToolboxItemFilterAttribute (string filterString,
- ToolboxItemFilterType filterType)
+ public ToolboxItemFilterAttribute (string filterString,
ToolboxItemFilterType filterType)
{
+ Filter = filterString;
+ ItemFilterType = filterType;
}
public string FilterString {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return Filter; }
}
public ToolboxItemFilterType FilterType {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return ItemFilterType; }
}
public override object TypeId {
- [MonoTODO]
- get { throw new NotImplementedException(); }
+ get { return base.TypeId + Filter; }
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException();
+ if (!(obj is ToolboxItemFilterAttribute))
+ return false;
+ if (obj == this)
+ return true;
+ return (((ToolboxItemFilterAttribute) obj).FilterString.Equals
(Filter)) &&
+ (((ToolboxItemFilterAttribute) obj).FilterType.Equals
(ItemFilterType));
}
- [MonoTODO]
public override int GetHashCode()
{
- throw new NotImplementedException();
+ return string.Concat (Filter,
ItemFilterType.ToString()).GetHashCode ();
}
- [MonoTODO]
public override bool Match (object obj)
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~ToolboxItemFilterAttribute()
- {
+ if (!(obj is ToolboxItemFilterAttribute))
+ return false;
+ return ((ToolboxItemFilterAttribute) obj).FilterString.Equals
(Filter);
}
}
}
Index: TypeConverter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/TypeConverter.cs,v
retrieving revision 1.9
diff -u -r1.9 TypeConverter.cs
--- TypeConverter.cs 23 Aug 2002 05:37:58 -0000 1.9
+++ TypeConverter.cs 12 Jun 2003 12:50:37 -0000
@@ -3,8 +3,10 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
-// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2002/2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
@@ -24,10 +26,9 @@
return CanConvertFrom (null, sourceType);
}
- [MonoTODO]
public virtual bool CanConvertFrom (ITypeDescriptorContext context, Type
sourceType)
{
- throw new NotImplementedException ();
+ return false;
}
public bool CanConvertTo (Type destinationType)
@@ -45,10 +46,10 @@
return ConvertFrom (null, CultureInfo.CurrentCulture, o);
}
- [MonoTODO]
public virtual object ConvertFrom (ITypeDescriptorContext context,
CultureInfo culture, object value)
{
- throw new NotImplementedException ();
+ throw new NotSupportedException (this.ToString() + " cannot be
created from '" +
+ value.GetType().ToString() + "'");
}
public object ConvertFromInvariantString (string text)
@@ -56,15 +57,14 @@
return ConvertFromInvariantString (null, text);
}
- [MonoTODO]
public object ConvertFromInvariantString (ITypeDescriptorContext context,
string text)
{
- throw new NotImplementedException ();
+ return ConvertFromString (context, CultureInfo.InvariantCulture, text);
}
- public object ConvertFromString (string s)
+ public object ConvertFromString (string text)
{
- return ConvertFrom (s);
+ return ConvertFrom (text);
}
public object ConvertFromString (ITypeDescriptorContext context, string
text)
@@ -72,10 +72,9 @@
return ConvertFromString (context, CultureInfo.CurrentCulture, text);
}
- [MonoTODO]
public object ConvertFromString (ITypeDescriptorContext context,
CultureInfo culture, string text)
{
- throw new NotImplementedException ();
+ return ConvertFrom (context, culture, text);
}
public object ConvertTo (object value, Type destinationType)
@@ -84,9 +83,7 @@
}
public virtual object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
// context? culture?
if (destinationType == null)
@@ -106,10 +103,9 @@
return ConvertToInvariantString (null, value);
}
- [MonoTODO]
public string ConvertToInvariantString (ITypeDescriptorContext context,
object value)
{
- throw new NotImplementedException ();
+ return (string) ConvertTo (context, CultureInfo.InvariantCulture,
value, typeof (string));
}
public string ConvertToString (object value)
@@ -127,40 +123,36 @@
return (string) ConvertTo (context, culture, value, typeof (string));
}
- [MonoTODO]
- public object CreateInstance (IDictionary propertyValues)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
protected Exception GetConvertFromException (object value)
{
- throw new NotImplementedException ();
+ throw new NotSupportedException (this.ToString() + " cannot convert from
'" +
+ value.GetType().ToString() + "'");
}
- [MonoTODO]
protected Exception GetConvertToException (object value, Type
destinationType)
{
- throw new NotImplementedException ();
+ throw new NotSupportedException (this.ToString() + " cannot convert from
'" +
+ value.GetType().ToString() + "' to '" +
destinationType.ToString() + "'");
}
- [MonoTODO]
+ public object CreateInstance (IDictionary propertyValues)
+ {
+ return CreateInstance (null, propertyValues);
+ }
+
public virtual object CreateInstance (ITypeDescriptorContext context,
IDictionary propertyValues)
{
- throw new NotImplementedException ();
+ return null;
}
- [MonoTODO]
public bool GetCreateInstanceSupported ()
{
- throw new NotImplementedException ();
+ return GetCreateInstanceSupported (null);
}
- [MonoTODO]
public virtual bool GetCreateInstanceSupported (ITypeDescriptorContext
context)
{
- throw new NotImplementedException ();
+ return false;
}
public PropertyDescriptorCollection GetProperties (object value)
@@ -174,8 +166,7 @@
}
public virtual PropertyDescriptorCollection GetProperties
(ITypeDescriptorContext context,
- object value,
- Attribute[] attributes)
+ object value, Attribute[] attributes)
{
return null;
}
Index: TypeConverterAttribute.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs,v
retrieving revision 1.1
diff -u -r1.1 TypeConverterAttribute.cs
--- TypeConverterAttribute.cs 20 Jun 2002 14:32:08 -0000 1.1
+++ TypeConverterAttribute.cs 12 Jun 2003 12:50:37 -0000
@@ -1,53 +1,51 @@
+//
+// System.ComponentModel.TypeConverterAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
-// System.ComponentModel.TypeConverterAttribute
-//
-// Authors:
-// Gonzalo Paniagua Javier (gonzalo at ximian.com)
-//
-// (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
using System;
-
-namespace System.ComponentModel {
-
-[AttributeUsage(AttributeTargets.All)]
-public sealed class TypeConverterAttribute : Attribute
+namespace System.ComponentModel
{
- private string converter_type;
-
- public TypeConverterAttribute ()
- {
- converter_type = "";
- }
-
- public TypeConverterAttribute (string typeName)
- {
- converter_type = typeName;
- }
-
- public TypeConverterAttribute (Type type)
- {
- converter_type = type.AssemblyQualifiedName;
- }
-
- public override bool Equals (object obj)
- {
- if (!(obj is TypeConverterAttribute))
- return false;
-
- return ((TypeConverterAttribute) obj).ConverterTypeName ==
converter_type;
- }
-
- public override int GetHashCode ()
- {
- return converter_type.GetHashCode ();
- }
-
- public string ConverterTypeName
- {
- get { return converter_type; }
- }
-}
+ [AttributeUsage(AttributeTargets.All)]
+ public sealed class TypeConverterAttribute : Attribute
+ {
+ public static readonly TypeConverterAttribute Default = new
TypeConverterAttribute ();
+
+ private string converter_type;
+ public TypeConverterAttribute ()
+ : this ("")
+ {
+ }
+ public TypeConverterAttribute (string typeName)
+ {
+ converter_type = typeName;
+ }
+ public TypeConverterAttribute (Type type)
+ : this (type.AssemblyQualifiedName)
+ {
+ }
+ public override bool Equals (object obj)
+ {
+ if (!(obj is TypeConverterAttribute))
+ return false;
+
+ return ((TypeConverterAttribute) obj).ConverterTypeName.Equals
(converter_type);
+ }
+ public override int GetHashCode ()
+ {
+ if (converter_type != null)
+ return 0;
+ return converter_type.GetHashCode ();
+ }
+ public string ConverterTypeName
+ {
+ get { return converter_type; }
+ }
+ }
}
Index: TypeDescriptor.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/TypeDescriptor.cs,v
retrieving revision 1.9
diff -u -r1.9 TypeDescriptor.cs
--- TypeDescriptor.cs 7 Jan 2003 23:16:13 -0000 1.9
+++ TypeDescriptor.cs 12 Jun 2003 12:50:38 -0000
@@ -3,13 +3,16 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo at ximian.com)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
using System.Collections;
using System.Reflection;
+using System.ComponentModel.Design;
namespace System.ComponentModel
{
@@ -29,6 +32,12 @@
throw new NotImplementedException ();
}
+ [MonoTODO]
+ public static IDesigner CreateDesigner(IComponent component, Type
designerBaseType)
+ {
+ throw new NotImplementedException ();
+ }
+
[MonoTODO]
public static EventDescriptor CreateEvent (Type componentType,
string name,
@@ -74,37 +83,72 @@
public static AttributeCollection GetAttributes (object component)
{
- return GetAttributes (component.GetType ());
+ return GetAttributes (component, false);
}
[MonoTODO]
public static AttributeCollection GetAttributes (object component, bool
noCustomTypeDesc)
{
- throw new NotImplementedException ();
+ if (component == null)
+ return AttributeCollection.Empty;
+
+ // FIXME: implementation correct?
+ if (noCustomTypeDesc == false && component is
ICustomTypeDescriptor)
+ {
+ return ((ICustomTypeDescriptor) component).GetAttributes ();
+ }
+ else
+ {
+ // FIXME: wrong implementation (we need to check the Attributes
of the real instance?
+ // not of the type?
+ object [] atts = component.GetType ().GetCustomAttributes
(false);
+ return new AttributeCollection ((Attribute []) atts);
+ }
}
- [MonoTODO]
public static string GetClassName (object component)
{
- throw new NotImplementedException ();
+ return GetClassName (component, false);
}
- [MonoTODO]
public static string GetClassName (object component, bool
noCustomTypeDesc)
{
- throw new NotImplementedException ();
+ if (component == null)
+ throw new ArgumentNullException ("component", "component cannot
be null");
+
+ // FIXME: implementation correct?
+ if (noCustomTypeDesc == false && component is
ICustomTypeDescriptor)
+ {
+ return ((ICustomTypeDescriptor) component).GetClassName ();
+ }
+ else
+ {
+ return component.GetType ().FullName;
+ }
}
- [MonoTODO]
public static string GetComponentName (object component)
{
- throw new NotImplementedException ();
+ return GetComponentName (component, false);
}
- [MonoTODO]
public static string GetComponentName (object component, bool
noCustomTypeDesc)
{
- throw new NotImplementedException ();
+ if (component == null)
+ throw new ArgumentNullException ("component", "component cannot
be null");
+
+ // FIXME: implementation correct?
+ if (noCustomTypeDesc == false && component is
ICustomTypeDescriptor)
+ {
+ return ((ICustomTypeDescriptor) component).GetComponentName ();
+ }
+ else
+ {
+ if (((IComponent) component).Site == null)
+ return null;
+ else
+ return ((IComponent) component).Site.Name;
+ }
}
public static TypeConverter GetConverter (object component)
@@ -171,25 +215,18 @@
}
[MonoTODO]
- public static EventDescriptor GetDefaultEvent (object component)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
public static EventDescriptor GetDefaultEvent (Type componentType)
{
throw new NotImplementedException ();
}
- [MonoTODO]
- public static EventDescriptor GetDefaultEvent (object component, bool
noCustomTypeDesc)
- {
- throw new NotImplementedException ();
- }
+ public static EventDescriptor GetDefaultEvent (object component)
+ {
+ return GetDefaultEvent (component, false);
+ }
[MonoTODO]
- public static PropertyDescriptor GetDefaultProperty (object component)
+ public static EventDescriptor GetDefaultEvent (object component, bool
noCustomTypeDesc)
{
throw new NotImplementedException ();
}
@@ -200,14 +237,13 @@
throw new NotImplementedException ();
}
- [MonoTODO]
- public static PropertyDescriptor GetDefaultProperty (object component,
bool noCustomTypeDesc)
- {
- throw new NotImplementedException ();
- }
+ public static PropertyDescriptor GetDefaultProperty (object component)
+ {
+ return GetDefaultProperty (component, false);
+ }
[MonoTODO]
- public static object GetEditor (object component, Type editorBaseType)
+ public static PropertyDescriptor GetDefaultProperty (object component,
bool noCustomTypeDesc)
{
throw new NotImplementedException ();
}
@@ -218,6 +254,11 @@
throw new NotImplementedException ();
}
+ public static object GetEditor (object component, Type editorBaseType)
+ {
+ return GetEditor (component, editorBaseType, false);
+ }
+
[MonoTODO]
public static object GetEditor (object component, Type editorBaseType,
bool noCustomTypeDesc)
{
@@ -294,6 +335,12 @@
throw new NotImplementedException ();
}
+ [MonoTODO]
+ public static PropertyDescriptorCollection GetProperties (object
component, Attribute [] attributes, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
[MonoTODO("noCustomTypeDesc")]
public static PropertyDescriptorCollection GetProperties (object
component, bool noCustomTypeDesc)
{
@@ -318,6 +365,21 @@
{
throw new NotImplementedException ();
}
+
+ [MonoTODO]
+ public static void SortDescriptorArray(IList infos)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IComNativeDescriptorHandler ComNativeDescriptorHandler
+ {
+ [MonoTODO]
+ get{throw new NotImplementedException ();}
+ [MonoTODO]
+ set{throw new NotImplementedException ();}
+ }
[MonoTODO]
public static void Refresh (Assembly assembly)
Index: TypeListConverter.cs
===================================================================
RCS file:
/mono/mcs/class/System/System.ComponentModel/TypeListConverter.cs,v
retrieving revision 1.1
diff -u -r1.1 TypeListConverter.cs
--- TypeListConverter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ TypeListConverter.cs 12 Jun 2003 12:50:38 -0000
@@ -2,9 +2,11 @@
// System.ComponentModel.TypeListConverter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Collections;
@@ -12,65 +14,70 @@
namespace System.ComponentModel
{
- public abstract class TypeListConverter : TypeConverter
+ public abstract class TypeListConverter : TypeConverter
{
- [MonoTODO]
+
+ private Type[] types;
+
protected TypeListConverter (Type[] types)
{
+ this.types = types;
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
- Type sourceType)
+ Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
- [MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context,
- Type destinationType)
+ Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ return true;
+ return base.CanConvertTo (context, destinationType);
}
- [MonoTODO]
public override object ConvertFrom (ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
+ CultureInfo culture, object value)
{
- throw new NotImplementedException();
+ // LAMESPEC also it delivers true for CanConvertFrom (string)
+ // it fails in the actual conversion (MS implementation)
+ return base.ConvertFrom (context, culture, value);
}
- [MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
+ CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException();
+ if (destinationType == typeof (string))
+ if (value != null)
+ if (value.GetType() == typeof (Type))
+ {
+ return ((Type) value).ToString();
+ }
+ else
+ {
+ // LAMESPEC MS throws InvalidCastException here
+ throw new InvalidCastException("Cannot cast to
System.Type");
+ }
+ return base.ConvertTo (context, culture, value,
destinationType);
}
- [MonoTODO]
public override StandardValuesCollection GetStandardValues
(ITypeDescriptorContext context)
{
- throw new NotImplementedException();
+ return new StandardValuesCollection (types);
}
- [MonoTODO]
public override bool GetStandardValuesExclusive (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
public override bool GetStandardValuesSupported (ITypeDescriptorContext
context)
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~TypeListConverter()
- {
+ return true;
}
}
}
Index: UInt16Converter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/UInt16Converter.cs,v
retrieving revision 1.1
diff -u -r1.1 UInt16Converter.cs
--- UInt16Converter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ UInt16Converter.cs 12 Jun 2003 12:50:38 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.UInt16Converter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class UInt16Converter : BaseNumberConverter
- {
- [MonoTODO]
- public UInt16Converter()
- {
- }
-
- [MonoTODO]
- ~UInt16Converter()
- {
- }
- }
+ public class UInt16Converter : BaseNumberConverter
+ {
+ public UInt16Converter()
+ {
+ InnerType = typeof (UInt16);
+ }
+ }
}
Index: UInt32Converter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/UInt32Converter.cs,v
retrieving revision 1.1
diff -u -r1.1 UInt32Converter.cs
--- UInt32Converter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ UInt32Converter.cs 12 Jun 2003 12:50:38 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.UInt32Converter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class UInt32Converter : BaseNumberConverter
- {
- [MonoTODO]
- public UInt32Converter()
- {
- }
-
- [MonoTODO]
- ~UInt32Converter()
- {
- }
- }
+ public class UInt32Converter : BaseNumberConverter
+ {
+ public UInt32Converter()
+ {
+ InnerType = typeof (UInt32);
+ }
+ }
}
Index: UInt64Converter.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/UInt64Converter.cs,v
retrieving revision 1.1
diff -u -r1.1 UInt64Converter.cs
--- UInt64Converter.cs 31 Mar 2003 11:52:28 -0000 1.1
+++ UInt64Converter.cs 12 Jun 2003 12:50:38 -0000
@@ -2,23 +2,20 @@
// System.ComponentModel.UInt64Converter
//
// Authors:
-// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Martin Willemoes Hansen (mwh at sysrq.dk)
+// Andreas Nahr (ClassDevelopment at A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
namespace System.ComponentModel
{
- public class UInt64Converter : BaseNumberConverter
- {
- [MonoTODO]
- public UInt64Converter()
- {
- }
-
- [MonoTODO]
- ~UInt64Converter()
- {
- }
- }
+ public class UInt64Converter : BaseNumberConverter
+ {
+ public UInt64Converter()
+ {
+ InnerType = typeof (UInt64);
+ }
+ }
}
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SyntaxCheck.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030612/4f5ac722/attachment.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: IComNativeDescriptorHandler.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030612/4f5ac722/attachment-0001.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ExtenderProvidedPropertyAttribute.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030612/4f5ac722/attachment-0002.pl
More information about the Mono-devel-list
mailing list