예제 #1
0
        private bool handleKeyDown(InputState state, Key key, bool repeat)
        {
            KeyDownEventArgs args = new KeyDownEventArgs
            {
                Key    = key,
                Repeat = repeat
            };

            if (FocusedDrawable != null)
            {
                if (args.Key == Key.Escape)
                {
                    FocusedDrawable.TriggerFocusLost(state);
                }
                else if (FocusedDrawable.TriggerKeyDown(state, args))
                {
                    return(true);
                }
            }

            return(keyboardInputQueue.Any(target => target.TriggerKeyDown(state, args)));
        }
예제 #2
0
        private bool handleKeyDown(InputState state, Key key, bool repeat)
        {
            KeyDownEventArgs args = new KeyDownEventArgs
            {
                Key    = key,
                Repeat = repeat
            };

            if (!unfocusIfNoLongerValid())
            {
                if (args.Key == Key.Escape)
                {
                    ChangeFocus(null);
                    return(true);
                }
                if (FocusedDrawable.TriggerOnKeyDown(state, args))
                {
                    return(true);
                }
            }

            return(keyboardInputQueue.Any(target => target.TriggerOnKeyDown(state, args)));
        }
예제 #3
0
        /// <summary>
        /// Triggers key down events on drawables in <paramref cref="drawables"/> until it is handled.
        /// </summary>
        /// <param name="drawables">The drawables in the queue.</param>
        /// <param name="state">The input state.</param>
        /// <param name="args">The args.</param>
        /// <returns>Whether the key down event was handled.</returns>
        protected virtual bool PropagateKeyDown(IEnumerable <Drawable> drawables, InputState state, KeyDownEventArgs args)
        {
            var handledBy = drawables.FirstOrDefault(target => target.TriggerOnKeyDown(state, args));

            if (handledBy != null)
            {
                Logger.Log($"KeyDown ({args.Key}) handled by {handledBy}.", LoggingTarget.Runtime, LogLevel.Debug);
            }

            return(handledBy != null);
        }
 protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => acceptState(state);
예제 #5
0
 protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
 {
     return(Handler(state, args));
 }