New tests.
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ThemeWin32Classic.cs
index a4f14df376eb50d88572d8269996535a086ff7a1..42a533043ed860e3d9b2ec27a95307eb9278703e 100644 (file)
@@ -2223,6 +2223,7 @@ namespace System.Windows.Forms
 
                        // PaintCells at row, column
                        int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount;
+                       DataGridCell current_cell = grid.CurrentCell;
 
                        if (column_cnt > 0) {
                                Region prev_clip = g.Clip;
@@ -2243,14 +2244,24 @@ namespace System.Windows.Forms
                                                current_clip.Intersect (prev_clip);
                                                g.Clip = current_clip;
 
+                                               Brush colBackBrush = backBrush;
+                                               Brush colForeBrush = foreBrush;
+
+                                               // If we are in the precise cell we are editing, then use the normal colors
+                                               // even if we are selected.
+                                               if (grid.is_editing && column == current_cell.ColumnNumber && row == current_cell.RowNumber) {
+                                                       colBackBrush = ResPool.GetSolidBrush (grid.BackColor);
+                                                       colForeBrush = ResPool.GetSolidBrush (grid.ForeColor);
+                                               }
+
                                                if (is_newrow) {
                                                        grid.CurrentTableStyle.GridColumnStyles[column].PaintNewRow (g, rect_cell, 
-                                                                                                                    backBrush,
-                                                                                                                    foreBrush);
+                                                                                                                    colBackBrush,
+                                                                                                                    colForeBrush);
                                                } else {
                                                        grid.CurrentTableStyle.GridColumnStyles[column].Paint (g, rect_cell, grid.ListManager, row,
-                                                                                                              backBrush,
-                                                                                                              foreBrush,
+                                                                                                              colBackBrush,
+                                                                                                              colForeBrush,
                                                                                                               grid.RightToLeft == RightToLeft.Yes);
                                                }
 
@@ -3168,7 +3179,7 @@ namespace System.Windows.Forms
                        Rectangle header_bounds = group.HeaderBounds;
                        text_bounds.Offset (8, 0);
                        text_bounds.Inflate (-8, 0);
-                       Size text_size = control.text_size;
+                       int text_height = control.Font.Height + 2; // add a tiny padding between the text and the group line
 
                        Font font = new Font (control.Font, control.Font.Style | FontStyle.Bold);
                        Brush brush = new LinearGradientBrush (new Point (header_bounds.Left, 0), new Point (header_bounds.Left + ListViewGroupLineWidth, 0), 
@@ -3190,8 +3201,8 @@ namespace System.Windows.Forms
 
                        sformat.LineAlignment = StringAlignment.Near;
                        dc.DrawString (group.Header, font, SystemBrushes.ControlText, text_bounds, sformat);
-                       dc.DrawLine (pen, header_bounds.Left, header_bounds.Top + text_size.Height, header_bounds.Left + ListViewGroupLineWidth, 
-                                       header_bounds.Top + text_size.Height);
+                       dc.DrawLine (pen, header_bounds.Left, header_bounds.Top + text_height, header_bounds.Left + ListViewGroupLineWidth, 
+                                       header_bounds.Top + text_height);
 
                        sformat.Dispose ();
                        font.Dispose ();
@@ -5518,6 +5529,16 @@ namespace System.Windows.Forms
                        balloon_window.Show ();
                }
 
+               public override void HideBalloonWindow (IntPtr handle)
+               {
+                       if (balloon_window == null || balloon_window.OwnerHandle != handle)
+                               return;
+
+                       balloon_window.Close ();
+                       balloon_window.Dispose ();
+                       balloon_window = null;
+               }
+
                private const int balloon_iconsize = 16;
                private const int balloon_bordersize = 8;