Author: ivanz
Date: 2007-08-28 07:06:33 -0400 (Tue, 28 Aug 2007)
New Revision: 84938
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
trunk/mcs/class/System.Design/System.ComponentModel.Design/ChangeLog
trunk/mcs/class/System.Design/System.ComponentModel.Design/CollectionEditor.cs
Log:
2007-08-27 Ivan N. Zlatev <[EMAIL PROTECTED]>
* CollectionEditor.cs:
- Fix CreateCollectionItemType to deal with "Item" overloads.
- Implement Create/DestroyInstance to check for the
IDesignerHost service and use that.
- Check if SetItems produces a new object(will happen for arrays)
and update EditValue.
* GridEntry.cs: Implement GetService.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-08-28 10:59:46 UTC (rev 84937)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-08-28 11:06:33 UTC (rev 84938)
@@ -1,3 +1,7 @@
+2007-08-27 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
+ * GridEntry.cs: Implement GetService.
+
2007-08-27 Jonathan Pobst <[EMAIL PROTECTED]>
* LabelEditTextBox.cs, TreeView.cs: After hiding the textbox used
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
2007-08-28 10:59:46 UTC (rev 84937)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
2007-08-28 11:06:33 UTC (rev 84938)
@@ -193,7 +193,9 @@
#region IServiceProvider Members
object IServiceProvider.GetService(Type serviceType) {
- // TODO: Add SystemComp.GetService implementation
+ IComponent selectedComponent =
property_grid_view.property_grid.SelectedObject as IComponent;
+ if (selectedComponent != null && selectedComponent.Site
!= null)
+ return selectedComponent.Site.GetService
(serviceType);
return null;
}
Modified: trunk/mcs/class/System.Design/System.ComponentModel.Design/ChangeLog
===================================================================
--- trunk/mcs/class/System.Design/System.ComponentModel.Design/ChangeLog
2007-08-28 10:59:46 UTC (rev 84937)
+++ trunk/mcs/class/System.Design/System.ComponentModel.Design/ChangeLog
2007-08-28 11:06:33 UTC (rev 84938)
@@ -1,3 +1,11 @@
+2007-08-27 Ivan N. Zlatev <[EMAIL PROTECTED]>
+ * CollectionEditor.cs:
+ - Fix CreateCollectionItemType to deal with "Item" overloads.
+ - Implement Create/DestroyInstance to check for the
+ IDesignerHost service and use that.
+ - Check if SetItems produces a new object(will happen for arrays)
+ and update EditValue.
+
2007-07-12 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* CollectionEditor.cs: Implement CreateInstance for 1.1 profile (patch
Modified:
trunk/mcs/class/System.Design/System.ComponentModel.Design/CollectionEditor.cs
===================================================================
---
trunk/mcs/class/System.Design/System.ComponentModel.Design/CollectionEditor.cs
2007-08-28 10:59:46 UTC (rev 84937)
+++
trunk/mcs/class/System.Design/System.ComponentModel.Design/CollectionEditor.cs
2007-08-28 11:06:33 UTC (rev 84938)
@@ -4,9 +4,11 @@
// Authors:
// Martin Willemoes Hansen ([EMAIL PROTECTED])
// Andreas Nahr ([EMAIL PROTECTED])
+// Ivan N. Zlatev ([EMAIL PROTECTED])
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2007 Andreas Nahr
+// (C) 2007 Ivan N. Zlatev
//
//
@@ -81,7 +83,11 @@
protected object[] Items
{
get { return editor.GetItems (editValue); }
- set { editor.SetItems (editValue, value); }
+ set {
+ object val = editor.SetItems
(editValue, value);
+ if (val != EditValue)
+ EditValue = val;
+ }
}
protected Type[] NewItemTypes
@@ -559,17 +565,30 @@
protected virtual Type CreateCollectionItemType ()
{
- PropertyInfo info = type.GetProperty ("Item");
- return info.PropertyType;
+ PropertyInfo[] properties = type.GetProperties ();
+ foreach (PropertyInfo property in properties)
+ if (property.Name == "Item")
+ return property.PropertyType;
+ return typeof (object);
}
protected virtual object CreateInstance (Type itemType)
{
+ object instance = null;
+ if (typeof (IComponent).IsAssignableFrom (itemType)) {
+ IDesignerHost host = GetService (typeof
(IDesignerHost)) as IDesignerHost;
+ if (host != null)
+ instance = host.CreateComponent
(itemType);
+ }
+
+ if (instance == null) {
#if NET_2_0
- return TypeDescriptor.CreateInstance (provider,
itemType, null, null);
+ instance = TypeDescriptor.CreateInstance
(provider, itemType, null, null);
#else
- return Activator.CreateInstance (itemType);
+ instance = Activator.CreateInstance (itemType);
#endif
+ }
+ return instance;
}
protected virtual Type[] CreateNewItemTypes ()
@@ -579,7 +598,12 @@
protected virtual void DestroyInstance (object instance)
{
- //FIXME: I've got NO clue what this does and the
documentation isn't helpfull either
+ IComponent component = instance as IComponent;
+ if (component != null) {
+ IDesignerHost host = GetService (typeof
(IDesignerHost)) as IDesignerHost;
+ if (host != null)
+ host.DestroyComponent (component);
+ }
}
public override object EditValue (ITypeDescriptorContext
context, IServiceProvider provider, object value)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches