Author: mkestner
Date: 2006-05-18 15:16:26 -0400 (Thu, 18 May 2006)
New Revision: 60832
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
Log:
2006-05-18 Mike Kestner <[EMAIL PROTECTED]>
* ListView.cs: do focused item selection like MS on clicks.
Rework focus handling for ItemControl so LostFocus invalidates as
well.
* ThemeWin32Classic.cs: only draw focus rectangle for ListViewItems if
the ListView ItemControl has focus.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
2006-05-18 18:47:23 UTC (rev 60831)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
2006-05-18 19:16:26 UTC (rev 60832)
@@ -328,8 +328,6 @@
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
public ListViewItem FocusedItem {
get {
- if (focused_item == null && Focused &&
items.Count > 0)
- focused_item = items [0];
return focused_item;
}
}
@@ -1240,6 +1238,8 @@
MouseHover += new EventHandler(ItemsMouseHover);
MouseUp += new MouseEventHandler(ItemsMouseUp);
MouseWheel += new
MouseEventHandler(ItemsMouseWheel);
+ GotFocus += new EventHandler (FocusChanged);
+ LostFocus += new EventHandler (FocusChanged);
}
void ItemsDoubleClick (object sender, EventArgs e)
@@ -1425,8 +1425,6 @@
else if (me.Clicks == 1 && clicked_item
!= null)
owner.OnClick (EventArgs.Empty);
} else {
- if (owner.FocusedItem == null)
- owner.SetFocusedItem
(owner.Items [0]);
if (owner.MultiSelect) {
Keys mods =
XplatUI.State.ModifierKeys;
if ((mods & Keys.Shift) != 0)
@@ -1550,6 +1548,17 @@
}
}
+ void FocusChanged (object o, EventArgs args)
+ {
+ if (owner.Items.Count == 0)
+ return;
+
+ if (owner.FocusedItem == null)
+ owner.SetFocusedItem (owner.Items [0]);
+
+ Invalidate (owner.FocusedItem.Bounds);
+ }
+
internal override void OnPaintInternal (PaintEventArgs
pe)
{
ThemeEngine.Current.DrawListViewItems
(pe.Graphics, pe.ClipRectangle, owner);
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
2006-05-18 18:47:23 UTC (rev 60831)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
2006-05-18 19:16:26 UTC (rev 60832)
@@ -1614,7 +1614,7 @@
}
}
- if (item.Focused) {
+ if (item.Focused && control.item_control.Focused) {
Rectangle focus_rect = text_rect;
if (control.FullRowSelect && control.View ==
View.Details) {
int width = 0;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches