Add hotkeys to playback controls.

This commit is contained in:
Taryn Hill
2015-03-06 12:54:16 -06:00
parent 190d197613
commit a05b015581

View File

@@ -110,6 +110,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
filenameInput = panel.Get<TextFieldWidget>("FILENAME_INPUT");
filenameInput.OnTextEdited = () => ApplyFilter(filenameInput.Text);
filenameInput.OnEscKey = filenameInput.YieldKeyboardFocus;
var frameContainer = panel.GetOrNull("FRAME_SELECTOR");
if (frameContainer != null)
@@ -140,6 +141,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var playButton = panel.GetOrNull<ButtonWidget>("BUTTON_PLAY");
if (playButton != null)
{
playButton.Key = new Hotkey(Keycode.SPACE, Modifiers.None);
playButton.OnClick = () =>
{
if (isVideoLoaded)
@@ -154,6 +156,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var pauseButton = panel.GetOrNull<ButtonWidget>("BUTTON_PAUSE");
if (pauseButton != null)
{
pauseButton.Key = new Hotkey(Keycode.SPACE, Modifiers.None);
pauseButton.OnClick = () =>
{
if (isVideoLoaded)
@@ -168,6 +171,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var stopButton = panel.GetOrNull<ButtonWidget>("BUTTON_STOP");
if (stopButton != null)
{
stopButton.Key = new Hotkey(Keycode.RETURN, Modifiers.None);
stopButton.OnClick = () =>
{
if (isVideoLoaded)
@@ -184,6 +188,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var nextButton = panel.GetOrNull<ButtonWidget>("BUTTON_NEXT");
if (nextButton != null)
{
nextButton.Key = new Hotkey(Keycode.RIGHT, Modifiers.None);
nextButton.OnClick = () =>
{
if (!isVideoLoaded)
@@ -196,6 +201,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var prevButton = panel.GetOrNull<ButtonWidget>("BUTTON_PREV");
if (prevButton != null)
{
prevButton.Key = new Hotkey(Keycode.LEFT, Modifiers.None);
prevButton.OnClick = () =>
{
if (!isVideoLoaded)