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