Esempio n. 1
0
        /// <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;
        }
Esempio n. 2
0
        /// <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;
        }
Esempio n. 3
0
        /// <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);
        }