| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // System.ComponentModel.ToolboxItemAttribute
- //
- // Authors:
- // Gonzalo Paniagua Javier ([email protected])
- //
- // (C) 2002 Ximian, Inc (http://www.ximian.com)
- //
- using System;
- namespace System.ComponentModel
- {
- [AttributeUsage(AttributeTargets.All)]
- public class ToolboxItemAttribute : Attribute
- {
- private static string defaultItemType = "System.Drawing.Design.ToolboxItem,System.Drawing";
- public static readonly ToolboxItemAttribute Default = new ToolboxItemAttribute (defaultItemType);
- public static readonly ToolboxItemAttribute None = new ToolboxItemAttribute (false);
- private Type itemType;
- private string itemTypeName;
- public ToolboxItemAttribute (bool defaultType)
- {
- if (defaultType)
- itemTypeName = defaultItemType;
- }
- public ToolboxItemAttribute (string toolboxItemName)
- {
- itemTypeName = toolboxItemName;
- }
- public ToolboxItemAttribute (Type toolboxItemType)
- {
- itemType = toolboxItemType;
- }
- public Type ToolboxItemType
- {
- get {
- if (itemType == null && itemTypeName != null)
- itemType = Type.GetType (itemTypeName);
- return itemType;
- }
- }
-
- public string ToolboxItemTypeName
- {
- get {
- if (itemTypeName == null) {
- if (itemType == null)
- return "";
- itemTypeName = itemType.AssemblyQualifiedName;
- }
- return itemTypeName;
- }
- }
-
- public override bool Equals (object o)
- {
- if (!(o is ToolboxItemAttribute))
- return false;
- return (((ToolboxItemAttribute) o).ToolboxItemTypeName == ToolboxItemTypeName);
- }
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
- public override bool IsDefaultAttribute ()
- {
- return Equals (Default);
- }
- }
- }
|