Author: calberto
Date: 2007-06-25 14:33:10 -0400 (Mon, 25 Jun 2007)
New Revision: 80712

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

        * ListView.cs: Implement 2.0 HitTest methods.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-06-25 18:17:10 UTC (rev 80711)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-06-25 18:33:10 UTC (rev 80712)
@@ -1,3 +1,7 @@
+2007-06-25  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * ListView.cs: Implement 2.0 HitTest methods.
+
 2007-06-24  Carlos Alberto Cortez <[EMAIL PROTECTED]>
 
        * ListViewItem.cs: Add a 2.0 bool Hot property, to tell whether the

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-06-25 18:17:10 UTC (rev 80711)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-06-25 18:33:10 UTC (rev 80712)
@@ -3112,6 +3112,41 @@
                }
 
 #if NET_2_0
+               public ListViewHitTestInfo HitInfo (Point pt)
+               {
+                       return HitInfo (pt.X, pt.Y);
+               }
+
+               public ListViewHitTestInfo HitInfo (int x, int y)
+               {
+                       if (x < 0)
+                               throw new ArgumentOutOfRangeException ("x");
+                       if (y < 0)
+                               throw new ArgumentOutOfRangeException ("y");
+
+                       ListViewItem item = GetItemAt (x, y);
+                       if (item == null)
+                               return new ListViewHitTestInfo (null, null, 
ListViewHitTestLocations.None);
+
+                       ListViewHitTestLocations locations = 0;
+                       if (item.GetBounds (ItemBoundsPortion.Label).Contains 
(x, y))
+                               locations |= ListViewHitTestLocations.Label;
+                       else if (item.GetBounds 
(ItemBoundsPortion.Icon).Contains (x, y))
+                               locations |= ListViewHitTestLocations.Image;
+                       else if (item.CheckRectReal.Contains (x, y))
+                               locations |= 
ListViewHitTestLocations.StateImage;
+
+                       ListViewItem.ListViewSubItem subitem = null;
+                       if (view == View.Details)
+                               foreach (ListViewItem.ListViewSubItem si in 
item.SubItems)
+                                       if (si.Bounds.Contains (x, y)) {
+                                               subitem = si;
+                                               break;
+                                       }
+
+                       return new ListViewHitTestInfo (item, subitem, 
locations);
+               }
+
                public void RedrawItems (int startIndex, int endIndex, bool 
invalidateOnly)
                {
                        if (startIndex < 0 || startIndex >= items.Count)

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

Reply via email to