Author: calberto
Date: 2007-12-06 20:42:08 -0500 (Thu, 06 Dec 2007)
New Revision: 90886

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs
Log:
2007-12-06  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * ListView.cs: When doing layout computations, set position in the
        ListView instances (we cache the position just as .Net does).
        * ListViewItem.cs: New internal setter method for Position. Also set
        position field as also available in 1.1, since we are going to use it
        now in the common case.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-12-07 01:34:13 UTC (rev 90885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-12-07 01:42:08 UTC (rev 90886)
@@ -1,3 +1,11 @@
+2007-12-06  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * ListView.cs: When doing layout computations, set position in the
+       ListView instances (we cache the position just as .Net does).
+       * ListViewItem.cs: New internal setter method for Position. Also set
+       position field as also available in 1.1, since we are going to use it
+       now in the common case.
+
 2007-12-06  Andreia Gaita <[EMAIL PROTECTED]>
 
        * Control.cs: When removing controls, get the actual container

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-12-07 01:34:13 UTC (rev 90885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-12-07 01:42:08 UTC (rev 90886)
@@ -1743,14 +1743,6 @@
                        for (int i = 0; i < items.Count; i++) {
                                ListViewItem item = items [i];
 #if NET_2_0
-                               if (!virtual_mode) 
-#endif
-                               {
-                                       item.Layout ();
-                                       item.DisplayIndex = i;
-                               }
-
-#if NET_2_0
                                if (using_groups) {
                                        ListViewGroup group = item.Group;
                                        if (group == null)
@@ -1790,7 +1782,16 @@
                                                }
                                        }
                                }
+#if NET_2_0
+                               if (!virtual_mode) 
+#endif
+                               {
+                                       item.Layout ();
+                                       item.DisplayIndex = i;
+                                       item.SetPosition (new Point (x, y));
+                               }
 
+
                        }
 
                        item_control.Size = new Size (layout_wd, layout_ht);
@@ -1897,11 +1898,14 @@
                                        int current_item = group.current_item++;
                                        Point group_items_loc = 
group.items_area_location;
 
-                                       SetItemLocation (i, 0, current_item * 
(item_height + 2) + group_items_loc.Y, 0, 0);
+                                       y = current_item * (item_height + 2) + 
group_items_loc.Y;
+                                       SetItemLocation (i, 0, y, 0, 0);
+                                       item.SetPosition (new Point (0, y));
                                } else
 #endif
                                {
                                        SetItemLocation (i, 0, y, 0, 0);
+                                       item.SetPosition (new Point (0, y));
                                        y += item_height;
                                }
                        }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs  
2007-12-07 01:34:13 UTC (rev 90885)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs  
2007-12-07 01:42:08 UTC (rev 90886)
@@ -52,8 +52,8 @@
                private string image_key = String.Empty;
                string tooltip_text = String.Empty;
                int indent_count;
+#endif
                Point position = new Point (-1, -1);            // cached to 
mimic .Net behaviour
-#endif
                Rectangle bounds;
                Rectangle checkbox_rect;        // calculated by 
CalcListViewItem method
                Rectangle icon_rect;
@@ -467,6 +467,9 @@
                                if (owner != null && owner.VirtualMode)
                                        return owner.GetItemLocation 
(display_index);
 
+                               if (owner != null && !owner.IsHandleCreated)
+                                       return new Point (-1, -1);
+
                                return position;
                        }
                        set {
@@ -879,7 +882,12 @@
                {
                        this.group = group;
                }
+
 #endif
+               internal void SetPosition (Point position)
+               {
+                       this.position = position;
+               }
 
                // When focus changed, we need to invalidate area
                // with previous layout and with the new one
@@ -1279,6 +1287,7 @@
                        {
                                bounds = new Rectangle (x, y, width, height);
                        }
+
                        #endregion // Private Methods
                }
 

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

Reply via email to