Please review and commit the attached patch.
--
Ivan N. Zlatev
Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
Index: class/System/System.dll.sources
===================================================================
--- class/System/System.dll.sources (revision 78756)
+++ class/System/System.dll.sources (working copy)
@@ -235,6 +235,7 @@
System.ComponentModel.Design/HelpKeywordType.cs
System.ComponentModel.Design/IComponentChangeService.cs
System.ComponentModel.Design/IComponentDiscoveryService.cs
+System.ComponentModel.Design/IComponentInitializer.cs
System.ComponentModel.Design/IDesigner.cs
System.ComponentModel.Design/IDesignerEventService.cs
System.ComponentModel.Design/IDesignerFilter.cs
Index: class/System/System.ComponentModel.Design/IComponentInitializer.cs
===================================================================
--- class/System/System.ComponentModel.Design/IComponentInitializer.cs (revision 0)
+++ class/System/System.ComponentModel.Design/IComponentInitializer.cs (revision 0)
@@ -0,0 +1,45 @@
+//
+// System.ComponentModel.Design.IComponentInitializer
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2006 Ivan N. Zlatev
+
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+
+namespace System.ComponentModel.Design
+{
+ public interface IComponentInitializer
+ {
+ void InitializeExistingComponent (IDictionary defaultValues);
+ void InitializeNewComponent (IDictionary defaultValues);
+ }
+}
+
+#endif
+
Index: class/System/System.ComponentModel.Design/Changelog
===================================================================
--- class/System/System.ComponentModel.Design/Changelog (revision 78756)
+++ class/System/System.ComponentModel.Design/Changelog (working copy)
@@ -1,3 +1,7 @@
+2007-06-06 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
+ * IComponentInitialization.cs: New 2.0 interface
+
2007-05-30 Sebastien Pouliot <[EMAIL PROTECTED]>
* IComponentDiscoveryService.cs: New 2.0 interface (required by SDD)
Index: class/System.Drawing/System.Drawing.Design/ChangeLog
===================================================================
--- class/System.Drawing/System.Drawing.Design/ChangeLog (revision 78756)
+++ class/System.Drawing/System.Drawing.Design/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2007-06-06 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
+ * ToolboxItem.cs: Implement some 2.0 stuff.
+ Fix events not to get fired twice.
+
2007-06-06 Alan McGovern <[EMAIL PROTECTED]>
* ToolboxItem.cs: Fixed typo in event firing
Index: class/System.Drawing/System.Drawing.Design/ToolboxItem.cs
===================================================================
--- class/System.Drawing/System.Drawing.Design/ToolboxItem.cs (revision 78756)
+++ class/System.Drawing/System.Drawing.Design/ToolboxItem.cs (working copy)
@@ -151,7 +151,7 @@
{
OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));
IComponent[] Comp = CreateComponentsCore (host);
- OnComponentsCreated ( new ToolboxComponentsCreatedEventArgs (Comp));
+ OnComponentsCreated (new ToolboxComponentsCreatedEventArgs (Comp));
return Comp;
}
@@ -160,8 +160,6 @@
{
if (host == null)
throw new ArgumentNullException("host");
-
- OnComponentsCreating(new ToolboxComponentsCreatingEventArgs(host));
IComponent[] components;
Type type = GetType(host, AssemblyName, TypeName, true);
@@ -170,31 +168,29 @@
else
components = new IComponent[] { host.CreateComponent(type) };
- OnComponentsCreated(new ToolboxComponentsCreatedEventArgs(components));
return components;
}
#if NET_2_0
- [MonoTODO]
protected virtual IComponent[] CreateComponentsCore (IDesignerHost host, IDictionary defaultValues)
{
- throw new NotImplementedException ();
+ IComponent[] components = CreateComponentsCore (host);
+ foreach (Component c in components) {
+ IComponentInitializer initializer = host.GetDesigner (c) as IComponentInitializer;
+ initializer.InitializeNewComponent (defaultValues);
+ }
+ return components;
}
- [MonoTODO]
public IComponent[] CreateComponents (IDesignerHost host, IDictionary defaultValues)
{
- throw new NotImplementedException ();
+ OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));
+ IComponent[] components = CreateComponentsCore (host, defaultValues);
+ OnComponentsCreated (new ToolboxComponentsCreatedEventArgs (components));
+
+ return components;
}
- [MonoNotSupported("")]
- public Type GetType (IDesignerHost host)
- {
- if (host == null)
- return null;
- throw new NotImplementedException ();
- }
-
protected virtual object FilterPropertyValue (string propertyName, object value)
{
switch (propertyName) {
@@ -242,6 +238,11 @@
return string.Concat (TypeName, DisplayName).GetHashCode ();
}
+ public Type GetType (IDesignerHost host)
+ {
+ return GetType (host, this.AssemblyName, this.TypeName, false);
+ }
+
protected virtual Type GetType (IDesignerHost host, AssemblyName assemblyName, string typeName, bool reference)
{
if (typeName == null)
_______________________________________________
Mono-winforms-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-winforms-list