Author: mkestner
Date: 2006-05-19 10:36:57 -0400 (Fri, 19 May 2006)
New Revision: 60862

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/ThemeWin32Classic.cs
Log:

2006-05-18  Mike Kestner  <[EMAIL PROTECTED]>

        * ListView.cs: match MS behavior in Details view where items are not
        drawn if Columns.Count == 0. 
        * ThemeWin32Classic.cs: only highlight ListView selection if focused.
        Use a separate pen to draw the check, since changing the width affects
        the box as well.  Fixes #78454.


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-19 14:34:14 UTC (rev 60861)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-19 14:36:57 UTC (rev 60862)
@@ -1,3 +1,11 @@
+2006-05-18  Mike Kestner  <[EMAIL PROTECTED]>
+
+       * ListView.cs: match MS behavior in Details view where items are not
+       drawn if Columns.Count == 0. 
+       * ThemeWin32Classic.cs: only highlight ListView selection if focused.
+       Use a separate pen to draw the check, since changing the width affects
+       the box as well.  Fixes #78454.
+
 2006-05-18  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * ListView.cs: ArgumentOutOfRangeException, single versions of the

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-19 14:34:14 UTC (rev 60861)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2006-05-19 14:36:57 UTC (rev 60862)
@@ -911,6 +911,7 @@
                {
                        header_control.Visible = false;
                        header_control.Size = Size.Empty;
+                       item_control.Visible = true;
                        item_control.Location = Point.Empty;
 
                        if (items.Count == 0)
@@ -963,7 +964,7 @@
 
                void LayoutHeader ()
                {
-                       if (columns.Count == 0 || header_style == 
ColumnHeaderStyle.None) {
+                       if (header_style == ColumnHeaderStyle.None) {
                                header_control.Visible = false;
                                header_control.Size = Size.Empty;
                                return;
@@ -983,13 +984,20 @@
 
                        header_control.Width = x;
                        header_control.Height = columns [0].Ht;
-                       header_control.is_visible = true;
+                       header_control.Visible = true;
                }
 
                void LayoutDetails ()
                {
+                       if (columns.Count == 0) {
+                               header_control.Visible = false;
+                               item_control.Visible = false;
+                               return;
+                       }
+
                        LayoutHeader ();
 
+                       item_control.Visible = true;
                        item_control.Location = new Point (0, 
header_control.Height);
 
                        int y = 0; 
@@ -1179,7 +1187,7 @@
 
                private void ListView_KeyDown (object sender, KeyEventArgs ke)
                {                       
-                       if (ke.Handled || Items.Count == 0)
+                       if (ke.Handled || Items.Count == 0 || 
!item_control.Visible)
                                return;
 
                        int index = -1;

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-19 14:34:14 UTC (rev 60861)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs 
    2006-05-19 14:36:57 UTC (rev 60862)
@@ -1473,16 +1473,16 @@
 
                                        // Need to draw a check-mark
                                        if (item.Checked) {
-                                               pen.Width = 1;
+                                               Pen check_pen = 
ResPool.GetSizedPen (this.ColorWindowText, 1);
                                                // adjustments to get the 
check-mark at the right place
                                                rect.X ++; rect.Y ++;
                                                // following logic is taken 
from DrawFrameControl method
                                                for (int i = 0; i < check_wd; 
i++) {
-                                                       dc.DrawLine (pen, 
rect.Left + check_wd / 2,
+                                                       dc.DrawLine (check_pen, 
rect.Left + check_wd / 2,
                                                                     rect.Top + 
check_wd + i,
                                                                     rect.Left 
+ check_wd / 2 + 2 * scale,
                                                                     rect.Top + 
check_wd + 2 * scale + i);
-                                                       dc.DrawLine (pen,
+                                                       dc.DrawLine (check_pen,
                                                                     rect.Left 
+ check_wd / 2 + 2 * scale,
                                                                     rect.Top + 
check_wd + 2 * scale + i,
                                                                     rect.Left 
+ check_wd / 2 + 6 * scale,
@@ -1526,7 +1526,7 @@
                        if (!control.LabelWrap)
                                format.FormatFlags = StringFormatFlags.NoWrap;
                        
-                       if (item.Selected) {
+                       if (item.Selected && control.item_control.Focused) {
                                if (control.View == View.Details) {
                                        if (control.FullRowSelect) {
                                                dc.FillRectangle 
(SystemBrushes.Highlight, text_rect);
@@ -1551,7 +1551,7 @@
                                dc.FillRectangle (ResPool.GetSolidBrush 
(item.BackColor), text_rect);
 
                        if (item.Text != null && item.Text.Length > 0) {
-                               if (item.Selected)
+                               if (item.Selected && 
control.item_control.Focused)
                                        dc.DrawString (item.Text, item.Font, 
SystemBrushes.HighlightText, text_rect, format);
                                else
                                        dc.DrawString (item.Text, item.Font, 
this.ResPool.GetSolidBrush

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

Reply via email to