Author: calberto
Date: 2007-07-05 04:37:38 -0400 (Thu, 05 Jul 2007)
New Revision: 81376

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
Log:
        * ListView.cs: Implement the so-incredibly broken 2.0 
        VirtualItemsSelectionRangeChanged event.

2007-07-05  Carlos Alberto Cortez <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-05 08:26:57 UTC (rev 81375)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-05 08:37:38 UTC (rev 81376)
@@ -1,5 +1,10 @@
 2007-07-05  Carlos Alberto Cortez <[EMAIL PROTECTED]>
 
+       * ListView.cs: Implement the so-incredibly broken 2.0 
+       VirtualItemsSelectionRangeChanged event.
+
+2007-07-05  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
        * ListView.cs: When enter is pressed and selection is non empty,
        an OnItemActivate event must be fired.
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-07-05 08:26:57 UTC (rev 81375)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-07-05 08:37:38 UTC (rev 81376)
@@ -133,6 +133,7 @@
                static object ItemSelectionChangedEvent = new object ();
                static object CacheVirtualItemsEvent = new object ();
                static object RetrieveVirtualItemEvent = new object ();
+               static object VirtualItemsSelectionRangeChangedEvent = new 
object ();
 #endif
 
                public event LabelEditEventHandler AfterLabelEdit {
@@ -237,6 +238,11 @@
                        add { Events.AddHandler (RetrieveVirtualItemEvent, 
value); }
                        remove { Events.RemoveHandler 
(RetrieveVirtualItemEvent, value); }
                }
+
+               public event 
ListViewVirtualItemsSelectionRangeChangedEventHandler 
VirtualItemsSelectionRangeChanged {
+                       add { Events.AddHandler 
(VirtualItemsSelectionRangeChangedEvent, value); }
+                       remove { Events.RemoveHandler 
(VirtualItemsSelectionRangeChangedEvent, value); }
+               }
 #endif
 
                #endregion // Events
@@ -2132,6 +2138,15 @@
                                                clicked_item.Selected = true;
                                        }
 
+#if NET_2_0
+                                       if (owner.VirtualMode && changed) {
+                                               // Broken event - It's not 
fired from Item.Selected also
+                                               
ListViewVirtualItemsSelectionRangeChangedEventArgs args = 
+                                                       new 
ListViewVirtualItemsSelectionRangeChangedEventArgs (0, owner.items.Count - 1, 
false);
+
+                                               
owner.OnVirtualItemsSelectionRangeChanged (args);
+                                       }
+#endif
                                        // Report clicks only if the item was 
clicked. On MS the
                                        // clicks are only raised if you click 
an item
                                        clicks = me.Clicks;
@@ -2943,6 +2958,14 @@
                        if (eh != null)
                                eh (this, args);
                }
+
+               protected virtual void OnVirtualItemsSelectionRangeChanged 
(ListViewVirtualItemsSelectionRangeChangedEventArgs args)
+               {
+                       ListViewVirtualItemsSelectionRangeChangedEventHandler 
eh = 
+                               
(ListViewVirtualItemsSelectionRangeChangedEventHandler) Events 
[VirtualItemsSelectionRangeChangedEvent];
+                       if (eh != null)
+                               eh (this, args);
+               }
 #endif
 
                protected void RealizeProperties ()

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

Reply via email to