some widgets cleanup

This commit is contained in:
Chris Forbes
2010-10-10 15:09:26 +13:00
parent 0d8557eadb
commit 79d6eb4a2b
5 changed files with 13 additions and 36 deletions

View File

@@ -8,11 +8,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Widgets;
@@ -21,17 +17,9 @@ namespace OpenRA.Mods.RA.Widgets
{
class MoneyBinWidget : Widget
{
const int chromeButtonGap = 2;
public bool SplitOreAndCash = false;
/* legacy crap!!! */
List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle, Action<MouseInput>>>();
void AddButton(Rectangle r, Action<MouseInput> b) { buttons.Add(Pair.New(r, b)); }
public MoneyBinWidget() : base() { }
protected MoneyBinWidget(Widget other) : base(other) { }
public override Widget Clone() { return new MoneyBinWidget(this); }
public override void DrawInner(World world)
{
@@ -74,20 +62,5 @@ namespace OpenRA.Mods.RA.Widgets
}
}
}
public override bool HandleInputInner(MouseInput mi)
{
if (mi.Event == MouseInputEvent.Down)
{
var action = buttons.Where(a => a.First.Contains(mi.Location.ToPoint()))
.Select(a => a.Second).FirstOrDefault();
if (action == null)
return false;
action(mi);
return true;
}
return false;
}
}
}