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

@@ -19,6 +19,7 @@ namespace OpenRA.Widgets
public readonly string Background = "dialog3";
public readonly int ScrollbarWidth = 24;
public readonly float ScrollVelocity = 4f;
public readonly int ItemSpacing = 2;
public int ContentHeight = 0;
float ListOffset = 0;
@@ -35,16 +36,24 @@ namespace OpenRA.Widgets
protected ScrollPanelWidget(ScrollPanelWidget other)
: base(other)
{
Background = other.Background;
upButtonRect = other.upButtonRect;
downButtonRect = other.downButtonRect;
scrollbarRect = other.scrollbarRect;
backgroundRect = other.backgroundRect;
thumbRect = other.thumbRect;
throw new NotImplementedException();
}
public void ClearChildren()
{
Children.Clear();
ContentHeight = 0;
}
public override void AddChild(Widget child)
{
// Initial setup of margins/height
if (Children.Count == 0)
ContentHeight = ItemSpacing;
UpPressed = other.UpPressed;
DownPressed = other.DownPressed;
ThumbPressed = other.ThumbPressed;
child.Bounds.Y += ContentHeight;
ContentHeight += child.Bounds.Height + ItemSpacing;
base.AddChild(child);
}
public override void DrawInner( WorldRenderer wr ) {}