Author: jackson
Date: 2006-05-25 15:08:53 -0400 (Thu, 25 May 2006)
New Revision: 61135
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
Log:
- Fix VisibleCount to use the ViewportRectangle so that
scrollbars
are factored into the visible count
- Use VisibleCount for clarity in the code
- When the font is changed we need to recurse through all the
nodes and invalidate their sizes
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-05-25 19:00:30 UTC (rev 61134)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-05-25 19:08:53 UTC (rev 61135)
@@ -25,6 +25,11 @@
- Update the selected node if its ImageIndex is changed
- Handle null nodes in UpdateNode (mainly so we don't have to
check if selected is null when updating it
+ - Fix VisibleCount to use the ViewportRectangle so that scrollbars
+ are factored into the visible count
+ - Use VisibleCount for clarity in the code
+ - When the font is changed we need to recurse through all the
+ nodes and invalidate their sizes
2006-05-25 Gonzalo Paniagua Javier <[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-05-25 19:00:30 UTC (rev 61134)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
2006-05-25 19:08:53 UTC (rev 61135)
@@ -438,7 +438,7 @@
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int VisibleCount {
get {
- return ClientRectangle.Height / ItemHeight;
+ return ViewportRectangle.Height / ItemHeight;
}
}
@@ -627,7 +627,7 @@
case Keys.PageDown:
if (selected_node != null) {
ne = new OpenTreeNodeEnumerator
(selected_node);
- int move = ViewportRectangle.Height /
ItemHeight;
+ int move = VisibleCount;
for (int i = 0; i < move && ne.MoveNext
(); i++) {
}
@@ -637,7 +637,7 @@
case Keys.PageUp:
if (selected_node != null) {
ne = new OpenTreeNodeEnumerator
(selected_node);
- int move = ViewportRectangle.Height /
ItemHeight;
+ int move = VisibleCount;
for (int i = 0; i < move &&
ne.MovePrevious (); i++)
{ }
SelectedNode = ne.CurrentNode;
@@ -1293,7 +1293,7 @@
}
if (vert) {
- vbar.SetValues (max_visible_order - 2,
ViewportRectangle.Height / ItemHeight);
+ vbar.SetValues (max_visible_order - 2,
VisibleCount);
/*
vbar.Maximum = max_visible_order;
vbar.LargeChange = ClientRectangle.Height /
ItemHeight;
@@ -1444,10 +1444,17 @@
private void FontChangedHandler (object sender, EventArgs e)
{
- // TODO: I guess we should enumerate every node and
invalidate the sizes here :-(
- // update_node_bounds = true;
+ InvalidateNodeWidthRecursive (root_node);
}
+ private void InvalidateNodeWidthRecursive (TreeNode node)
+ {
+ node.InvalidateWidth ();
+ foreach (TreeNode child in node.Nodes) {
+ InvalidateNodeWidthRecursive (child);
+ }
+ }
+
private void FocusChangedHandler (object sender, EventArgs e)
{
if (selected_node != null)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches