private void KeyDownPopupMinimized(VisualPopupMinimized popupMinimized, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Tab | Keys.Shift:
            case Keys.Left:
                popupMinimized.SetPreviousFocusItem();
                break;

            case Keys.Tab:
            case Keys.Right:
                popupMinimized.SetNextFocusItem();
                break;
            }
        }
Пример #2
0
        private void KeyDownPopupMinimized(VisualPopupMinimized popupMinimized, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Tab | Keys.Shift:
            case Keys.Left:
                popupMinimized.SetPreviousFocusItem();
                break;

            case Keys.Tab:
            case Keys.Right:
                popupMinimized.SetNextFocusItem();
                break;

            case Keys.Space:
            case Keys.Enter:
                // Generate appropriate event
                switch (_buttonType)
                {
                case GroupButtonType.Push:
                case GroupButtonType.Check:
                    // Exit keyboard mode when you click the button spec
                    _ribbon.KillKeyboardMode();

                    OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                    break;

                case GroupButtonType.DropDown:
                case GroupButtonType.Split:
                    // Kill the key tips mode
                    _ribbon.KillKeyboardKeyTips();

                    // Pretend we have captured input and then fix state as pressed
                    _hasFocus     = true;
                    _captured     = true;
                    _fixedPressed = true;

                    // Redraw to show the fixed state
                    UpdateTargetState(Point.Empty);

                    OnDropDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                    break;
                }
                break;
            }
        }
Пример #3
0
        private void KeyDownPopupMinimized(VisualPopupMinimized popupMinimized, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Tab | Keys.Shift:
            case Keys.Left:
                popupMinimized.SetPreviousFocusItem();
                break;

            case Keys.Tab:
            case Keys.Right:
                popupMinimized.SetNextFocusItem();
                break;

            case Keys.Space:
            case Keys.Enter:
                // Exit keyboard mode when you click the button spec
                _ribbon.KillKeyboardMode();

                OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                break;
            }
        }
Пример #4
0
        /// <summary>
        /// Key has been pressed down.
        /// </summary>
        /// <param name="c">Reference to the source control instance.</param>
        /// <param name="e">A KeyEventArgs that contains the event data.</param>
        public void KeyDown(Control c, KeyEventArgs e)
        {
            ViewBase newView = null;
            Keys     keyData = e.KeyData;

            // When there is no selected tab then tab and shift+tab become right and left
            if (_ribbon.SelectedTab == null)
            {
                if (keyData == Keys.Tab)
                {
                    keyData = Keys.Right;
                }

                if (keyData == (Keys.Tab | Keys.Shift))
                {
                    keyData = Keys.Left;
                }
            }

            switch (keyData)
            {
            case Keys.Right:
                // Get the next visible tab page
                newView = _target.ViewLayoutRibbonTabs.GetViewForNextRibbonTab(_target.RibbonTab);

                // Move across to any far defined buttons
                if (newView == null)
                {
                    newView = _ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Far);
                }

                // Move across to any inherit defined buttons
                if (newView == null)
                {
                    newView = _ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Inherit);
                }

                // Rotate around to application button
                if (newView == null)
                {
                    if (_ribbon.TabsArea.LayoutAppButton.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppButton.AppButton;
                    }
                    else if (_ribbon.TabsArea.LayoutAppTab.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppTab.AppTab;
                    }
                }
                break;

            case Keys.Left:
                // Get the previous visible tab page
                newView = _target.ViewLayoutRibbonTabs.GetViewForPreviousRibbonTab(_target.RibbonTab);

                // Move across to any near defined buttons
                if (newView == null)
                {
                    newView = _ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Near);
                }

                // Get the last qat button
                if (newView == null)
                {
                    newView = _ribbon.GetLastQATView();
                }

                // Rotate around to application button
                if (newView == null)
                {
                    if (_ribbon.TabsArea.LayoutAppButton.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppButton.AppButton;
                    }
                    else if (_ribbon.TabsArea.LayoutAppTab.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppTab.AppTab;
                    }
                }
                break;

            case Keys.Tab | Keys.Shift:
                // Move across to any near defined buttons
                newView = _ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Near);

                // Get the last qat button
                if (newView == null)
                {
                    newView = _ribbon.GetLastQATView();
                }

                // Rotate around to application button
                if (newView == null)
                {
                    if (_ribbon.TabsArea.LayoutAppButton.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppButton.AppButton;
                    }
                    else if (_ribbon.TabsArea.LayoutAppTab.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppTab.AppTab;
                    }
                }
                break;

            case Keys.Down:
                // Get the first focus item for the currently selected page
                newView = _ribbon.GroupsArea.ViewGroups.GetFirstFocusItem();
                break;

            case Keys.Tab:
                // Get the first focus item for the currently selected page
                newView = _ribbon.GroupsArea.ViewGroups.GetFirstFocusItem();

                // Move across to any near defined buttons
                if (newView == null)
                {
                    newView = _ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Near);
                }

                // Get the last qat button
                if (newView == null)
                {
                    newView = _ribbon.GetLastQATView();
                }

                // Rotate around to application button
                if (newView == null)
                {
                    if (_ribbon.TabsArea.LayoutAppButton.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppButton.AppButton;
                    }
                    else if (_ribbon.TabsArea.LayoutAppTab.Visible)
                    {
                        newView = _ribbon.TabsArea.LayoutAppTab.AppTab;
                    }
                }
                break;

            case Keys.Enter:
            case Keys.Space:
                // When minimize, pressing enter will select the tab and pop it up
                if ((_ribbon.RealMinimizedMode) && (_ribbon.SelectedTab != _target.RibbonTab))
                {
                    // Select the tab will automatically create a popup for it
                    _ribbon.SelectedTab = _target.RibbonTab;

                    // Get access to the popup for the group
                    if ((VisualPopupManager.Singleton.CurrentPopup != null) &&
                        (VisualPopupManager.Singleton.CurrentPopup is VisualPopupMinimized))
                    {
                        // Cast to correct type
                        VisualPopupMinimized popupMinimized = (VisualPopupMinimized)VisualPopupManager.Singleton.CurrentPopup;
                        popupMinimized.SetFirstFocusItem();
                    }
                }
                break;
            }

            // If we have a new view to focus and it is not ourself...
            if ((newView != null) && (newView != _target))
            {
                // If the new view is a tab then select that tab
                if ((newView is ViewDrawRibbonTab) && !_ribbon.RealMinimizedMode)
                {
                    _ribbon.SelectedTab = ((ViewDrawRibbonTab)newView).RibbonTab;
                }

                // Finally we switch focus to new view
                _ribbon.FocusView = newView;
            }
        }