Author: calberto
Date: 2007-10-20 00:04:17 -0400 (Sat, 20 Oct 2007)
New Revision: 87846

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
Log:
2007-10-19  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * PropertyGrid.cs: When updating a property and populating sub grid
        items, remove the previous ones, and invalidate the specific area.
        * PropertyGridView.cs: A new InvalidateBelowGridItem to invalidate the
        area behind a grid item.
        * GridItemCollection.cs: Add an internal Clear method, to allow us to
        clean the items if needed (specially for controls implementing 
        ICustomTypeDescriptor and returning a variable number of properties).
        Fixes #324865.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-10-20 01:03:30 UTC (rev 87845)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-10-20 04:04:17 UTC (rev 87846)
@@ -1,3 +1,14 @@
+2007-10-19  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * PropertyGrid.cs: When updating a property and populating sub grid
+       items, remove the previous ones, and invalidate the specific area.
+       * PropertyGridView.cs: A new InvalidateBelowGridItem to invalidate the
+       area behind a grid item.
+       * GridItemCollection.cs: Add an internal Clear method, to allow us to
+       clean the items if needed (specially for controls implementing 
+       ICustomTypeDescriptor and returning a variable number of properties).
+       Fixes #324865.
+
 2007-10-19  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * TextControl.cs: Clean up and document the Insert function.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
    2007-10-20 01:03:30 UTC (rev 87845)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
    2007-10-20 04:04:17 UTC (rev 87846)
@@ -27,6 +27,7 @@
 
 using System;
 using System.Collections;
+using System.Windows.Forms.PropertyGridInternal;
 
 namespace System.Windows.Forms
 {
@@ -142,5 +143,18 @@
                }
 
                #endregion
+
+               internal void Clear ()
+               {
+                       for (int i = 0; i < list.Count; i++) {
+                               GridEntry grid_entry = list.GetByIndex (i) as 
GridEntry;
+                               if (grid_entry == null || grid_entry.Parent == 
null)
+                                       continue;
+
+                               grid_entry.SetParent (null);
+                       }
+
+                       list.Clear ();
+               }
        }
 }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs  
2007-10-20 01:03:30 UTC (rev 87845)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs  
2007-10-20 04:04:17 UTC (rev 87846)
@@ -1335,6 +1335,12 @@
                        if (parent_grid_item == null)
                                return;
 
+                       /* Clear any previous grid items */
+                       if (parent_grid_item.GridItems.Count > 0) {
+                               parent_grid_item.GridItems.Clear ();
+                               property_grid_view.InvalidateBelowItem 
(parent_grid_item);
+                       }
+
                        for (int i = 0; i < objs.Length; i ++) {
                                if (objs [i] == null)
                                        continue;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2007-10-20 01:03:30 UTC (rev 87845)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2007-10-20 04:04:17 UTC (rev 87846)
@@ -140,8 +140,20 @@
                        Invalidate (new Rectangle (0, item.Top, 
SplitterLocation, row_height));
                }
 
+               internal void InvalidateBelowItem (GridItem item)
+               {
+                       Rectangle rect = new Rectangle (0, item.Top, Width, 
row_height);
+                       Invalidate (rect);
+
+                       if (item.Expanded) {
+                               rect = new Rectangle (0, item.Top + row_height, 
Width,
+                                               Height - (item.Top + 
row_height));
+                               Invalidate (rect);
+                       }
+               }
+
 #if !DOUBLEBUFFER
-               void InvalidateGridItem (GridItem item)
+               internal void InvalidateGridItem (GridItem item)
                {
                        Invalidate (new Rectangle (0, item.Top, Width, 
row_height));
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to