Author: everaldo
Date: 2006-11-09 17:03:23 -0500 (Thu, 09 Nov 2006)
New Revision: 67647

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
Log:
Fix wrong separator size

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-09 21:25:52 UTC (rev 67646)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-09 22:03:23 UTC (rev 67647)
@@ -1,3 +1,8 @@
+2006-11-09  Everaldo Canuto  <[EMAIL PROTECTED]>
+
+       * Toolbar.cs, ToolBarButton.cs: Fix wrong separator size and
+       reduce number of calls to redraw method during toolbar creation.
+
 2006-11-09  Mike Kestner  <[EMAIL PROTECTED]>
 
        * ListView.cs : raise SelectedIndexChanged when an item is selected

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs       
2006-11-09 21:25:52 UTC (rev 67646)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs       
2006-11-09 22:03:23 UTC (rev 67647)
@@ -891,7 +891,7 @@
                                        if (!button.Visible)
                                                continue;
 
-                                       if (size_specified) {
+                                       if (size_specified && (button.Style != 
ToolBarButtonStyle.Separator)) {
                                                if (button.Layout (button_size))
                                                        changed = true;
                                        }
@@ -956,6 +956,7 @@
                        #region instance variables
                        private ArrayList list;
                        private ToolBar owner;
+                       private bool redraw;
                        #endregion
 
                        #region constructors
@@ -963,6 +964,7 @@
                        {
                                this.owner = owner;
                                list = new ArrayList ();
+                               redraw = true;
                        }
                        #endregion
 
@@ -1019,14 +1021,22 @@
                                int result;
                                button.SetParent (owner);
                                result = list.Add (button);
-                               owner.Redraw (true);
+                               if (redraw)
+                                       owner.Redraw (true);
                                return result;
                        }
 
                        public void AddRange (ToolBarButton [] buttons)
                        {
-                               foreach (ToolBarButton button in buttons)
-                                       Add (button);
+                               try {
+                                       redraw = false;
+                                       foreach (ToolBarButton button in 
buttons)
+                                               Add (button);
+                               }
+                               finally {
+                                       redraw = true;
+                                       owner.Redraw (true);
+                               }
                        }
 
                        public void Clear ()

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs 
2006-11-09 21:25:52 UTC (rev 67646)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs 
2006-11-09 22:03:23 UTC (rev 67647)
@@ -308,7 +308,7 @@
 
                        Size psize = Parent.ButtonSize;
                        Size size = psize;
-                       if (!Parent.SizeSpecified) {
+                       if ((!Parent.SizeSpecified) || (Style == 
ToolBarButtonStyle.Separator)) {
                                size = CalculateSize ();
                                if (size.Width == 0 || size.Height == 0)
                                        size = psize;

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

Reply via email to