| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- //
- // System.ComponentModel.MemberDescriptor.cs
- //
- // Author:
- // Miguel de Icaza ([email protected])
- //
- // (C) Ximian, Inc. http://www.ximian.com
- //
- namespace System.ComponentModel {
- public abstract class MemberDescriptor {
- string name;
- Attribute [] attrs;
-
- 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;
- }
- }
- // FIXME: Implement Attributes property
- [MonoTODO ("Implement Attributes property too")]
- public virtual string Category {
- get {
- foreach (Attribute attr in attrs){
- if (attr is CategoryAttribute){
- return ((CategoryAttribute) attr).Category;
- }
- }
- return "Misc";
- }
- }
- 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 ();
- }
- }
- }
- }
|