Author: mkestner
Date: 2007-01-05 10:56:18 -0500 (Fri, 05 Jan 2007)
New Revision: 70535

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
Log:

2007-01-05  Mike Kestner  <[EMAIL PROTECTED]>

        * ListView.cs: implement PgUp/PgDn for Details view.  Also
        fixes First/LastVisibleIndex to use the item_control.ClientRect 
        instead of the parent control.  Fixes #80378.


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-05 14:57:11 UTC (rev 70534)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-05 15:56:18 UTC (rev 70535)
@@ -1,3 +1,9 @@
+2007-01-05  Mike Kestner  <[EMAIL PROTECTED]>
+
+       * ListView.cs: implement PgUp/PgDn for Details view.  Also
+       fixes First/LastVisibleIndex to use the item_control.ClientRect 
+       instead of the parent control.  Fixes #80378.
+
 2006-01-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * PageSetupDialog.cs : cosmetic refactoring; use RegionInfo to

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-01-05 14:57:11 UTC (rev 70534)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-01-05 15:56:18 UTC (rev 70535)
@@ -722,10 +722,10 @@
                        get {                                                   
                                for (int i = FirstVisibleIndex; i < 
Items.Count; i++) {
                                        if (View == View.List || Alignment == 
ListViewAlignment.Left) {
-                                               if (Items[i].Bounds.X > 
ClientRectangle.Right)
+                                               if (Items[i].Bounds.X > 
item_control.ClientRectangle.Right)
                                                        return i - 1;           
                        
                                        } else {
-                                               if (Items[i].Bounds.Y > 
ClientRectangle.Bottom)
+                                               if (Items[i].Bounds.Y > 
item_control.ClientRectangle.Bottom)
                                                        return i - 1;           
                        
                                        }
                                }
@@ -1260,12 +1260,43 @@
                        int result = -1;
 
                        if (View == View.Details) {
-                               if (key == Keys.Up)
+                               switch (key) {
+                               case Keys.Up:
                                        result = FocusedItem.Index - 1;
-                               else if (key == Keys.Down) {
+                                       break;
+                               case Keys.Down:
                                        result = FocusedItem.Index + 1;
                                        if (result == items.Count)
                                                result = -1;
+                                       break;
+                               case Keys.PageDown:
+                                       int last_index = LastVisibleIndex;
+                                       if (Items [last_index].Bounds.Bottom > 
item_control.ClientRectangle.Bottom)
+                                               last_index--;
+                                       if (FocusedItem.Index == last_index) {
+                                               if (FocusedItem.Index < 
Items.Count - 1) {
+                                                       int page_size = 
item_control.Height / items [0].Bounds.Height - 1;
+                                                       result = 
FocusedItem.Index + page_size - 1;
+                                                       if (result >= 
Items.Count)
+                                                               result = 
Items.Count - 1;
+                                               }
+                                       } else
+                                               result = last_index;
+                                       break;
+                               case Keys.PageUp:
+                                       int first_index = FirstVisibleIndex;
+                                       if (Items [first_index].Bounds.Y < 0)
+                                               first_index++;
+                                       if (FocusedItem.Index == first_index) {
+                                               if (first_index > 0) {
+                                                       int page_size = 
item_control.Height / items [0].Bounds.Height - 1;
+                                                       result = first_index - 
page_size + 1;
+                                                       if (result < 0)
+                                                               result = 0;
+                                               }
+                                       } else
+                                               result = first_index;
+                                       break;
                                }
                                return result;
                        }
@@ -1396,6 +1427,8 @@
                        case Keys.Right:
                        case Keys.Up:                           
                        case Keys.Down:
+                       case Keys.PageUp:
+                       case Keys.PageDown:
                                SelectIndex (GetAdjustedIndex (key_data));
                                break;
 
@@ -2273,10 +2306,12 @@
                        if (view_rect.Contains (bounds))
                                return;
 
-                       if (bounds.Left < 0)
-                               h_scroll.Value += bounds.Left;
-                       else if (bounds.Right > view_rect.Right)
-                               h_scroll.Value += (bounds.Right - 
view_rect.Right);
+                       if (View != View.Details) {
+                               if (bounds.Left < 0)
+                                       h_scroll.Value += bounds.Left;
+                               else if (bounds.Right > view_rect.Right)
+                                       h_scroll.Value += (bounds.Right - 
view_rect.Right);
+                       }
 
                        if (bounds.Top < 0)
                                v_scroll.Value += bounds.Top;

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

Reply via email to