Author: jackson
Date: 2006-06-01 16:48:42 -0400 (Thu, 01 Jun 2006)
New Revision: 61386

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
Log:

        * TreeView.cs: Set the default border style in the constructor.
        - Move painting to use OnPaintInternal instead of capturing
        WM_PAINT, this is the correct way of doing things
        - UpdateBelow shouldn't invalidate the scrollbar area
        - Cap the top on update below in case the node was above the top
        of the viewport rectangle.
        - ExpandBelow and Collapse below need to obey Begin/End Update.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-01 20:23:22 UTC (rev 61385)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-01 20:48:42 UTC (rev 61386)
@@ -1,6 +1,12 @@
 2006-06-01  Jackson Harper  <[EMAIL PROTECTED]>
 
        * TreeView.cs: Set the default border style in the constructor.
+       - Move painting to use OnPaintInternal instead of capturing
+       WM_PAINT, this is the correct way of doing things
+       - UpdateBelow shouldn't invalidate the scrollbar area
+       - Cap the top on update below in case the node was above the top
+       of the viewport rectangle.
+       - ExpandBelow and Collapse below need to obey Begin/End Update.
 
 2006-06-01  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs      
2006-06-01 20:23:22 UTC (rev 61385)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs      
2006-06-01 20:48:42 UTC (rev 61386)
@@ -460,7 +460,8 @@
                #endregion      // Protected Instance Properties
 
                #region Public Instance Methods
-               public void BeginUpdate () {
+               public void BeginUpdate ()
+               {
                        update_stack++;
                }
 
@@ -740,14 +741,7 @@
 
                protected override void WndProc(ref Message m) {
                        switch ((Msg) m.Msg) {
-                       case Msg.WM_PAINT: {                            
-                               PaintEventArgs  paint_event;
 
-                               paint_event = XplatUI.PaintEventStart (Handle, 
true);
-                               DoPaint (paint_event);
-                               XplatUI.PaintEventEnd (Handle, true);
-                               return;
-                       }
                        case Msg.WM_LBUTTONDBLCLK:
                                int val = m.LParam.ToInt32();
                                DoubleClickHandler (null, new
@@ -938,13 +932,14 @@
                        }
 
                        if (node == root_node) {
-                               Invalidate ();
+                               Invalidate (ViewportRectangle);
                                return;
                        }
                                
                        // We need to update the current node so the plus/minus 
block gets update too
-                       Rectangle invalid = new Rectangle (0, node.Bounds.Top - 
1,
-                                       Width, Height - node.Bounds.Top + 1);
+                       int top = Math.Max (node.Bounds.Top - 1, 0);
+                       Rectangle invalid = new Rectangle (0, top,
+                                       Width, Height - top);
                        Invalidate (invalid);
                }
 
@@ -987,11 +982,8 @@
                        Invalidate (new Rectangle (l, node.Bounds.Top, 8, 
node.Bounds.Height));
                }
 
-               private void DoPaint (PaintEventArgs pe)
+               internal override void OnPaintInternal (PaintEventArgs pe)
                {
-                       if (Width <= 0 || Height <=  0 || Visible == false)
-                               return;
-
                        Draw (pe.ClipRectangle, pe.Graphics);
                }
 
@@ -1030,7 +1022,6 @@
                                        continue;
                                }
 
-
                                if (current.GetY () > clip.Bottom) {
                                        break;
                                }
@@ -1396,6 +1387,11 @@
 
                internal void ExpandBelow (TreeNode node, int count_to_next)
                {
+                       if (update_stack > 0) {
+                               update_needed = true;
+                               return;
+                       }
+
                        Rectangle below = new Rectangle (0, node.Bounds.Bottom, 
ViewportRectangle.Width,
                                        ViewportRectangle.Height - 
node.Bounds.Bottom);
                                
@@ -1412,6 +1408,11 @@
 
                internal void CollapseBelow (TreeNode node, int count_to_next)
                {
+                       if (update_stack > 0) {
+                               update_needed = true;
+                               return;
+                       }
+
                        Rectangle below = new Rectangle (0, node.Bounds.Bottom, 
ViewportRectangle.Width,
                                        ViewportRectangle.Height - 
node.Bounds.Bottom);
                        int amount = count_to_next * ItemHeight;

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

Reply via email to