diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-06-25 00:37:44 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-06-25 00:37:44 +0400 |
commit | d7c7c9ca73dc2d4adbe910c8a8eb99c47e333f9b (patch) | |
tree | 7277d8cd5281a1a51e25c31d492abe3caa11c3dd /mcs/class/System/System.ComponentModel | |
parent | 1f3f6af70a8f0a992bfd2a51d837b7eb8603a54c (diff) |
2003-06-23 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* DesignerAttribute.cs: Fixed AttributeUsage, implementation errors,
better Hashcode generation
* EditorAttribute.cs: Fixed AttributeUsage, implementation errors,
better Hashcode generation
* LicenseContext.cs: Added and implemented missing property
* ListBindableAttribute.cs: Simplified implementation, removed
unneccessary data.
* ReadOnlyAttribute.cs: Better Hashcode generation
* RunInstallerAttribute.cs: Better Hashcode generation, more robust
Equals check.
* LicenseProviderAttribute.cs: Fixed AttributeUsage, indentation
* ProvidePropertyAttribute.cs: Fixed AttributeUsage
* ToolboxItemFilterAttribute.cs: Fixed AttributeUsage
* MarshalByValueComponent.cs:
* IContainer.cs:
* IComponent.cs: Added missing attribute(s)
svn path=/trunk/mcs/; revision=15614
Diffstat (limited to 'mcs/class/System/System.ComponentModel')
13 files changed, 147 insertions, 129 deletions
diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog index 41bd16a46bc..fbb9d75d014 100644 --- a/mcs/class/System/System.ComponentModel/ChangeLog +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -1,4 +1,25 @@ -2003-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> +2003-06-23 Andreas Nahr <ClassDevelopment@A-SoftTech.com> + + * DesignerAttribute.cs: Fixed AttributeUsage, implementation errors, + better Hashcode generation + * EditorAttribute.cs: Fixed AttributeUsage, implementation errors, + better Hashcode generation + * LicenseContext.cs: Added and implemented missing property + * ListBindableAttribute.cs: Simplified implementation, removed + unneccessary data. + * ReadOnlyAttribute.cs: Better Hashcode generation + * RunInstallerAttribute.cs: Better Hashcode generation, more robust + Equals check. + + * LicenseProviderAttribute.cs: Fixed AttributeUsage, indentation + * ProvidePropertyAttribute.cs: Fixed AttributeUsage + * ToolboxItemFilterAttribute.cs: Fixed AttributeUsage + + * MarshalByValueComponent.cs: + * IContainer.cs: + * IComponent.cs: Added missing attribute(s) + +2003-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> * AmbientValueAttribute.cs: * ArrayConverter.cs: diff --git a/mcs/class/System/System.ComponentModel/DesignerAttribute.cs b/mcs/class/System/System.ComponentModel/DesignerAttribute.cs index 7bb14ce35e1..7eb2b75a84a 100644 --- a/mcs/class/System/System.ComponentModel/DesignerAttribute.cs +++ b/mcs/class/System/System.ComponentModel/DesignerAttribute.cs @@ -3,11 +3,14 @@ // // Author: // Alejandro Sánchez Acosta (raciel@es.gnu.org) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) Alejandro Sánchez Acosta +// (C) 2003 Andreas Nahr // -namespace System.ComponentModel { +namespace System.ComponentModel +{ /// <summary> /// Designer Attribute for classes. @@ -16,73 +19,67 @@ namespace System.ComponentModel { /// <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, AllowMultiple = true, Inherited = true)] + public sealed class DesignerAttribute : Attribute + { + private string name; + private string basetypename; - public DesignerAttribute (string designerTypeName) - { - name = designerTypeName; - } + public DesignerAttribute (string designerTypeName) + { + name = designerTypeName; + } - public DesignerAttribute (Type designerType) - { - type = designerType; - } + public DesignerAttribute (Type designerType) + : this (designerType.AssemblyQualifiedName) + { + } - public DesignerAttribute (string designerTypeName, string designerBaseTypeName) - { - name = designerTypeName; - basetypename = designerBaseTypeName; - } + public DesignerAttribute (string designerTypeName, Type designerBaseType) + : this (designerTypeName, designerBaseType.AssemblyQualifiedName) + { + } - public DesignerAttribute (string designerTypeName, Type designerBaseType) - { - name = designerTypeName; - basetype = designerBaseType; - } + public DesignerAttribute (Type designerType, Type designerBaseType) + : this (designerType.AssemblyQualifiedName, designerBaseType.AssemblyQualifiedName) + { + } - public DesignerAttribute (Type designerType, Type designerBaseType) - { - type = designerType; - basetype = designerBaseType; - } + public DesignerAttribute (string designerTypeName, string designerBaseTypeName) + { + name = designerTypeName; + basetypename = designerBaseTypeName; + } - public string DesignerBaseTypeName { - get { - return basetypename; - } - } + public string DesignerBaseTypeName { + get { + return basetypename; + } + } - public string DesignerTypeName { - get { - return name; - } + public string DesignerTypeName { + get { + return name; } + } - public override object TypeId { - get { - return this.GetType (); - } + 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 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 base.GetHashCode (); - } + public override int GetHashCode () + { + return string.Concat(name, basetypename).GetHashCode (); } + } } diff --git a/mcs/class/System/System.ComponentModel/EditorAttribute.cs b/mcs/class/System/System.ComponentModel/EditorAttribute.cs index 3f3913b172f..02279050795 100644 --- a/mcs/class/System/System.ComponentModel/EditorAttribute.cs +++ b/mcs/class/System/System.ComponentModel/EditorAttribute.cs @@ -3,8 +3,10 @@ // // Author: // Alejandro Sánchez Acosta (raciel@es.gnu.org) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) Alejandro Sánchez Acosta +// (C) 2003 Andreas Nahr // namespace System.ComponentModel { @@ -12,18 +14,15 @@ namespace System.ComponentModel { /// <summary> /// Editor Attribute for classes. /// </summary> - - [AttributeUsage (AttributeTargets.All)] + [AttributeUsage (AttributeTargets.All, AllowMultiple = true, Inherited = true)] public sealed class EditorAttribute : Attribute { - string name; + string name; string basename; - Type baseType; - Type nametype; public EditorAttribute () { - this.name = ""; + this.name = string.Empty; } public EditorAttribute (string typeName, string baseTypeName) @@ -33,15 +32,13 @@ namespace System.ComponentModel { } 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 +64,13 @@ namespace System.ComponentModel { 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 (); } } } diff --git a/mcs/class/System/System.ComponentModel/IComponent.cs b/mcs/class/System/System.ComponentModel/IComponent.cs index df2dc6465a7..937f8369d04 100644 --- a/mcs/class/System/System.ComponentModel/IComponent.cs +++ b/mcs/class/System/System.ComponentModel/IComponent.cs @@ -2,8 +2,8 @@ // System.ComponentModel.IComponent.cs // // Authors: -// Miguel de Icaza (miguel@ximian.com) -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Miguel de Icaza (miguel@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) Ximian, Inc. http://www.ximian.com // (C) 2003 Andreas Nahr @@ -13,6 +13,11 @@ using System; namespace System.ComponentModel { + [ComVisible (true), + TypeConverter (typeof (System.ComponentModel.ComponentConverter)), + 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 { get; set; } diff --git a/mcs/class/System/System.ComponentModel/IContainer.cs b/mcs/class/System/System.ComponentModel/IContainer.cs index 7bab5da610d..c00e74ce5ca 100644 --- a/mcs/class/System/System.ComponentModel/IContainer.cs +++ b/mcs/class/System/System.ComponentModel/IContainer.cs @@ -9,7 +9,9 @@ namespace System.ComponentModel { - public interface IContainer : IDisposable { + [ComVisible (true)] + public interface IContainer : IDisposable + { ComponentCollection Components { get; diff --git a/mcs/class/System/System.ComponentModel/LicenseContext.cs b/mcs/class/System/System.ComponentModel/LicenseContext.cs index aced4a47552..d97ad894d4f 100644 --- a/mcs/class/System/System.ComponentModel/LicenseContext.cs +++ b/mcs/class/System/System.ComponentModel/LicenseContext.cs @@ -1,10 +1,12 @@ // -// System.ComponentModel.LicenseContext +// System.ComponentModel.LicenseContext.cs // // Authors: -// Martin Willemoes Hansen (mwh@sysrq.dk) +// Martin Willemoes Hansen (mwh@sysrq.dk) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2003 Martin Willemoes Hansen +// (C) 2003 Andreas Nahr // using System.Reflection; @@ -37,9 +39,10 @@ namespace System.ComponentModel throw new NotImplementedException(); } - [MonoTODO] - ~LicenseContext() - { + public virtual LicenseUsageMode UsageMode { + get { + return LicenseUsageMode.Runtime; + } } } } diff --git a/mcs/class/System/System.ComponentModel/LicenseProviderAttribute.cs b/mcs/class/System/System.ComponentModel/LicenseProviderAttribute.cs index a4904d91b5d..271f39fca9b 100644 --- a/mcs/class/System/System.ComponentModel/LicenseProviderAttribute.cs +++ b/mcs/class/System/System.ComponentModel/LicenseProviderAttribute.cs @@ -1,9 +1,9 @@ // -// System.ComponentModel.LicenseProviderAttribute +// System.ComponentModel.LicenseProviderAttribute.cs // // Authors: -// Martin Willemoes Hansen (mwh@sysrq.dk) -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Martin Willemoes Hansen (mwh@sysrq.dk) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2003 Martin Willemoes Hansen // (C) 2003 Andreas Nahr @@ -11,7 +11,7 @@ namespace System.ComponentModel { - [AttributeUsage(AttributeTargets.Class)] + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public sealed class LicenseProviderAttribute : Attribute { private Type Provider; @@ -38,9 +38,9 @@ namespace System.ComponentModel } public override object TypeId { - get { - // Seems to be MS implementation - return (base.ToString() + Provider.ToString()); + get { + // Seems to be MS implementation + return (base.ToString() + Provider.ToString()); } } @@ -50,7 +50,7 @@ namespace System.ComponentModel return false; if (obj == this) return true; - return ((LicenseProviderAttribute) obj).LicenseProvider == Provider; + return ((LicenseProviderAttribute) obj).LicenseProvider.Equals (Provider); } public override int GetHashCode() diff --git a/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs b/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs index d09bd565471..730e0358ac8 100644 --- a/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs +++ b/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs @@ -1,10 +1,12 @@ // -// System.ComponentModel.ListBindableAttribute +// System.ComponentModel.ListBindableAttribute.cs // // Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc (http://www.ximian.com) +// (C) 2003 Andreas Nahr // using System; @@ -14,29 +16,23 @@ namespace System.ComponentModel [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,22 +40,20 @@ namespace System.ComponentModel 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 - { + public bool ListBindable { get { return bindable; } diff --git a/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs b/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs index fb9f5c09c7a..1203b06ab11 100644 --- a/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs +++ b/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs @@ -18,6 +18,9 @@ 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 { private EventHandlerList eventList; diff --git a/mcs/class/System/System.ComponentModel/ProvidePropertyAttribute.cs b/mcs/class/System/System.ComponentModel/ProvidePropertyAttribute.cs index ce4e023c5bf..b2cac073ca2 100644 --- a/mcs/class/System/System.ComponentModel/ProvidePropertyAttribute.cs +++ b/mcs/class/System/System.ComponentModel/ProvidePropertyAttribute.cs @@ -1,5 +1,5 @@ // -// System.ComponentModel.ProvidePropertyAttribute +// System.ComponentModel.ProvidePropertyAttribute.cs // // Authors: // Martin Willemoes Hansen (mwh@sysrq.dk) @@ -11,7 +11,7 @@ namespace System.ComponentModel { - [AttributeUsage(AttributeTargets.Class)] + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class ProvidePropertyAttribute : Attribute { diff --git a/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs b/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs index e04ad8bbb94..164d8937a60 100755 --- a/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs +++ b/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs @@ -1,5 +1,5 @@ // -// ReadOnlyAttribute.cs +// System.ComponentModel.ReadOnlyAttribute.cs // // Author: // Chris J Breisch (cjbreisch@altavista.net) @@ -35,7 +35,7 @@ namespace System.ComponentModel { public override int GetHashCode () { - return base.GetHashCode (); + return read_only.GetHashCode (); } public override bool Equals (object o) @@ -43,7 +43,7 @@ namespace System.ComponentModel { if (!(o is ReadOnlyAttribute)) return false; - return (((ReadOnlyAttribute) o).read_only == read_only); + return (((ReadOnlyAttribute) o).IsReadOnly.Equals (read_only)); } public override bool IsDefaultAttribute () diff --git a/mcs/class/System/System.ComponentModel/RunInstallerAttribute.cs b/mcs/class/System/System.ComponentModel/RunInstallerAttribute.cs index 4d1c0f1f71d..c58c6a15e11 100755 --- a/mcs/class/System/System.ComponentModel/RunInstallerAttribute.cs +++ b/mcs/class/System/System.ComponentModel/RunInstallerAttribute.cs @@ -1,10 +1,12 @@ // -// System.ComponentModel.RunInstallerAttribute +// System.ComponentModel.RunInstallerAttribute.cs // // Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2003 Ximian, Inc (http://www.ximian.com) +// (C) 2003 Andreas Nahr // using System; @@ -30,17 +32,17 @@ namespace System.ComponentModel 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 diff --git a/mcs/class/System/System.ComponentModel/ToolboxItemFilterAttribute.cs b/mcs/class/System/System.ComponentModel/ToolboxItemFilterAttribute.cs index 60d2fd4cd5a..d07ee7bdddd 100644 --- a/mcs/class/System/System.ComponentModel/ToolboxItemFilterAttribute.cs +++ b/mcs/class/System/System.ComponentModel/ToolboxItemFilterAttribute.cs @@ -1,9 +1,9 @@ // -// System.ComponentModel.ToolboxItemFilterAttribute +// System.ComponentModel.ToolboxItemFilterAttribute.cs // // Authors: -// Martin Willemoes Hansen (mwh@sysrq.dk) -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Martin Willemoes Hansen (mwh@sysrq.dk) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2003 Martin Willemoes Hansen // (C) 2003 Andreas Nahr @@ -11,7 +11,7 @@ namespace System.ComponentModel { - [AttributeUsage(AttributeTargets.Class)] + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] [Serializable] public sealed class ToolboxItemFilterAttribute : Attribute { |