/// <summary> /// Called when the control should process keyboard information. /// </summary> /// <param name="info">The keyboard information.</param> /// <returns>True if the keyboard was handled by this control.</returns> public override bool ProcessKeyboard(Input.KeyboardInfo info) { if (info.IsKeyReleased(Keys.Space) || info.IsKeyReleased(Keys.Enter)) { IsSelected = true; return(true); } else if (Parent != null) { if (info.IsKeyReleased(Keys.Up)) { Parent.TabPreviousControl(); } else if (info.IsKeyReleased(Keys.Down)) { Parent.TabNextControl(); } return(true); } return(false); }
/// <summary> /// Processes the keyboard for the console. /// </summary> /// <param name="info">Keyboard information sent by the engine.</param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { info = KeyboardState; if (updateKeyboardState) { info.ProcessKeys(Engine.GameTimeUpdate); } var handlerResult = KeyboardHandler == null ? false : KeyboardHandler(this, info); if (!handlerResult && this.CanUseKeyboard) { bool canTab = true; if (FocusedControl != null) { canTab = FocusedControl.TabStop; } if (canTab) { if ( #if SFML ((info.IsKeyDown(Keys.LShift) || info.IsKeyDown(Keys.RShift)) || info.IsKeyReleased(Keys.LShift) || info.IsKeyReleased(Keys.RShift)) #elif MONOGAME ((info.IsKeyDown(Keys.LeftShift) || info.IsKeyDown(Keys.RightShift)) || info.IsKeyReleased(Keys.LeftShift) || info.IsKeyReleased(Keys.RightShift)) #endif && info.IsKeyReleased(Keys.Tab)) { // TODO: Handle tab by changing focused control unless existing control doesn't support tab TabPreviousControl(); return(true); } else if (info.IsKeyReleased(Keys.Tab)) { // TODO: Handle tab by changing focused control unless existing control doesn't support tab TabNextControl(); return(false); } } if (FocusedControl != null && FocusedControl.IsEnabled && FocusedControl.CanUseKeyboard) { return(FocusedControl.ProcessKeyboard(info)); } } return(false); }
/// <summary> /// Detects if the SPACE and ENTER keys are pressed and calls the <see cref="Click"/> method. /// </summary> /// <param name="info"></param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { if (info.IsKeyReleased(Keys.Space) || info.IsKeyReleased(Keys.Enter)) { DoClick(); return(true); } return(false); }
/// <summary> /// Detects if the SPACE and ENTER keys are pressed and calls the <see cref="Click"/> method. /// </summary> /// <param name="info"></param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { if (info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Space) || info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Enter)) { Click(); return(true); } return(false); }
/// <summary> /// Processes the keyboard looking for the ESC key press to close the console, if required. Otherwise the base ControlsConsole will process the keyboard. /// </summary> /// <param name="info">Keyboard state.</param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { if (CloseOnESC && info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Escape)) { this.Hide(); return(true); } else { return(base.ProcessKeyboard(info)); } }
/// <summary> /// Detects if the SPACE and ENTER keys are pressed and calls the <see cref="Click"/> method. /// </summary> /// <param name="info"></param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { #if SFML if (info.IsKeyReleased(Keys.Space) || info.IsKeyReleased(Keys.Return)) #elif MONOGAME if (info.IsKeyReleased(Keys.Space) || info.IsKeyReleased(Keys.Enter)) #endif { DoClick(); return(true); } return(false); }
/// <summary> /// Processes the keyboard looking for the ESC key press to close the console, if required. Otherwise the base ControlsConsole will process the keyboard. /// </summary> /// <param name="info">Keyboard state.</param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { info = KeyboardState; info.ProcessKeys(Engine.GameTimeUpdate); if (CloseOnESC && info.IsKeyReleased(Keys.Escape)) { this.Hide(); return(true); } else { return(base.ProcessKeyboard(info)); } }
public virtual bool ProcessKeyboard(Input.KeyboardInfo info) { if (IsVisible) { var copyList = new List <IConsole>(_consoles); for (int i = copyList.Count - 1; i >= 0; i--) { if (copyList[i].ProcessKeyboard(info)) { return(true); } } } return(false); }
/// <summary> /// Processes the keyboard for the console. /// </summary> /// <param name="info">Keyboard information sent by the engine.</param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { var handlerResult = KeyboardHandler == null ? false : KeyboardHandler(this, info); if (!handlerResult && this.CanUseKeyboard) { bool canTab = true; if (FocusedControl != null) { canTab = FocusedControl.TabStop; } if (canTab) { if (((info.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) || info.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightShift)) || info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.LeftShift) || info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.RightShift)) && info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Tab)) { // TODO: Handle tab by changing focused control unless existing control doesn't support tab TabPreviousControl(); return(true); } else if (info.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.Tab)) { // TODO: Handle tab by changing focused control unless existing control doesn't support tab TabNextControl(); return(false); } } if (FocusedControl != null && FocusedControl.IsEnabled && FocusedControl.CanUseKeyboard) { return(FocusedControl.ProcessKeyboard(info)); } } return(false); }
/// <summary> /// Focuses the previous or next selection button depending on if the UP or DOWN arrow keys were pressed. /// </summary> /// <param name="info">The keyboard state.</param> public override bool ProcessKeyboard(Input.KeyboardInfo info) { base.ProcessKeyboard(info); if (info.IsKeyReleased(Keys.Up) && PreviousSelection != null) { PreviousSelection.IsFocused = true; return(true); } else if (info.IsKeyReleased(Keys.Down) && NextSelection != null) { NextSelection.IsFocused = true; return(true); } return(false); }
public virtual bool ProcessKeyboard(Input.KeyboardInfo info) { return(false); }
/// <summary> /// Not Used. /// </summary> /// <param name="info"></param> public override bool ProcessKeyboard(Input.KeyboardInfo data) { return(false); }