+
+ return attrs;
+ }
+
+ set
+ {
+ attrs = value;
+ }
+ }
+
+ protected virtual void FillAttributes(System.Collections.IList attributeList)
+ {
+ // to be overriden
+ }
+
+ public virtual AttributeCollection Attributes
+ {
+ get
+ {
+ if (attrCollection == null)
+ attrCollection = CreateAttributeCollection ();
+ return attrCollection;
+ }
+ }
+
+ protected virtual AttributeCollection CreateAttributeCollection()
+ {
+ return new AttributeCollection (AttributeArray);
+ }
+
+ public virtual string Category
+ {
+ get
+ {
+ return ((CategoryAttribute) Attributes [typeof (CategoryAttribute)]).Category;
+ }
+ }
+
+ public virtual string Description
+ {
+ get
+ {
+ foreach (Attribute attr in AttributeArray)
+ {
+ if (attr is DescriptionAttribute)
+ return ((DescriptionAttribute) attr).Description;
+ }
+ return "";
+ }
+ }
+
+ public virtual bool DesignTimeOnly
+ {
+ get
+ {
+ foreach (Attribute attr in AttributeArray)
+ {
+ if (attr is DesignOnlyAttribute)
+ return ((DesignOnlyAttribute) attr).IsDesignOnly;
+ }
+
+ return false;
+ }
+ }
+
+ public virtual string DisplayName
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ public virtual string Name
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ public virtual bool IsBrowsable
+ {
+ get
+ {
+ foreach (Attribute attr in AttributeArray)
+ {
+ if (attr is BrowsableAttribute)
+ return ((BrowsableAttribute) attr).Browsable;
+ }
+
+ return false;
+ }
+ }
+
+ protected virtual int NameHashCode
+ {
+ get
+ {
+ return name.GetHashCode ();
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals(object obj)
+ {
+ MemberDescriptor other = obj as MemberDescriptor;
+ if (other == null) return false;
+
+ return other.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???
+
+ // Lluis: Checked with VS.NET and it always return the component, even if
+ // it has its own designer set with DesignerAttribute. So, no idea
+ // what this should do.
+ return component;
+ }
+
+ 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);
+ }
+ }