예제 #1
0
        protected override bool OnKeyDown(KeyDownEvent e)
        {
            if (!HasFocus)
            {
                return(false);
            }

            switch (e.Key)
            {
            case Key.Delete:
            {
                if (e.ShiftPressed)
                {
                    bindTarget.UpdateKeyCombination(InputKey.None);
                    finalise();
                    return(true);
                }

                break;
            }
            }

            bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState));
            if (!isModifier(e.Key))
            {
                finalise();
            }

            return(true);
        }
예제 #2
0
        protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
        {
            if (!HasFocus)
            {
                return(false);
            }

            switch (args.Key)
            {
            case Key.Escape:
                finalise();
                return(true);

            case Key.Delete:
                bindTarget.UpdateKeyCombination(InputKey.None);
                finalise();
                return(true);
            }

            bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
            if (!isModifier(args.Key))
            {
                finalise();
            }

            return(true);
        }
예제 #3
0
            private void updateText(UIEvent e)
            {
                var    state          = new InputState(keyboard: e.CurrentState.Keyboard);
                var    keyCombination = KeyCombination.FromInputState(state);
                string str            = readableKeyCombinationProvider.GetReadableString(keyCombination);

                text.Text = $"pressed: {str}";
            }
예제 #4
0
        protected override bool OnJoystickPress(InputState state, Framework.Input.JoystickEventArgs args)
        {
            if (!HasFocus)
            {
                return(false);
            }

            bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
            finalise();

            return(true);
        }
예제 #5
0
        protected override bool OnJoystickPress(JoystickPressEvent e)
        {
            if (!HasFocus)
            {
                return(false);
            }

            bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState));
            finalise();

            return(true);
        }
예제 #6
0
        protected override bool OnWheel(InputState state)
        {
            if (HasFocus)
            {
                if (bindTarget.IsHovered)
                {
                    bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
                    finalise();
                    return(true);
                }
            }

            return(base.OnWheel(state));
        }
예제 #7
0
        protected override bool OnScroll(InputState state)
        {
            if (HasFocus)
            {
                if (bindTarget.IsHovered)
                {
                    bindTarget.UpdateKeyCombination(new KeyCombination(KeyCombination.FromInputState(state).Keys.Append(state.Mouse.ScrollDelta.Y > 0 ? InputKey.MouseWheelUp : InputKey.MouseWheelDown)));
                    finalise();
                    return(true);
                }
            }

            return(base.OnScroll(state));
        }
예제 #8
0
        protected override bool OnScroll(ScrollEvent e)
        {
            if (HasFocus)
            {
                if (bindTarget.IsHovered)
                {
                    bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState, e.ScrollDelta));
                    finalise();
                    return(true);
                }
            }

            return(base.OnScroll(e));
        }
예제 #9
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (!HasFocus || !bindTarget.IsHovered)
            {
                return(base.OnMouseDown(state, args));
            }

            if (!AllowMainMouseButtons)
            {
                switch (args.Button)
                {
                case MouseButton.Left:
                case MouseButton.Right:
                    return(true);
                }
            }

            bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
            return(true);
        }