Allow ImageWidget to filter mouse events.

This commit is contained in:
Paul Chote
2014-07-14 18:40:46 +12:00
parent d8b6eac64e
commit 4fb9e59402

View File

@@ -17,6 +17,7 @@ namespace OpenRA.Widgets
{ {
public string ImageCollection = ""; public string ImageCollection = "";
public string ImageName = ""; public string ImageName = "";
public bool ClickThrough = true;
public Func<string> GetImageName; public Func<string> GetImageName;
public Func<string> GetImageCollection; public Func<string> GetImageCollection;
@@ -29,6 +30,7 @@ namespace OpenRA.Widgets
protected ImageWidget(ImageWidget other) protected ImageWidget(ImageWidget other)
: base(other) : base(other)
{ {
ClickThrough = other.ClickThrough;
ImageName = other.ImageName; ImageName = other.ImageName;
GetImageName = other.GetImageName; GetImageName = other.GetImageName;
ImageCollection = other.ImageCollection; ImageCollection = other.ImageCollection;
@@ -48,5 +50,10 @@ namespace OpenRA.Widgets
WidgetUtils.DrawRGBA(sprite, RenderOrigin); WidgetUtils.DrawRGBA(sprite, RenderOrigin);
} }
public override bool HandleMouseInput(MouseInput mi)
{
return !ClickThrough && RenderBounds.Contains(mi.Location);
}
} }
} }