Add ScrollPanel.ScrollToItem().

This commit is contained in:
Paul Chote
2013-04-05 23:14:08 +13:00
parent 4907ea1f0c
commit 01248de66b
2 changed files with 30 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ namespace OpenRA.Widgets
{
public class ScrollItemWidget : ButtonWidget
{
public string ItemKey;
public ScrollItemWidget()
: base()
{
@@ -28,6 +30,7 @@ namespace OpenRA.Widgets
IsVisible = () => false;
VisualHeight = 0;
IgnoreChildMouseOver = true;
Key = other.Key;
}
public Func<bool> IsSelected = () => false;
@@ -59,5 +62,12 @@ namespace OpenRA.Widgets
w.OnDoubleClick = onDoubleClick;
return w;
}
public static ScrollItemWidget Setup(string key, ScrollItemWidget template, Func<bool> isSelected, Action onClick)
{
var w = Setup(template, isSelected, onClick);
w.ItemKey = key;
return w;
}
}
}