Author: aolk
Date: 2006-05-19 13:23:04 -0400 (Fri, 19 May 2006)
New Revision: 60872

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
Log:
2006-05-19  Alexander Olk  <[EMAIL PROTECTED]>

        * FileDialog.cs: Added focus handling for PopupButtonPanel.
          Fixes part 1 and 2 of bug #78446

        * XplatUIX11.cs (SetWindowPos): Recalculate claient area size on resizes


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-19 16:47:27 UTC (rev 60871)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-19 17:23:04 UTC (rev 60872)
@@ -1,6 +1,11 @@
+2006-05-19  Alexander Olk  <[EMAIL PROTECTED]>
+
+       * FileDialog.cs: Added focus handling for PopupButtonPanel.
+         Fixes part 1 and 2 of bug #78446
+
 2006-05-19  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
 
-       * XplatUIX11.cs (SetWindowPos): Recalculate client area size on resizes
+       * XplatUIX11.cs (SetWindowPos): Recalculate claient area size on resizes
          instead of sticking to the first ever calculated value
 
 2006-05-19  Mike Kestner  <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-05-19 16:47:27 UTC (rev 60871)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-05-19 17:23:04 UTC (rev 60872)
@@ -1319,7 +1319,7 @@
                        }
                }
                
-               internal class PopupButtonPanel : Panel {
+               internal class PopupButtonPanel : Control {
                        internal class PopupButton : Control {
                                internal enum PopupButtonState { Normal, Down, 
Up}
                                
@@ -1408,13 +1408,20 @@
                                {
                                        if (popupButtonState != 
PopupButtonState.Down)
                                                popupButtonState = 
PopupButtonState.Up;
+                                       
+                                       PopupButtonPanel panel = Parent as 
PopupButtonPanel;
+                                       
+                                       if (panel.focusButton != null && 
panel.focusButton.ButtonState == PopupButtonState.Up) {
+                                               panel.focusButton.ButtonState = 
PopupButtonState.Normal;
+                                               panel.focusButton = null;
+                                       }
                                        Refresh ();
                                        base.OnMouseEnter (e);
                                }
                                
                                protected override void OnMouseLeave (EventArgs 
e)
                                {
-                                       if (popupButtonState != 
PopupButtonState.Down)
+                                       if (popupButtonState == 
PopupButtonState.Up)
                                                popupButtonState = 
PopupButtonState.Normal;
                                        Refresh ();
                                        base.OnMouseLeave (e);
@@ -1437,6 +1444,7 @@
                        private PopupButton networkButton;
                        
                        private PopupButton lastPopupButton = null;
+                       private PopupButton focusButton = null;
                        
                        private int platform = (int) 
Environment.OSVersion.Platform;
                        
@@ -1446,7 +1454,6 @@
                                
                                SuspendLayout ();
                                
-                               BorderStyle = BorderStyle.Fixed3D;
                                BackColor = Color.FromArgb (128, 128, 128);
                                Size = new Size (85, 336);
                                
@@ -1460,7 +1467,7 @@
                                recentlyusedButton.Image = 
ThemeEngine.Current.Images (UIIcon.PlacesRecentDocuments, 30);
                                recentlyusedButton.BackColor = BackColor;
                                recentlyusedButton.ForeColor = Color.White;
-                               recentlyusedButton.Location = new Point (0, 0);
+                               recentlyusedButton.Location = new Point (2, 2);
                                recentlyusedButton.Text = "Recently\nused";
                                recentlyusedButton.Click += new EventHandler 
(OnClickButton);
                                
@@ -1468,7 +1475,7 @@
                                desktopButton.BackColor = BackColor;
                                desktopButton.ForeColor = Color.White;
                                desktopButton.Size = new Size (81, 64);
-                               desktopButton.Location = new Point (0, 64);
+                               desktopButton.Location = new Point (2, 66);
                                desktopButton.Text = "Desktop";
                                desktopButton.Click += new EventHandler 
(OnClickButton);
                                
@@ -1476,7 +1483,7 @@
                                personalButton.BackColor = BackColor;
                                personalButton.ForeColor = Color.White;
                                personalButton.Size = new Size (81, 64);
-                               personalButton.Location = new Point (0, 128);
+                               personalButton.Location = new Point (2, 130);
                                personalButton.Text = "Personal";
                                personalButton.Click += new EventHandler 
(OnClickButton);
                                
@@ -1484,7 +1491,7 @@
                                mycomputerButton.BackColor = BackColor;
                                mycomputerButton.ForeColor = Color.White;
                                mycomputerButton.Size = new Size (81, 64);
-                               mycomputerButton.Location = new Point (0, 192);
+                               mycomputerButton.Location = new Point (2, 194);
                                mycomputerButton.Text = "My Computer";
                                mycomputerButton.Click += new EventHandler 
(OnClickButton);
                                
@@ -1492,7 +1499,7 @@
                                networkButton.BackColor = BackColor;
                                networkButton.ForeColor = Color.White;
                                networkButton.Size = new Size (81, 64);
-                               networkButton.Location = new Point (0, 256);
+                               networkButton.Location = new Point (2, 258);
                                networkButton.Text = "My Network";
                                networkButton.Click += new EventHandler 
(OnClickButton);
                                
@@ -1595,6 +1602,28 @@
                                        }
                                }
                        }
+                       
+                       protected override void OnPaint (PaintEventArgs e)
+                       {
+                               ControlPaint.DrawBorder3D (e.Graphics, 
ClientRectangle, Border3DStyle.Sunken);
+                               base.OnPaint (e);
+                       }
+                       
+                       protected override void OnGotFocus (EventArgs e)
+                       {
+                               if (lastPopupButton != recentlyusedButton) {
+                                       recentlyusedButton.ButtonState = 
PopupButton.PopupButtonState.Up;
+                                       focusButton = recentlyusedButton;
+                               }
+                               base.OnGotFocus (e);
+                       }
+                       
+                       protected override void OnLostFocus (EventArgs e)
+                       {
+                               if (focusButton != null && 
focusButton.ButtonState != PopupButton.PopupButtonState.Down)
+                                       focusButton.ButtonState = 
PopupButton.PopupButtonState.Normal;
+                               base.OnLostFocus (e);
+                       }
                }
        }
        

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

Reply via email to