Ejemplo n.º 1
0
        ///<inheritdoc/>
        public override bool ProcessColdKey(KeyEvent keyEvent)
        {
            if (base.ProcessColdKey(keyEvent))
            {
                return(true);
            }

            if (ShortcutHelper.FindAndOpenByShortcut(keyEvent, this))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        ///<inheritdoc/>
        public override bool ProcessKey(KeyEvent keyEvent)
        {
            if (base.ProcessKey(keyEvent))
            {
                return(true);
            }

            switch (ShortcutHelper.GetModifiersKey(keyEvent))
            {
            case Key.Q | Key.CtrlMask:
                // FIXED: stop current execution of this container
                Application.RequestStop();
                break;

            case Key.Z | Key.CtrlMask:
                Driver.Suspend();
                return(true);

#if false
            case Key.F5:
                Application.DebugDrawBounds = !Application.DebugDrawBounds;
                SetNeedsDisplay();
                return(true);
#endif
            case Key.Tab:
            case Key.CursorRight:
            case Key.CursorDown:
            case Key.I | Key.CtrlMask:             // Unix
                var old = GetDeepestFocusedSubview(Focused);
                if (!FocusNext())
                {
                    FocusNext();
                }
                if (old != Focused && old != Focused?.Focused)
                {
                    old?.SetNeedsDisplay();
                    Focused?.SetNeedsDisplay();
                }
                else
                {
                    FocusNearestView(SuperView?.TabIndexes, Direction.Forward);
                }
                return(true);

            case Key.BackTab | Key.ShiftMask:
            case Key.CursorLeft:
            case Key.CursorUp:
                old = GetDeepestFocusedSubview(Focused);
                if (!FocusPrev())
                {
                    FocusPrev();
                }
                if (old != Focused && old != Focused?.Focused)
                {
                    old?.SetNeedsDisplay();
                    Focused?.SetNeedsDisplay();
                }
                else
                {
                    FocusNearestView(SuperView?.TabIndexes?.Reverse(), Direction.Backward);
                }
                return(true);

            case Key.Tab | Key.CtrlMask:
                Application.Top.FocusNext();
                return(true);

            case Key.Tab | Key.ShiftMask | Key.CtrlMask:
                Application.Top.FocusPrev();
                return(true);

            case Key.L | Key.CtrlMask:
                Application.Refresh();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        ///<inheritdoc/>
        public override bool ProcessKey(KeyEvent keyEvent)
        {
            if (base.ProcessKey(keyEvent))
            {
                return(true);
            }

            switch (ShortcutHelper.GetModifiersKey(keyEvent))
            {
            case Key k when k == Application.QuitKey:
                // FIXED: stop current execution of this container
                if (Application.MdiTop != null)
                {
                    Application.MdiTop.RequestStop();
                }
                else
                {
                    Application.RequestStop();
                }
                break;

            case Key.Z | Key.CtrlMask:
                Driver.Suspend();
                return(true);

#if false
            case Key.F5:
                Application.DebugDrawBounds = !Application.DebugDrawBounds;
                SetNeedsDisplay();
                return(true);
#endif
            case Key.Tab:
            case Key.CursorRight:
            case Key.CursorDown:
            case Key.I | Key.CtrlMask:             // Unix
                var old = GetDeepestFocusedSubview(Focused);
                if (!FocusNext())
                {
                    FocusNext();
                }
                if (old != Focused && old != Focused?.Focused)
                {
                    old?.SetNeedsDisplay();
                    Focused?.SetNeedsDisplay();
                }
                else
                {
                    FocusNearestView(SuperView?.TabIndexes, Direction.Forward);
                }
                return(true);

            case Key.BackTab | Key.ShiftMask:
            case Key.CursorLeft:
            case Key.CursorUp:
                old = GetDeepestFocusedSubview(Focused);
                if (!FocusPrev())
                {
                    FocusPrev();
                }
                if (old != Focused && old != Focused?.Focused)
                {
                    old?.SetNeedsDisplay();
                    Focused?.SetNeedsDisplay();
                }
                else
                {
                    FocusNearestView(SuperView?.TabIndexes?.Reverse(), Direction.Backward);
                }
                return(true);

            case Key.Tab | Key.CtrlMask:
            case Key key when key == Application.AlternateForwardKey:             // Needed on Unix
                if (Application.MdiTop == null)
                {
                    var top = Modal ? this : Application.Top;
                    top.FocusNext();
                    if (top.Focused == null)
                    {
                        top.FocusNext();
                    }
                    top.SetNeedsDisplay();
                }
                else
                {
                    MoveNext();
                }
                return(true);

            case Key.Tab | Key.ShiftMask | Key.CtrlMask:
            case Key key when key == Application.AlternateBackwardKey:             // Needed on Unix
                if (Application.MdiTop == null)
                {
                    var top = Modal ? this : Application.Top;
                    top.FocusPrev();
                    if (top.Focused == null)
                    {
                        top.FocusPrev();
                    }
                    top.SetNeedsDisplay();
                }
                else
                {
                    MovePrevious();
                }
                return(true);

            case Key.L | Key.CtrlMask:
                Application.Refresh();
                return(true);
            }
            return(false);
        }