-//
-// System.Drawing.Design.ToolboxItem.cs
-//
-// Authors:
-// Alejandro Sánchez Acosta
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-// Jordi Mas i Hernandez, jordimash@gmail.com
-//
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Reflection;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-
-namespace System.Drawing.Design
-{
- [Serializable]
- [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
- [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
- public class ToolboxItem : ISerializable
- {
- private bool locked = false;
- private ICollection filter = new ToolboxItemFilterAttribute[0];
- private Hashtable properties = new Hashtable ();
-
- public ToolboxItem() {
- }
-
- public ToolboxItem (Type toolType) {
- Initialize (toolType);
- }
-
- public AssemblyName AssemblyName {
- get {
- return (AssemblyName) properties["AssemblyName"];
- }
-
- set {
- CheckUnlocked ();
- properties["AssemblyName"] = value;
- }
- }
-
- public Bitmap Bitmap {
- get {
- return (Bitmap) properties["Bitmap"];
- }
-
- set {
- CheckUnlocked ();
- properties["Bitmap"] = value;
- }
- }
-
- public string DisplayName {
- get {
- return (string) properties["DisplayName"];
- }
-
- set {
- CheckUnlocked ();
- properties["DisplayName"] = value;
- }
- }
-
- public ICollection Filter {
- get {
- return filter;
- }
-
- set {
- CheckUnlocked ();
- filter = value;
- }
- }
-#if NET_2_0
- public virtual bool Locked {
-#else
- protected bool Locked {
-#endif
- get {
- return locked;
- }
- }
-
- public string TypeName {
- get {
- return (string) properties["TypeName"];
- }
-
- set {
- CheckUnlocked ();
- properties["TypeName"] = value;
- }
- }
-#if NET_2_0
- public string Company {
- get { return (string) properties["Company"]; }
- set { properties["Company"] = value; }
- }
-\r
- public virtual string ComponentType {
- get { return "DotNET_ComponentType"; }
- }
-\r
- public AssemblyName[] DependentAssemblies {
- get { return (AssemblyName[]) properties["DependentAssemblies"]; }
- set { properties["DependentAssemblies"] = value; }
- }
-\r
- public string Description {
- get { return (string) properties["Description"]; }
- set { properties["Description"] = value; }
- }\r
-\r
- public bool IsTransient {
- get { return (bool) properties["IsTransient"]; }
- set { properties["IsTransient"] = value; }
- }
-\r
- public IDictionary Properties {
- get { return properties; }
- }
-
- public virtual string Version {
- get { return string.Empty; }
- }
-
-#endif
- protected void CheckUnlocked ()
- {
- if (locked)
- throw new InvalidOperationException ("The ToolboxItem is locked");
- }
-
- public IComponent[] CreateComponents ()
- {
- return CreateComponents (null);
- }
-
- public IComponent[] CreateComponents (IDesignerHost host)
- {
- OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));
- IComponent[] Comp = CreateComponentsCore (host);
- OnComponentsCreated ( new ToolboxComponentsCreatedEventArgs (Comp));
- return Comp;
- }
-
- [MonoTODO ("get error handling logic correct")]
- protected virtual IComponent[] CreateComponentsCore (IDesignerHost host)
+//\r
+// System.Drawing.Design.ToolboxItem.cs\r
+//\r
+// Authors:\r
+// Alejandro Sánchez Acosta\r
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)\r
+// Jordi Mas i Hernandez, jordimash@gmail.com\r
+// Sebastien Pouliot <sebastien@ximian.com>\r
+//\r
+// (C) Alejandro Sánchez Acosta\r
+// (C) 2003 Andreas Nahr\r
+// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
+using System.Collections;\r
+using System.ComponentModel;\r
+using System.ComponentModel.Design;\r
+using System.Reflection;\r
+using System.Runtime.Serialization;\r
+using System.Security.Permissions;\r
+\r
+namespace System.Drawing.Design \r
+{\r
+ [Serializable]\r
+ [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]\r
+ [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]\r
+ [MonoTODO ("Implementation is incomplete.")]\r
+ public class ToolboxItem : ISerializable {\r
+\r
+ private bool locked = false;\r
+ private Hashtable properties = new Hashtable ();\r
+ \r
+ public ToolboxItem ()\r
+ {\r
+ }\r
+\r
+ public ToolboxItem (Type toolType)\r
+ {\r
+ Initialize (toolType);\r
+ }\r
+\r
+ public AssemblyName AssemblyName {\r
+ get { return (AssemblyName) properties["AssemblyName"]; }\r
+ set { SetValue ("AssemblyName", value); }\r
+ }\r
+\r
+ public Bitmap Bitmap {\r
+ get { return (Bitmap) properties["Bitmap"]; }\r
+ set { SetValue ("Bitmap", value); }\r
+ }\r
+\r
+ public string DisplayName {\r
+ get { return GetValue ("DisplayName"); }\r
+ set { SetValue ("DisplayName", value); }\r
+ }\r
+\r
+ public ICollection Filter {\r
+ get {\r
+ ICollection filter = (ICollection) properties["Filter"];\r
+ if (filter == null)\r
+ filter = new ToolboxItemFilterAttribute[0];\r
+ return filter;\r
+ }\r
+ set { SetValue ("Filter", value); }\r
+ }\r
+#if NET_2_0\r
+ public virtual bool Locked {\r
+#else \r
+ protected bool Locked {\r
+#endif \r
+ get { return locked; }\r
+ }\r
+\r
+ public string TypeName {\r
+ get { return GetValue ("TypeName"); }\r
+ set { SetValue ("TypeName", value); }\r
+ }\r
+#if NET_2_0\r
+ public string Company {\r
+ get { return (string) properties["Company"]; }\r
+ set { SetValue ("Company", value); }\r
+ }\r
+\r
+ public virtual string ComponentType {\r
+ get { return ".NET Component"; }\r
+ }\r
+\r
+ public AssemblyName[] DependentAssemblies {\r
+ get { return (AssemblyName[]) properties["DependentAssemblies"]; }\r
+ set {\r
+ AssemblyName[] names = new AssemblyName [value.Length];\r
+ for (int i=0; i < names.Length; i++)\r
+ names [i] = value [i];\r
+ SetValue ("DependentAssemblies", names);\r
+ }\r
+ }\r
+\r
+ public string Description {\r
+ get { return (string) properties["Description"]; }\r
+ set { SetValue ("Description", value); }\r
+ }\r
+\r
+ public bool IsTransient { \r
+ get {\r
+ object o = properties ["IsTransient"];\r
+ return (o == null) ? false : (bool) o;\r
+ }\r
+ set { SetValue ("IsTransient", value); }\r
+ }\r
+\r
+ public IDictionary Properties {\r
+ get { return properties; }\r
+ }\r
+\r
+ public virtual string Version { \r
+ get { return string.Empty; }\r
+ } \r
+\r
+#endif \r
+ protected void CheckUnlocked ()\r
+ {\r
+ if (locked)\r
+ throw new InvalidOperationException ("The ToolboxItem is locked");\r
+ }\r
+\r
+ public IComponent[] CreateComponents () \r
+ {\r
+ return CreateComponents (null);\r
+ }\r
+\r
+ public IComponent[] CreateComponents (IDesignerHost host)\r
+ {\r
+ OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));\r
+ IComponent[] Comp = CreateComponentsCore (host);\r
+ OnComponentsCreated (new ToolboxComponentsCreatedEventArgs (Comp));\r
+ return Comp;\r
+ }\r
+\r
+ // FIXME - get error handling logic correct\r
+ protected virtual IComponent[] CreateComponentsCore (IDesignerHost host)\r
{\r
if (host == null)\r
- throw new ArgumentNullException("host");
-
- OnComponentsCreating(new ToolboxComponentsCreatingEventArgs(host));
+ throw new ArgumentNullException("host");\r
\r
IComponent[] components;\r
- Type type = GetType(host, AssemblyName, TypeName, true);
+ Type type = GetType(host, AssemblyName, TypeName, true);\r
if (type == null)\r
- components = new IComponent[] { };
+ components = new IComponent[] { };\r
else\r
- components = new IComponent[] { host.CreateComponent(type) };
-
- OnComponentsCreated(new ToolboxComponentsCreatedEventArgs(components));\r
- return components;
- }
-
-#if NET_2_0
- [MonoTODO]
+ components = new IComponent[] { host.CreateComponent(type) };\r
+\r
+ return components;\r
+ }\r
+\r
+#if NET_2_0\r
+ protected virtual IComponent[] CreateComponentsCore (IDesignerHost host, IDictionary defaultValues)\r
+ {\r
+ IComponent[] components = CreateComponentsCore (host);\r
+ foreach (Component c in components) {\r
+ IComponentInitializer initializer = host.GetDesigner (c) as IComponentInitializer;\r
+ initializer.InitializeNewComponent (defaultValues);\r
+ }\r
+ return components;\r
+ } \r
+\r
public IComponent[] CreateComponents (IDesignerHost host, IDictionary defaultValues)\r
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
+ {\r
+ OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));\r
+ IComponent[] components = CreateComponentsCore (host, defaultValues);\r
+ OnComponentsCreated (new ToolboxComponentsCreatedEventArgs (components));\r
+\r
+ return components;\r
+ } \r
+\r
+ protected virtual object FilterPropertyValue (string propertyName, object value)\r
+ {\r
+ switch (propertyName) {\r
+ case "AssemblyName":\r
+ return (value == null) ? null : (value as ICloneable).Clone ();\r
+ case "DisplayName":\r
+ case "TypeName":\r
+ return (value == null) ? String.Empty : value;\r
+ case "Filter":\r
+ return (value == null) ? new ToolboxItemFilterAttribute [0] : value;\r
+ default:\r
+ return value;\r
+ }\r
+ }\r
+#endif\r
+\r
+ protected virtual void Deserialize (SerializationInfo info, StreamingContext context)\r
+ { \r
+ AssemblyName = (AssemblyName)info.GetValue ("AssemblyName", typeof (AssemblyName));\r
+ Bitmap = (Bitmap)info.GetValue ("Bitmap", typeof (Bitmap));\r
+ Filter = (ICollection)info.GetValue ("Filter", typeof (ICollection));\r
+ DisplayName = info.GetString ("DisplayName");\r
+ locked = info.GetBoolean ("Locked");\r
+ TypeName = info.GetString ("TypeName");\r
+ }\r
+\r
+ // FIXME: too harsh??\r
+ public override bool Equals (object obj)\r
+ {\r
+ ToolboxItem ti = (obj as ToolboxItem);\r
+ if (ti == null)\r
+ return false;\r
+ if (obj == this)\r
+ return true;\r
+ return (ti.AssemblyName.Equals (AssemblyName) &&\r
+ ti.Locked.Equals (locked) &&\r
+ ti.TypeName.Equals (TypeName) &&\r
+ ti.DisplayName.Equals (DisplayName) &&\r
+ ti.Bitmap.Equals (Bitmap));\r
+ }\r
+ \r
+ public override int GetHashCode ()\r
+ {\r
+ // FIXME: other algorithm?\r
+ return string.Concat (TypeName, DisplayName).GetHashCode ();\r
+ }\r
+\r
public Type GetType (IDesignerHost host)\r
{\r
- throw new NotImplementedException ();\r
- }
-
- [MonoTODO]
- protected virtual object FilterPropertyValue(string propertyName, object value)\r
- {
- throw new NotImplementedException ();
- }\r
-#endif
-
- protected virtual void Deserialize (SerializationInfo info, StreamingContext context)
- {
- AssemblyName = (AssemblyName)info.GetValue ("AssemblyName", typeof (AssemblyName));
- Bitmap = (Bitmap)info.GetValue ("Bitmap", typeof (Bitmap));
- filter = (ICollection)info.GetValue ("Filter", typeof (ICollection));
- DisplayName = info.GetString ("DisplayName");
- locked = info.GetBoolean ("Locked");
- TypeName = info.GetString ("TypeName");
- }
-
- public override bool Equals (object obj)
- {
- // FIXME: too harsh??
- if (!(obj is ToolboxItem))
- return false;
- if (obj == this)
- return true;
- return ((ToolboxItem) obj).AssemblyName.Equals (AssemblyName) &&
- ((ToolboxItem) obj).Locked.Equals (locked) &&
- ((ToolboxItem) obj).TypeName.Equals (TypeName) &&
- ((ToolboxItem) obj).DisplayName.Equals (DisplayName) &&
- ((ToolboxItem) obj).Bitmap.Equals (Bitmap);
- }
-
- public override int GetHashCode ()
- {
- // FIXME: other algorithm?
- return string.Concat (TypeName, DisplayName).GetHashCode ();
- }
-
- [MonoTODO]
- protected virtual Type GetType (IDesignerHost host, AssemblyName assemblyName, string typeName, bool reference)
+ return GetType (host, this.AssemblyName, this.TypeName, false);\r
+ }\r
+\r
+ protected virtual Type GetType (IDesignerHost host, AssemblyName assemblyName, string typeName, bool reference)\r
{\r
+ if (typeName == null)\r
+ throw new ArgumentNullException ("typeName");\r
+\r
if (host == null)\r
- throw new ArgumentNullException("host");
-
- //get ITypeResolutionService from host, as we have no other IServiceProvider here
- ITypeResolutionService typeRes = host.GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
- if (typeRes == null)
- throw new Exception("Host does not provide an ITypeResolutionService");
-
- //TODO: Using Assembly loader to throw errors. Silent fail and return null?
- Assembly assembly = typeRes.GetAssembly(assemblyName, true);\r
- if (reference)\r
- typeRes.ReferenceAssembly(assemblyName);\r
- return typeRes.GetType(typeName, true);
- }
-
- [MonoTODO ("Should we be returning empty bitmap, or null?")]
- public virtual void Initialize (Type type)
- {
- AssemblyName = type.Assembly.GetName();
- DisplayName = type.Name;
- TypeName = type.FullName;
-
- // seems to be a right place to create the bitmap
- System.Drawing.Image image = null;
- foreach (object attribute in type.GetCustomAttributes(true)) {
- ToolboxBitmapAttribute tba = attribute as ToolboxBitmapAttribute;
- if (tba != null) {
- image = tba.GetImage (type);
- break;
- }
- }
- //fallback: check for image even if not attribute
- if (image == null)
- image = ToolboxBitmapAttribute.GetImageFromResource (type, null, false);
-
- if (image != null) {
- if (image is Bitmap)
- Bitmap = (Bitmap) image;
- else
- Bitmap = new Bitmap (image);
- }
-
- filter = type.GetCustomAttributes (typeof (ToolboxItemFilterAttribute), true);
- }
-
- void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
- {
- Serialize (info, context);
- }
-
-#if NET_2_0
- public virtual void Lock ()
-#else
- public void Lock ()
-#endif
- {
- locked = true;
- }
-
- protected virtual void OnComponentsCreated (ToolboxComponentsCreatedEventArgs args)
- {
- if (ComponentsCreated != null)
- this.ComponentsCreated (this, args);
- }
-
- protected virtual void OnComponentsCreating (ToolboxComponentsCreatingEventArgs args)
- {
- if (ComponentsCreated != null)
- this.ComponentsCreating (this, args);
- }
-
- protected virtual void Serialize (SerializationInfo info, StreamingContext context)
- {
- info.AddValue ("AssemblyName", AssemblyName);
- info.AddValue ("Bitmap", Bitmap);
- info.AddValue ("Filter", filter);
- info.AddValue ("DisplayName", DisplayName);
- info.AddValue ("Locked", locked);
- info.AddValue ("TypeName", TypeName);
- }
-
- public override string ToString()
- {
- return DisplayName;
- }
-
-#if NET_2_0
+ return null;\r
+\r
+ //get ITypeResolutionService from host, as we have no other IServiceProvider here\r
+ ITypeResolutionService typeRes = host.GetService (typeof (ITypeResolutionService)) as ITypeResolutionService;\r
+ Type type = null;\r
+ if (typeRes != null) {\r
+ //TODO: Using Assembly loader to throw errors. Silent fail and return null?\r
+ typeRes.GetAssembly (assemblyName, true);\r
+ if (reference)\r
+ typeRes.ReferenceAssembly (assemblyName);\r
+ type = typeRes.GetType (typeName, true);\r
+ } else {\r
+ Assembly assembly = Assembly.Load (assemblyName);\r
+ if (assembly != null)\r
+ type = assembly.GetType (typeName);\r
+ }\r
+ return type;\r
+ }\r
+\r
+ // FIXME - Should we be returning empty bitmap, or null?\r
+ public virtual void Initialize (Type type) \r
+ {\r
+ CheckUnlocked ();\r
+ if (type == null)\r
+ return;\r
+\r
+ AssemblyName = type.Assembly.GetName();\r
+ DisplayName = type.Name;\r
+ TypeName = type.FullName;\r
+ \r
+ // seems to be a right place to create the bitmap\r
+ System.Drawing.Image image = null;\r
+ foreach (object attribute in type.GetCustomAttributes(true)) {\r
+ ToolboxBitmapAttribute tba = attribute as ToolboxBitmapAttribute;\r
+ if (tba != null) {\r
+ image = tba.GetImage (type);\r
+ break;\r
+ }\r
+ }\r
+ //fallback: check for image even if not attribute\r
+ if (image == null)\r
+ image = ToolboxBitmapAttribute.GetImageFromResource (type, null, false);\r
+ \r
+ if (image != null) {\r
+ if (image is Bitmap)\r
+ Bitmap = (Bitmap) image;\r
+ else\r
+ Bitmap = new Bitmap (image);\r
+ }\r
+\r
+ Filter = type.GetCustomAttributes (typeof (ToolboxItemFilterAttribute), true);\r
+ }\r
+ \r
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)\r
+ {\r
+ Serialize (info, context);\r
+ }\r
+\r
+#if NET_2_0\r
+ public virtual void Lock () \r
+#else \r
+ public void Lock ()\r
+#endif \r
+ {\r
+ locked = true;\r
+ }\r
+\r
+ protected virtual void OnComponentsCreated (ToolboxComponentsCreatedEventArgs args)\r
+ {\r
+ if (ComponentsCreated != null)\r
+ this.ComponentsCreated (this, args);\r
+ }\r
+\r
+ protected virtual void OnComponentsCreating (ToolboxComponentsCreatingEventArgs args)\r
+ {\r
+ if (ComponentsCreating != null)\r
+ this.ComponentsCreating (this, args);\r
+ }\r
+\r
+ protected virtual void Serialize (SerializationInfo info, StreamingContext context)\r
+ {\r
+ info.AddValue ("AssemblyName", AssemblyName);\r
+ info.AddValue ("Bitmap", Bitmap);\r
+ info.AddValue ("Filter", Filter);\r
+ info.AddValue ("DisplayName", DisplayName);\r
+ info.AddValue ("Locked", locked);\r
+ info.AddValue ("TypeName", TypeName);\r
+ }\r
+\r
+ public override string ToString()\r
+ {\r
+ return DisplayName;\r
+ }\r
+\r
+#if NET_2_0\r
protected void ValidatePropertyType (string propertyName, object value, Type expectedType, bool allowNull)\r
- {
- throw new NotImplementedException ();
- }
-
+ {\r
+ if (!allowNull && (value == null))\r
+ throw new ArgumentNullException ("value");\r
+\r
+ if ((value != null) && !expectedType.Equals (value.GetType ())) {\r
+ string msg = Locale.GetText ("Type mismatch between value ({0}) and expected type ({1}).",\r
+ value.GetType (), expectedType);\r
+ throw new ArgumentException (msg, "value");\r
+ }\r
+ }\r
+\r
protected virtual object ValidatePropertyValue (string propertyName, object value)\r
- {
- throw new NotImplementedException ();
- }
-#endif
-
- public event ToolboxComponentsCreatedEventHandler ComponentsCreated;
-
- public event ToolboxComponentsCreatingEventHandler ComponentsCreating;
- }
-}
+ {\r
+ switch (propertyName) {\r
+ case "AssemblyName":\r
+ ValidatePropertyType (propertyName, value, typeof (AssemblyName), true);\r
+ break;\r
+ case "Bitmap":\r
+ ValidatePropertyType (propertyName, value, typeof (Bitmap), true);\r
+ break;\r
+ case "Company":\r
+ case "Description":\r
+ case "DisplayName":\r
+ case "TypeName":\r
+ ValidatePropertyType (propertyName, value, typeof (string), true);\r
+ if (value == null)\r
+ value = String.Empty;\r
+ break;\r
+ case "IsTransient":\r
+ ValidatePropertyType (propertyName, value, typeof (bool), false);\r
+ break;\r
+ case "Filter":\r
+ ValidatePropertyType (propertyName, value, typeof (ToolboxItemFilterAttribute[]), true);\r
+ if (value == null)\r
+ value = new ToolboxItemFilterAttribute [0];\r
+ break;\r
+ case "DependentAssemblies":\r
+ ValidatePropertyType (propertyName, value, typeof (AssemblyName[]), true);\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ return value;\r
+ }\r
+\r
+ private void SetValue (string propertyName, object value)\r
+ {\r
+ CheckUnlocked ();\r
+ properties [propertyName] = ValidatePropertyValue (propertyName, value);\r
+ }\r
+#else\r
+ private void SetValue (string propertyName, object value)\r
+ {\r
+ CheckUnlocked ();\r
+ properties [propertyName] = value;\r
+ }\r
+#endif\r
+ private string GetValue (string propertyName)\r
+ {\r
+ string s = (string) properties [propertyName];\r
+ return (s == null) ? String.Empty : s;\r
+ }\r
+\r
+ public event ToolboxComponentsCreatedEventHandler ComponentsCreated;\r
+\r
+ public event ToolboxComponentsCreatingEventHandler ComponentsCreating;\r
+ }\r
+}\r