Author: jackson
Date: 2005-04-18 00:56:03 -0400 (Mon, 18 Apr 2005)
New Revision: 43191

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
Log:
        * TreeView.cs: Calculate plus minus and checkbox bounds when 
        there is a click. This handles offsets for scrolling properly 
        and reduces memory. Also fixed GetNode to not offset now that 
        TopNode works properly.
        * TreeNode.cs: No longer need to track the plus minus or 
        checkbox bounds.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-04-18 04:51:07 UTC (rev 43190)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-04-18 04:56:03 UTC (rev 43191)
@@ -1,10 +1,10 @@
 2005-04-17  Jackson Harper  <[EMAIL PROTECTED]>
 
-       * TreeView.cs: Calculate plus minus bounds when there is a
+       * TreeView.cs: Calculate plus minus and checkbox bounds when there is a
        click. This handles offsets for scrolling properly and reduces
        memory. Also fixed GetNode to not offset now that TopNode works
        properly.
-       * TreeNode.cs: No longer need to track the plus minus bounds.
+       * TreeNode.cs: No longer need to track the plus minus or checkbox 
bounds.
        
 2005-04-17  Jackson Harper  <[EMAIL PROTECTED]>
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs      
2005-04-18 04:51:07 UTC (rev 43190)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs      
2005-04-18 04:56:03 UTC (rev 43191)
@@ -45,7 +45,6 @@
                
                private bool is_expanded = false;
                private Rectangle bounds = Rectangle.Empty;
-               private Rectangle checkbox_bounds = Rectangle.Empty;
                private bool check;
                private bool is_editing;
                internal OwnerDrawPropertyBag prop_bag;
@@ -429,10 +428,6 @@
 
                #region Internal & Private Methods and Properties
 
-               internal Rectangle CheckBoxBounds {
-                       get { return checkbox_bounds; }
-               }
-
                bool BuildFullPath (StringBuilder path)
                {
                        if (parent == null)
@@ -569,14 +564,6 @@
                        bounds.Height = height;
                }
 
-               internal void UpdateCheckBoxBounds (int x, int y, int width, 
int height)
-               {
-                       checkbox_bounds.X = x;
-                       checkbox_bounds.Y = y;
-                       checkbox_bounds.Width = width;
-                       checkbox_bounds.Height = height;
-               }
-
                internal void SetAddedData (TreeView tree_view, TreeNode 
parent, int index)
                {
                        this.tree_view = tree_view;

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs      
2005-04-18 04:51:07 UTC (rev 43190)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs      
2005-04-18 04:56:03 UTC (rev 43191)
@@ -625,11 +625,22 @@
 
                        if (show_root_lines || node.Parent != null)
                                l -= indent;
+                       if (ImageList != null)
+                               l -= ImageList.ImageSize.Width + 3;
                        if (checkboxes)
                                l -= 19;
+                       return (x > l && x < l + 8);
+               }
+
+               private bool IsCheckboxArea (TreeNode node, int x)
+               {
+                       int l = node.Bounds.Left + 5;
+
+                       if (show_root_lines || node.Parent != null)
+                               l -= indent;
                        if (ImageList != null)
                                l -= ImageList.ImageSize.Width + 3;
-                       return (x > l && x < l + 8);
+                       return (x > l && x < l + 10);
                }
 
                internal void SetTop (TreeNode node)
@@ -755,8 +766,6 @@
                {
                        int offset = (ItemHeight - 13);
 
-                       node.UpdateCheckBoxBounds (x + 3, y + offset, 10, 10);
-
                        // new rectangle that factors in line width
                        if (!RectsIntersect (clip, x + 3, y + offset, 12, 12))
                                return;
@@ -1108,7 +1117,7 @@
                        } else if (show_plus_minus && IsPlusMinusArea (node, 
e.X)) {
                                node.Toggle ();
                                return;
-                       } else if (checkboxes && node.CheckBoxBounds.Contains 
(e.X, e.Y)) {
+                       } else if (checkboxes && IsCheckboxArea (node, e.X)) {
                                node.Checked = !node.Checked;
                                return;
                        }

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

Reply via email to