Restrict ClickThrough to what it was originally intended for.

This commit is contained in:
Paul Chote
2011-01-05 23:09:45 +13:00
parent 5254deedcb
commit 7cabe920db
21 changed files with 25 additions and 55 deletions

View File

@@ -15,7 +15,8 @@ namespace OpenRA.Widgets
public class BackgroundWidget : Widget
{
public readonly string Background = "dialog";
public readonly bool ClickThrough = false;
public override void DrawInner( WorldRenderer wr )
{
WidgetUtils.DrawPanel(Background, RenderBounds);
@@ -23,10 +24,16 @@ namespace OpenRA.Widgets
public BackgroundWidget() : base() { }
public override bool HandleMouseInput(MouseInput mi)
{
return !ClickThrough;
}
protected BackgroundWidget(BackgroundWidget other)
: base(other)
{
Background = other.Background;
ClickThrough = other.ClickThrough;
}
public override Widget Clone() { return new BackgroundWidget(this); }

View File

@@ -167,14 +167,9 @@ namespace OpenRA.Widgets
public static void ShowDropDown<T>(Widget w, IEnumerable<T> ts, Func<T, int, LabelWidget> ft)
{
var dropDown = new ScrollPanelWidget()
{
Bounds = new Rectangle(w.RenderOrigin.X, w.RenderOrigin.Y + w.Bounds.Height, w.Bounds.Width, 100),
Visible = true,
ClickThrough = false,
OnMouseUp = mi => true,
ItemSpacing = 1
};
var dropDown = new ScrollPanelWidget();
dropDown.Bounds = new Rectangle(w.RenderOrigin.X, w.RenderOrigin.Y + w.Bounds.Height, w.Bounds.Width, 100);
dropDown.ItemSpacing = 1;
List<LabelWidget> items = new List<LabelWidget>();
List<Widget> dismissAfter = new List<Widget>();
@@ -182,8 +177,6 @@ namespace OpenRA.Widgets
{
var ww = ft(t, dropDown.Bounds.Width - dropDown.ScrollbarWidth);
dismissAfter.Add(ww);
ww.ClickThrough = false;
ww.IsVisible = () => true;
ww.OnMouseMove = mi => items.Do(lw =>
{
lw.Background = null; ww.Background = "dialog2";

View File

@@ -27,7 +27,6 @@ namespace OpenRA.Widgets
public string Height = "0";
public string Delegate = null;
public string EventHandler = null;
public bool ClickThrough = true;
public bool Visible = true;
public readonly List<Widget> Children = new List<Widget>();
@@ -63,7 +62,6 @@ namespace OpenRA.Widgets
Width = widget.Width;
Height = widget.Height;
Delegate = widget.Delegate;
ClickThrough = widget.ClickThrough;
Visible = widget.Visible;
Bounds = widget.Bounds;