Inheritance: ComponentFactory.Krypton.Toolkit.VisualPopup
コード例 #1
0
 private void OnVisualPopupGroupDisposed(object sender, EventArgs e)
 {
     // Not pressed any more
     _popupGroup = null;
     _pressed = false;
     _tracking = false;
     _container.Refresh();
 }
コード例 #2
0
 private void KeyDownPopupGroup(VisualPopupGroup popupGroup, KeyEventArgs e)
 {
     switch (e.KeyData)
     {
         case Keys.Tab | Keys.Shift:
         case Keys.Left:
             popupGroup.SetPreviousFocusItem();
             break;
         case Keys.Tab:
         case Keys.Right:
             popupGroup.SetNextFocusItem();
             break;
     }
 }
コード例 #3
0
        private void OnCollapsedClick(object sender, MouseEventArgs e)
        {
            // We do not operate the collapsed button at design time
            if (!_ribbon.InDesignMode)
            {
                // We are pressed until the popup window is removed
                _pressed = true;
                _container.Refresh();

                // Create the popup window for the group
                _popupGroup = new VisualPopupGroup(_ribbon, _ribbonGroup, _ribbon.Renderer);

                // We need to know when disposed so the pressed state can be reversed
                _popupGroup.Disposed += new EventHandler(OnVisualPopupGroupDisposed);

                // Ask the popup to show itself relative to ourself
                _popupGroup.ShowCalculatingSize(this, _container.RectangleToScreen(ClientRectangle));
            }
        }
コード例 #4
0
        private void KeyDownPopupGroup(VisualPopupGroup popupGroup, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.Tab | Keys.Shift:
                case Keys.Left:
                    popupGroup.SetPreviousFocusItem();
                    break;
                case Keys.Tab:
                case Keys.Right:
                    popupGroup.SetNextFocusItem();
                    break;
                case Keys.Space:
                case Keys.Enter:
                    OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                    // Get access to the popup for the group
                    if ((VisualPopupManager.Singleton.CurrentPopup != null) &&
                        (VisualPopupManager.Singleton.CurrentPopup is VisualPopupGroup))
                    {
                        // Cast to correct type
                        VisualPopupGroup popup = (VisualPopupGroup)VisualPopupManager.Singleton.CurrentPopup;
                        popup.SetFirstFocusItem();
                    }
                    break;
            }
        }
コード例 #5
0
        private void KeyDownRibbon(KryptonRibbon ribbon, KeyEventArgs e)
        {
            ViewBase newView = null;

            switch (e.KeyData)
            {
            case Keys.Tab | Keys.Shift:
            case Keys.Left:
                // Get the previous focus item for the currently selected page
                newView = ribbon.GroupsArea.ViewGroups.GetPreviousFocusItem(_target) ?? ribbon.TabsArea.LayoutTabs.GetViewForRibbonTab(ribbon.SelectedTab);

                // Got to the actual tab header
                break;

            case Keys.Tab:
            case Keys.Right:
                // Get the next focus item for the currently selected page
                newView = ribbon.GroupsArea.ViewGroups.GetNextFocusItem(_target) ?? ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Far);

                // Move across to any far defined buttons

                // 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.Space:
            case Keys.Enter:
                OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                // Get access to the popup for the group
                if ((VisualPopupManager.Singleton.CurrentPopup != null) &&
                    (VisualPopupManager.Singleton.CurrentPopup is VisualPopupGroup))
                {
                    // Cast to correct type
                    VisualPopupGroup popupGroup = (VisualPopupGroup)VisualPopupManager.Singleton.CurrentPopup;
                    popupGroup.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 unless in minimized mode
                if (!ribbon.RealMinimizedMode && (newView is ViewDrawRibbonTab tab))
                {
                    ribbon.SelectedTab = tab.RibbonTab;
                }

                // Finally we switch focus to new view
                ribbon.FocusView = newView;
            }
        }
コード例 #6
0
        private void KeyDownPopupGroup(VisualPopupGroup popupGroup, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.Tab | Keys.Shift:
                case Keys.Left:
                    popupGroup.SetPreviousFocusItem();
                    break;
                case Keys.Tab:
                case Keys.Right:
                    popupGroup.SetNextFocusItem();
                    break;
                case Keys.Space:
                case Keys.Enter:
                    // Exit keyboard mode when you click the group button
                    _ribbon.KillKeyboardMode();

                    OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                    break;
            }
        }
コード例 #7
0
        private void KeyDownPopupGroup(VisualPopupGroup popupGroup, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                case Keys.Tab | Keys.Shift:
                case Keys.Left:
                    popupGroup.SetPreviousFocusItem();
                    break;
                case Keys.Tab:
                case Keys.Right:
                    popupGroup.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 group button
                            _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;
            }
        }