Author: jackson
Date: 2005-04-18 00:41:13 -0400 (Mon, 18 Apr 2005)
New Revision: 43183
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 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.
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:17:27 UTC (rev 43182)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2005-04-18 04:41:13 UTC (rev 43183)
@@ -1,3 +1,11 @@
+2005-04-17 Jackson Harper <[EMAIL PROTECTED]>
+
+ * TreeView.cs: Calculate plus minus 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.
+
2005-04-17 Jackson Harper <[EMAIL PROTECTED]>
* CursorConverter.cs: Initial implementation.
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:17:27 UTC (rev 43182)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
2005-04-18 04:41:13 UTC (rev 43183)
@@ -45,7 +45,6 @@
private bool is_expanded = false;
private Rectangle bounds = Rectangle.Empty;
- private Rectangle plus_minus_bounds = Rectangle.Empty;
private Rectangle checkbox_bounds = Rectangle.Empty;
private bool check;
private bool is_editing;
@@ -429,9 +428,6 @@
#endregion // Public Instance Methods
#region Internal & Private Methods and Properties
- internal Rectangle PlusMinusBounds {
- get { return plus_minus_bounds; }
- }
internal Rectangle CheckBoxBounds {
get { return checkbox_bounds; }
@@ -573,14 +569,6 @@
bounds.Height = height;
}
- internal void UpdatePlusMinusBounds (int x, int y, int width,
int height)
- {
- plus_minus_bounds.X = x;
- plus_minus_bounds.Y = y;
- plus_minus_bounds.Width = width;
- plus_minus_bounds.Height = height;
- }
-
internal void UpdateCheckBoxBounds (int x, int y, int width,
int height)
{
checkbox_bounds.X = x;
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:17:27 UTC (rev 43182)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
2005-04-18 04:41:13 UTC (rev 43183)
@@ -606,8 +606,7 @@
top_node = nodes [0];
OpenTreeNodeEnumerator o = new OpenTreeNodeEnumerator
(TopNode);
- int move = y / ItemHeight + skipped_nodes;
-
+ int move = y / ItemHeight;
for (int i = -1; i < move; i++) {
if (!o.MoveNext ())
return null;
@@ -620,6 +619,19 @@
return node != null && node.Bounds.Left <= x &&
node.Bounds.Right >= x;
}
+ private bool IsPlusMinusArea (TreeNode node, int x)
+ {
+ int l = node.Bounds.Left + 5;
+
+ if (show_root_lines || node.Parent != null)
+ l -= indent;
+ if (checkboxes)
+ l -= 19;
+ if (ImageList != null)
+ l -= ImageList.ImageSize.Width + 3;
+ return (x > l && x < l + 8);
+ }
+
internal void SetTop (TreeNode node)
{
OpenTreeNodeEnumerator walk = new
OpenTreeNodeEnumerator (root_node);
@@ -726,12 +738,10 @@
private void DrawNodePlusMinus (TreeNode node, Rectangle clip,
int x, int y, int middle)
{
- node.UpdatePlusMinusBounds (x, middle - 4, 8, 8);
-
- if (!clip.IntersectsWith (node.PlusMinusBounds))
+ if (!RectsIntersect (clip, x, middle - 4, 8, 8))
return;
- DeviceContext.DrawRectangle (SystemPens.ControlDark,
node.PlusMinusBounds);
+ DeviceContext.DrawRectangle (SystemPens.ControlDark, x,
middle - 4, 8, 8);
if (node.IsExpanded) {
DeviceContext.DrawLine
(SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle);
@@ -1076,6 +1086,7 @@
TreeNode node = GetNodeAt (e.Y);
if (node == null)
return;
+
if (IsTextArea (node, e.X)) {
TreeNode old_selected = selected_node;
selected_node = node;
@@ -1094,7 +1105,7 @@
invalid = Rectangle.Union (invalid,
selected_node.Bounds);
Invalidate (invalid);
}
- } else if (show_plus_minus &&
node.PlusMinusBounds.Contains (e.X, e.Y)) {
+ } else if (show_plus_minus && IsPlusMinusArea (node,
e.X)) {
node.Toggle ();
return;
} else if (checkboxes && node.CheckBoxBounds.Contains
(e.X, e.Y)) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches