2 // System.ComponentModel.PropertyTabAttribute
5 // Martin Willemoes Hansen (mwh@sysrq.dk)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
8 // (C) 2003 Martin Willemoes Hansen
9 // (C) 2003 Andreas Nahr
12 namespace System.ComponentModel
14 [AttributeUsage(AttributeTargets.All)]
15 public class PropertyTabAttribute : Attribute
19 private PropertyTabScope[] scopes;
22 public PropertyTabAttribute()
28 public PropertyTabAttribute (string tabClassName)
30 string[] tabArray = {tabClassName};
31 this.InitializeArrays (tabArray, null);
34 public PropertyTabAttribute (Type tabClass)
36 Type[] tabArray = {tabClass};
37 this.InitializeArrays (tabArray, null);
40 public PropertyTabAttribute (string tabClassName, PropertyTabScope tabScope)
42 string[] tabArray = {tabClassName};
43 PropertyTabScope[] scopeArray = {tabScope};
44 this.InitializeArrays (tabArray, scopeArray);
47 public PropertyTabAttribute (Type tabClass, PropertyTabScope tabScope)
49 Type[] tabArray = {tabClass};
50 PropertyTabScope[] scopeArray = {tabScope};
51 this.InitializeArrays (tabArray, scopeArray);
54 public Type[] TabClasses {
58 public PropertyTabScope[] TabScopes {
59 get { return scopes; }
62 public override bool Equals (object other)
64 if (!(other is PropertyTabAttribute))
68 return ((PropertyTabAttribute) other).TabClasses == tabs &&
69 ((PropertyTabAttribute) other).TabScopes == scopes;
72 public bool Equals (PropertyTabAttribute other)
74 return this.Equals ((object) other);
77 public override int GetHashCode()
79 // FIXME check if other Hashcode is needed
80 return base.GetHashCode ();
83 protected string[] TabClassNames {
85 // FIXME untested, maybe wrong
86 string[] tabClassName = (string[]) (Array.CreateInstance (typeof (string), tabs.Length));
87 for (int x = 0; x < tabs.Length; x++)
88 tabClassName[x] = tabs[x].AssemblyQualifiedName;
93 protected void InitializeArrays (string[] tabClassNames, PropertyTabScope[] tabScopes)
95 // FIXME untested, maybe wrong
96 Type[] tabClasses = (Type[]) (Array.CreateInstance (typeof (Type), tabClassNames.Length));
97 for (int x = 0; x < tabClassNames.Length; x++)
98 tabClasses[x] = Type.GetType (tabClassNames[x], false);
104 protected void InitializeArrays (Type[] tabClasses, PropertyTabScope[] tabScopes)
106 // FIXME untested, maybe wrong