2006-05-15 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / PropertyGridView.cs
index 83ebe51d0602794100a0882360f6672c99384cf4..21ef041b0e6a56cfc1a96157855399b3e37109e9 100644 (file)
@@ -31,6 +31,7 @@ using System.Collections;
 using System.Drawing;
 using System.Drawing.Design;
 using System.ComponentModel;
+using System.Threading;
 using System.Windows.Forms.Design;
 
 namespace System.Windows.Forms.PropertyGridInternal {
@@ -150,9 +151,6 @@ namespace System.Windows.Forms.PropertyGridInternal {
                        // Grid
                        DrawGrid(e);
 
-                       // Border
-                       e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,Width-1,Height-1 );
-                       
                        UpdateScrollBar();
                        
                        base.OnPaint(e);
@@ -369,7 +367,7 @@ namespace System.Windows.Forms.PropertyGridInternal {
 
                                int xLoc = SplitterLocation+1;
                                if (paintsValue) {
-                                       pevent.Graphics.DrawRectangle(ThemeEngine.Current.ResPool.GetPen(Color.Black), SplitterLocation+2,rect.Y+2, 20, row_height-4);
+                                       pevent.Graphics.DrawRectangle(Pens.Black, SplitterLocation+2,rect.Y+2, 20, row_height-4);
                                        try {
                                                editor.PaintValue(grid_item.Value, pevent.Graphics, new Rectangle(SplitterLocation+3,rect.Y+3, 19, row_height-5));
                                        }
@@ -423,11 +421,12 @@ namespace System.Windows.Forms.PropertyGridInternal {
 
                private Rectangle DrawPlusMinus (Graphics g, int x, int y, bool expanded, bool category) {
                        Rectangle bounds = new Rectangle(x, y, 8, 8);
-                       if (!category) g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush(Color.White), bounds);
-                       g.DrawRectangle (SystemPens.ControlDark, bounds);
-                       g.DrawLine (SystemPens.ControlDark, x+2, y+4, x + 6, y+4);
+                       if (!category) g.FillRectangle (Brushes.White, bounds);
+                       Pen pen = ThemeEngine.Current.ResPool.GetPen (property_grid.ViewForeColor);
+                       g.DrawRectangle (pen, bounds);
+                       g.DrawLine (pen, x+2, y+4, x + 6, y+4);
                        if (!expanded)
-                               g.DrawLine (SystemPens.ControlDark, x+4, y+2, x+4, y+6);
+                               g.DrawLine (pen, x+4, y+2, x+4, y+6);
 
                        return bounds;
                }
@@ -527,8 +526,8 @@ namespace System.Windows.Forms.PropertyGridInternal {
                                listBox.MouseUp+=new MouseEventHandler(listBox_MouseUp);
                                dropdown_form.Controls.Clear();
                                dropdown_form.Controls.Add(listBox);
-                               dropdown_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+row_height));
-                               dropdown_form.Width = grid_textbox.Width;
+                               dropdown_form.Location = PointToScreen(new Point(SplitterLocation,grid_textbox.Location.Y+row_height));
+                               dropdown_form.Width = this.Width - this.SplitterLocation;
                                dropdown_form.Show();
                        }
                        else { // use editor
@@ -611,18 +610,21 @@ namespace System.Windows.Forms.PropertyGridInternal {
                }
 
                public void DropDownControl(Control control) {
+                       Object  queue_id;
+
                        dropdown_form.Deactivate +=new EventHandler(dropdown_form_Deactivate);
                        dropdown_form.Size = control.Size;
                        control.Dock = DockStyle.Fill;
                        dropdown_form.Controls.Clear();
                        dropdown_form.Controls.Add(control);
-                       dropdown_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+row_height));
-                       dropdown_form.Width = grid_textbox.Width;
+                       dropdown_form.Location = PointToScreen(new Point(SplitterLocation,grid_textbox.Location.Y+row_height));
+                       dropdown_form.Width = Width - SplitterLocation;
 
                        dropdown_form_showing = true;
                        dropdown_form.Show();
                        System.Windows.Forms.MSG msg = new MSG();
-                       while (XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0) && dropdown_form_showing) {
+                       queue_id = XplatUI.StartLoop(Thread.CurrentThread);
+                       while (XplatUI.GetMessage(queue_id, ref msg, IntPtr.Zero, 0, 0) && dropdown_form_showing) {
                                XplatUI.TranslateMessage(ref msg);
                                XplatUI.DispatchMessage(ref msg);
                        }
@@ -634,9 +636,6 @@ namespace System.Windows.Forms.PropertyGridInternal {
 
                #endregion
 
-               #region DropDownForm Class
-               #endregion DropDownForm Class
-
                #region Internal Classes
                internal class ITypeDescriptorContextImpl : System.ComponentModel.ITypeDescriptorContext {
                        private PropertyGrid property_grid;