示例#1
0
        /// <summary>Possibly handle keyboard input (if this widget has keyboard focus)</summary>
        /// <returns><c>true</c>, if keyboard input was handled, <c>false</c> if the input should bubble to the parent widget</returns>
        /// <param name="e">Key input data</param>
        public static bool HandleKeyPress(KeyInput e)
        {
            if (e.Event == KeyInputEvent.Down)
            {
                var hk = Hotkey.FromKeyInput(e);

                if (hk == Game.Settings.Keys.DevReloadChromeKey)
                {
                    ChromeProvider.Initialize(Game.ModData);
                    return(true);
                }

                if (hk == Game.Settings.Keys.HideUserInterfaceKey)
                {
                    Root.Visible ^= true;
                    return(true);
                }

                if (hk == Game.Settings.Keys.TakeScreenshotKey)
                {
                    Game.TakeScreenshot = true;
                    return(true);
                }
            }

            if (KeyboardFocusWidget != null)
            {
                return(KeyboardFocusWidget.HandleKeyPressOuter(e));
            }

            return(Root.HandleKeyPressOuter(e));
        }
示例#2
0
        /// <summary>Possibly handle keyboard input (if this widget has keyboard focus)</summary>
        /// <returns><c>true</c>, if keyboard input was handled, <c>false</c> if the input should bubble to the parent widget</returns>
        /// <param name="e">Key input data</param>
        public static bool HandleKeyPress(KeyInput e)
        {
            if (KeyboardFocusWidget != null)
            {
                return(KeyboardFocusWidget.HandleKeyPressOuter(e));
            }

            return(Root.HandleKeyPressOuter(e));
        }
示例#3
0
        public static bool HandleKeyPress(KeyInput e)
        {
            if (SelectedWidget != null)
            {
                return(SelectedWidget.HandleKeyPressOuter(e));
            }

            if (Root.HandleKeyPressOuter(e))
            {
                return(true);
            }
            return(false);
        }