Change Widget key support: Move (unused) Widget.OnKeyPress hook onto ButtonWidget; Buttons will respond to keys with modifiers.

This commit is contained in:
Paul Chote
2011-07-03 19:52:17 +12:00
parent 6877c29fa6
commit c1f7152857
2 changed files with 6 additions and 7 deletions

View File

@@ -41,7 +41,6 @@ namespace OpenRA.Widgets
public Func<MouseInput, bool> OnMouseDown = mi => false;
public Func<MouseInput, bool> OnMouseUp = mi => false;
public Action<MouseInput> OnMouseMove = mi => { };
public Func<KeyInput, bool> OnKeyPress = e => false;
public Func<bool> IsVisible;
@@ -70,7 +69,6 @@ namespace OpenRA.Widgets
OnMouseDown = widget.OnMouseDown;
OnMouseUp = widget.OnMouseUp;
OnMouseMove = widget.OnMouseMove;
OnKeyPress = widget.OnKeyPress;
IsVisible = widget.IsVisible;
@@ -252,9 +250,6 @@ namespace OpenRA.Widgets
// Do any widgety behavior (enter text etc)
var handled = HandleKeyPressInner(e);
// Apply any special logic added by event handlers; they return true if they caught the input
if (OnKeyPress(e)) return true;
return handled;
}