Remove a pile of unnecessary state management from Scrollpanels.

This commit is contained in:
Paul Chote
2011-01-01 16:47:52 +13:00
parent e2b739cd3e
commit d90dec9c8e
22 changed files with 57 additions and 115 deletions

View File

@@ -293,10 +293,8 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
{
// This causes problems for people who are in the process of editing their names (the widgets vanish from beneath them)
// Todo: handle this nicer
Players.Children.Clear();
Players.ContentHeight = 0;
Players.ClearChildren();
int offset = 0;
foreach (var slot in orderManager.LobbyInfo.Slots)
{
var s = slot;
@@ -446,19 +444,8 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
}
template.Id = "SLOT_{0}".F(s.Index);
template.Parent = Players;
template.Bounds = new Rectangle(template.Bounds.X, template.Bounds.Y + offset, template.Bounds.Width, template.Bounds.Height);
template.IsVisible = () => true;
Players.AddChild(template);
offset += template.Bounds.Height;
// Hack to ensure correct ContentHeight
if (Players.ContentHeight == 0)
Players.ContentHeight += template.Bounds.Y;
Players.ContentHeight += template.Bounds.Height;
}
}