Author: calberto
Date: 2007-07-04 19:41:04 -0400 (Wed, 04 Jul 2007)
New Revision: 81360

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:
        * ListView.cs: Set ListView.focused_item from ListViewItem.Focused
        property. Also, invalidate previous focused item in the mentioned
        property (match .Net).

2007-07-04  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-04 23:09:40 UTC (rev 81359)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-04 23:41:04 UTC (rev 81360)
@@ -1,5 +1,11 @@
 2007-07-04  Carlos Alberto Cortez <[EMAIL PROTECTED]>
 
+       * ListView.cs: Set ListView.focused_item from ListViewItem.Focused
+       property. Also, invalidate previous focused item in the mentioned
+       property (match .Net).
+
+2007-07-04  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
        * ListView.cs: Implement 2.0 FocusedItem property setter.
 
 2007-07-03  Carlos Alberto Cortez <[EMAIL PROTECTED]>

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-04 23:09:40 UTC (rev 81359)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-07-04 23:41:04 UTC (rev 81360)
@@ -2701,12 +2701,11 @@
                
                private void SetFocusedItem (ListViewItem item)
                {
-                       if (focused_item != null)
-                               focused_item.Focused = false;
-                       
                        if (item != null)
                                item.Focused = true;
-                               
+                       else if (focused_item != null) // Previous focused item
+                               focused_item.Focused = false;
+
                        focused_item = item;
                }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs  
2007-07-04 23:09:40 UTC (rev 81359)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs  
2007-07-04 23:41:04 UTC (rev 81360)
@@ -272,12 +272,14 @@
                                if (is_focused == value)
                                        return;
 
-                               is_focused = value; 
+                               if (owner != null) {
+                                       if (owner.FocusedItem != null)
+                                               
owner.FocusedItem.UpdateFocusedState (false);
 
-                               Invalidate ();
-                               if (owner != null)
-                                       Layout ();
-                               Invalidate ();
+                                       owner.focused_item = value ? this : 
null;
+                               }
+
+                               UpdateFocusedState (value);
                        }
                }
 
@@ -751,6 +753,16 @@
                }
 #endif
 
+               void UpdateFocusedState (bool is_focused)
+               {
+                       this.is_focused = is_focused;
+                       if (owner != null) {
+                               Invalidate ();
+                               Layout ();
+                               Invalidate ();
+                       }
+               }
+
                internal void Invalidate ()
                {
                        if (owner == null || owner.item_control == null)

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

Reply via email to