예제 #1
0
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        public override void RenderBefore(RenderContext context)
        {
            foreach (ViewBase child in this)
            {
                // Only interested in updating view buttons
                if (child is ViewDrawButton)
                {
                    // Cast to correct type
                    ViewDrawButton crumbButton = child as ViewDrawButton;

                    // That are associated with crumb items
                    KryptonBreadCrumbItem crumbItem;
                    if (_buttonToCrumb.TryGetValue(crumbButton, out crumbItem))
                    {
                        // If the button is pressed then point button downwards,
                        // otherwise we point in the direction the buttons layed out.
                        if (crumbButton.ElementState == PaletteState.Pressed)
                        {
                            crumbButton.DropDownOrientation = VisualOrientation.Top;
                        }
                        else
                        {
                            crumbButton.DropDownOrientation = VisualOrientation.Left;
                        }
                    }
                }
            }

            base.RenderBefore(context);
        }
예제 #2
0
        /// <summary>
        /// Initialize a new instance of the KryptonButton class.
        /// </summary>
        public KryptonButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default button properties
            _style        = ButtonStyle.Standalone;
            _dialogResult = DialogResult.None;
            _orientation  = VisualOrientation.Top;
            _useMnemonic  = true;

            // Create content storage
            _buttonValues              = CreateButtonValues(NeedPaintDelegate);
            _buttonValues.TextChanged += new EventHandler(OnButtonTextChanged);

            // Create the palette storage
            _stateCommon   = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            _stateDisabled = new PaletteTriple(_stateCommon, NeedPaintDelegate);
            _stateNormal   = new PaletteTriple(_stateCommon, NeedPaintDelegate);
            _stateTracking = new PaletteTriple(_stateCommon, NeedPaintDelegate);
            _statePressed  = new PaletteTriple(_stateCommon, NeedPaintDelegate);
            _stateDefault  = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            _stateFocus    = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride);

            // Create the view button instance
            _drawButton = new ViewDrawButton(_stateDisabled,
                                             _overrideNormal,
                                             _overrideTracking,
                                             _overridePressed,
                                             new PaletteMetricRedirect(Redirector),
                                             this,
                                             Orientation,
                                             UseMnemonic);

            // Only draw a focus rectangle when focus cues are needed in the top level form
            _drawButton.TestForFocusCues = true;

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(_drawButton, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a button
            _drawButton.MouseController  = _buttonController;
            _drawButton.KeyController    = _buttonController;
            _drawButton.SourceController = _buttonController;

            // Need to know when user clicks the button view or mouse selects it
            _buttonController.Click       += new MouseEventHandler(OnButtonClick);
            _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawButton);
        }
        /// <summary>
        /// Gets the view for the previous visible and enabled button spec of the defined edge.
        /// </summary>
        /// <param name="align">Edge of buttons caller is interested in searching.</param>
        /// <param name="current">Current button that is the marker for searching.</param>
        /// <returns>ViewDrawButton reference; otherwise false.</returns>
        public virtual ViewDrawButton GetPreviousVisibleViewButton(PaletteRelativeEdgeAlign align,
                                                                   ViewDrawButton current)
        {
            ButtonSpecView[] specLookups = new ButtonSpecView[_specLookup.Count];
            _specLookup.Values.CopyTo(specLookups, 0);

            bool found = false;

            for (int i = _specLookup.Count - 1; i >= 0; i--)
            {
                ButtonSpecView specView = (ButtonSpecView)specLookups[i];

                if (!found)
                {
                    found = (specView.ViewButton == current);
                }
                else
                {
                    // Is the button actually visible/enabled
                    if (specView.ViewCenter.Visible &&
                        specView.ViewButton.Enabled)
                    {
                        if (specView.ButtonSpec.Edge == align)
                        {
                            return(specView.ViewButton);
                        }
                    }
                }
            }

            return(null);
        }
        /// <summary>
        /// Gets the view for the next visible and enabled button spec of the defined edge.
        /// </summary>
        /// <param name="align">Edge of buttons caller is interested in searching.</param>
        /// <param name="current">Current button that is the marker for searching.</param>
        /// <returns>ViewDrawButton reference; otherwise false.</returns>
        public virtual ViewDrawButton GetNextVisibleViewButton(PaletteRelativeEdgeAlign align,
                                                               ViewDrawButton current)
        {
            bool found = false;

            foreach (ButtonSpecView specView in _specLookup.Values)
            {
                if (!found)
                {
                    found = (specView.ViewButton == current);
                }
                else
                {
                    // Is the button actually visible/enabled
                    if (specView.ViewCenter.Visible &&
                        specView.ViewButton.Enabled)
                    {
                        if (specView.ButtonSpec.Edge == align)
                        {
                            return(specView.ViewButton);
                        }
                    }
                }
            }

            return(null);
        }
        /// <summary>
        /// Find the ButtonSpec definition associated with the provided button view.
        /// </summary>
        /// <param name="viewButton">View to use when searching.</param>
        /// <returns>ButtonSpec reference if found; otherwise null.</returns>
        public virtual ButtonSpec GetButtonSpecFromView(ViewDrawButton viewButton)
        {
            foreach (ButtonSpecView specView in _specLookup.Values)
            {
                if (specView.ViewButton == viewButton)
                {
                    return(specView.ButtonSpec);
                }
            }

            return(null);
        }
예제 #6
0
        private void SyncBreadCrumbs()
        {
            // Remove all existing children
            Clear();

            // Walk up the bread crumb trail
            KryptonBreadCrumbItem item = _kryptonBreadCrumb.SelectedItem;

            while (item != null)
            {
                ViewDrawButton crumbButton;

                // If we do not have a button to represent this crumb...
                if (!_crumbToButton.TryGetValue(item, out crumbButton))
                {
                    // Setup the button for drawing as a drop down button if required
                    crumbButton = new ViewDrawButton(_kryptonBreadCrumb.StateDisabled.BreadCrumb,
                                                     _kryptonBreadCrumb.StateNormal.BreadCrumb,
                                                     _kryptonBreadCrumb.StateTracking.BreadCrumb,
                                                     _kryptonBreadCrumb.StatePressed.BreadCrumb,
                                                     _kryptonBreadCrumb.GetStateCommon(),
                                                     item, VisualOrientation.Top, false);

                    crumbButton.Splitter         = true;
                    crumbButton.TestForFocusCues = true;
                    crumbButton.DropDownPalette  = _kryptonBreadCrumb.GetRedirector();

                    // Create controller for operating the button
                    ButtonController crumbButtonController = new ButtonController(crumbButton, _needPaintDelegate);
                    crumbButtonController.Tag          = item;
                    crumbButtonController.BecomesFixed = true;
                    crumbButtonController.Click       += new MouseEventHandler(OnButtonClick);
                    crumbButton.MouseController        = crumbButtonController;

                    // Add to cache for future use
                    _crumbToButton.Add(item, crumbButton);
                    _buttonToCrumb.Add(crumbButton, item);
                }

                // Only show a drop down button if we have some children to choose from
                crumbButton.DropDown = _kryptonBreadCrumb.DropDownNavigation && (item.Items.Count > 0);

                // Add crumb to end of child collection
                Insert(0, crumbButton);

                // Move up another level
                item = item.Parent;
            }

            // Always add the overflow to the first item
            Insert(0, _overflowButton);
        }
예제 #7
0
        /// <summary>
        /// Initialize a new instance of the KryptonCheckButton class.
        /// </summary>
        public KryptonCheckButton()
        {
            // Create the extra state needed for the checked additions the the base button
            _stateCheckedNormal   = new PaletteTriple(StateCommon, NeedPaintDelegate);
            _stateCheckedTracking = new PaletteTriple(StateCommon, NeedPaintDelegate);
            _stateCheckedPressed  = new PaletteTriple(StateCommon, NeedPaintDelegate);

            // Create the override handling classes
            _overrideCheckedFocus    = new PaletteTripleOverride(OverrideFocus, _stateCheckedNormal, PaletteState.FocusOverride);
            _overrideCheckedNormal   = new PaletteTripleOverride(OverrideDefault, _overrideCheckedFocus, PaletteState.NormalDefaultOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(OverrideFocus, _stateCheckedTracking, PaletteState.FocusOverride);
            _overrideCheckedPressed  = new PaletteTripleOverride(OverrideFocus, _stateCheckedPressed, PaletteState.FocusOverride);

            // Add the checked specific palettes to the existing view button
            ViewDrawButton.SetCheckedPalettes(_overrideCheckedNormal,
                                              _overrideCheckedTracking,
                                              _overrideCheckedPressed);
        }
예제 #8
0
        /// <summary>
        /// Create a button controller for the view.
        /// </summary>
        /// <param name="viewButton">View to be controlled.</param>
        /// <param name="needPaint">Paint delegate.</param>
        /// <param name="clickHandler">Reference to click handler.</param>
        /// <returns>Controller instance.</returns>
        public virtual ButtonSpecViewControllers CreateController(ViewDrawButton viewButton,
                                                                  NeedPaintHandler needPaint,
                                                                  MouseEventHandler clickHandler)
        {
            // Create a standard button controller
            _controller = new ButtonController(viewButton, needPaint);
            _controller.BecomesFixed = true;
            _controller.Click       += clickHandler;

            // If associated with a tooltip manager then pass mouse messages onto tooltip manager
            IMouseController mouseController = (IMouseController)_controller;

            if (Manager.ToolTipManager != null)
            {
                mouseController = new ToolTipController(Manager.ToolTipManager, viewButton, _controller);
            }

            // Return a collection of controllers
            return(new ButtonSpecViewControllers(mouseController, _controller, _controller));
        }
예제 #9
0
        private void CreateOverflowButton()
        {
            // Create a button used when we overflow the available area
            _overflowButton = new ViewDrawButton(_kryptonBreadCrumb.StateDisabled.BreadCrumb,
                                                 _kryptonBreadCrumb.StateNormal.BreadCrumb,
                                                 _kryptonBreadCrumb.StateTracking.BreadCrumb,
                                                 _kryptonBreadCrumb.StatePressed.BreadCrumb,
                                                 _kryptonBreadCrumb.GetStateCommon(),
                                                 this, VisualOrientation.Top, false);

            _overflowButton.Splitter         = true;
            _overflowButton.TestForFocusCues = true;
            _overflowButton.DropDownPalette  = _kryptonBreadCrumb.GetRedirector();

            // Create controller for operating the button
            ButtonController crumbButtonController = new ButtonController(_overflowButton, _needPaintDelegate);

            crumbButtonController.Tag          = this;
            crumbButtonController.BecomesFixed = true;
            crumbButtonController.Click       += new MouseEventHandler(OnOverflowButtonClick);
            _overflowButton.MouseController    = crumbButtonController;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuCheckButton class.
        /// </summary>
        /// <param name="provider">Reference to provider.</param>
        /// <param name="checkButton">Reference to owning check button entry.</param>
        public ViewDrawMenuCheckButton(IContextMenuProvider provider,
                                       KryptonContextMenuCheckButton checkButton)
        {
            _provider    = provider;
            _checkButton = checkButton;

            // Create fixed storage of the content values
            _contentValues = new FixedContentValue(ResolveText,
                                                   ResolveExtraText,
                                                   ResolveImage,
                                                   ResolveImageTransparentColor);

            // Decide on the enabled state of the display
            _itemEnabled = provider.ProviderEnabled && ResolveEnabled;

            // Give the heading object the redirector to use when inheriting values
            _checkButton.SetPaletteRedirect(provider.ProviderRedirector);

            // Create the view button instance
            _drawButton = new ViewDrawButton(checkButton.OverrideDisabled,
                                             checkButton.OverrideNormal,
                                             checkButton.OverrideTracking,
                                             checkButton.OverridePressed,
                                             new PaletteMetricRedirect(provider.ProviderRedirector),
                                             _contentValues,
                                             VisualOrientation.Top,
                                             true);

            // Add the checked specific palettes to the existing view button
            _drawButton.SetCheckedPalettes(checkButton.OverrideCheckedNormal,
                                           checkButton.OverrideCheckedTracking,
                                           checkButton.OverrideCheckedPressed);

            _drawButton.Enabled = _itemEnabled;
            _drawButton.Checked = ResolveChecked;

            // Place the check box on the left of the available space but inside separators
            _innerDocker = new ViewLayoutDocker();
            _innerDocker.Add(_drawButton, ViewDockStyle.Fill);
            _innerDocker.Add(new ViewLayoutSeparator(1), ViewDockStyle.Right);
            _innerDocker.Add(new ViewLayoutSeparator(1), ViewDockStyle.Left);
            _innerDocker.Add(new ViewLayoutSeparator(1), ViewDockStyle.Top);
            _innerDocker.Add(new ViewLayoutSeparator(1), ViewDockStyle.Bottom);

            // Use outer docker so that any extra space not needed is used by the null
            _outerDocker = new ViewLayoutDocker();
            _outerDocker.Add(_innerDocker, ViewDockStyle.Top);
            _outerDocker.Add(new ViewLayoutNull(), ViewDockStyle.Fill);

            // Use context menu specific version of the check box controller
            MenuCheckButtonController mcbc = new MenuCheckButtonController(provider.ProviderViewManager, _innerDocker, this, provider.ProviderNeedPaintDelegate);

            mcbc.Click += new EventHandler(OnClick);
            _innerDocker.MouseController = mcbc;
            _innerDocker.KeyController   = mcbc;

            // Add docker as the composite content
            Add(_outerDocker);

            // Want to know when a property changes whilst displayed
            _checkButton.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

            // We need to know if a property of the command changes
            if (_checkButton.KryptonCommand != null)
            {
                _cachedCommand = _checkButton.KryptonCommand;
                _checkButton.KryptonCommand.PropertyChanged += new PropertyChangedEventHandler(OnCommandPropertyChanged);
            }
        }
예제 #11
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecView class.
        /// </summary>
        /// <param name="redirector">Palette redirector.</param>
        /// <param name="paletteMetric">Source for metric values.</param>
        /// <param name="metricPadding">Padding metric for border padding.</param>
        /// <param name="manager">Reference to owning manager.</param>
        /// <param name="buttonSpec">Access</param>
        public ButtonSpecView(PaletteRedirect redirector,
                              IPaletteMetric paletteMetric,
                              PaletteMetricPadding metricPadding,
                              ButtonSpecManagerBase manager,
                              ButtonSpec buttonSpec)
        {
            Debug.Assert(redirector != null);
            Debug.Assert(manager != null);
            Debug.Assert(buttonSpec != null);

            // Remember references
            _redirector     = redirector;
            _manager        = manager;
            _buttonSpec     = buttonSpec;
            _finishDelegate = new EventHandler(OnFinishDelegate);

            // Create delegate for paint notifications
            NeedPaintHandler needPaint = new NeedPaintHandler(OnNeedPaint);

            // Intercept calls from the button for color remapping and instead use
            // the button spec defined map and the container foreground color
            _remapPalette = _manager.CreateButtonSpecRemap(redirector, buttonSpec);

            // Use a redirector to get button values directly from palette
            _palette = new PaletteTripleRedirect(_remapPalette,
                                                 PaletteBackStyle.ButtonButtonSpec,
                                                 PaletteBorderStyle.ButtonButtonSpec,
                                                 PaletteContentStyle.ButtonButtonSpec,
                                                 needPaint);


            // Create the view for displaying a button
            _viewButton = new ViewDrawButton(_palette, _palette, _palette, _palette,
                                             paletteMetric, this, VisualOrientation.Top, false);

            // Associate the view with the source component (for design time support)
            if (buttonSpec.AllowComponent)
            {
                _viewButton.Component = buttonSpec;
            }

            // Use a view center to place button in centre of given space
            _viewCenter = new ViewLayoutCenter(paletteMetric, metricPadding, VisualOrientation.Top);
            _viewCenter.Add(_viewButton);

            // Create a controller for managing button behavior
            ButtonSpecViewControllers controllers = CreateController(_viewButton, needPaint, new MouseEventHandler(OnClick));

            _viewButton.MouseController  = controllers.MouseController;
            _viewButton.SourceController = controllers.SourceController;
            _viewButton.KeyController    = controllers.KeyController;

            // We need notifying whenever a button specification property changes
            _buttonSpec.ButtonSpecPropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

            // Associate the button spec with the view that is drawing it
            _buttonSpec.SetView(_viewButton);

            // Finally update view with current button spec settings
            UpdateButtonStyle();
            UpdateVisible();
            UpdateEnabled();
            UpdateChecked();
        }
예제 #12
0
        private void OnOverflowButtonClick(object sender, MouseEventArgs e)
        {
            // Only allow a single context menu at a time
            if (!_showingContextMenu)
            {
                // Get access to the controller, view and crumb item
                ViewDrawButton   viewButton = sender as ViewDrawButton;
                ButtonController controller = viewButton.MouseController as ButtonController;

                // Create a context menu with a items collection
                KryptonContextMenu kcm = new KryptonContextMenu();

                // Use same palette settings for context menu as the main control
                kcm.Palette = _kryptonBreadCrumb.Palette;
                if (kcm.Palette == null)
                {
                    kcm.PaletteMode = _kryptonBreadCrumb.PaletteMode;
                }

                // Add an items collection as the root item of the context menu
                KryptonContextMenuItems items = new KryptonContextMenuItems();
                kcm.Items.Add(items);

                // Store lookup between each menu item and the crumb it represents. Prevents
                // needing to use the menu item tag for remembering association. Leaving the
                // tag free for use by the user.
                _menuItemToCrumb = new MenuItemToCrumb();

                // Create a new menu item to represent each of the invisible crumbs not children of the root
                // (item 0=overflow button, 1=root; 2=child of root, so we start at index 3)
                for (int i = 3; i < Count; i++)
                {
                    if (!this[i].Visible)
                    {
                        KryptonBreadCrumbItem  childCrumb = _buttonToCrumb[(ViewDrawButton)this[i]];
                        KryptonContextMenuItem childMenu  = new KryptonContextMenuItem();

                        // Store 1-to-1 association
                        _menuItemToCrumb.Add(childMenu, childCrumb);

                        // Copy across the display details of the child crumb item
                        childMenu.Text                  = childCrumb.ShortText;
                        childMenu.ExtraText             = childCrumb.LongText;
                        childMenu.Image                 = childCrumb.Image;
                        childMenu.ImageTransparentColor = childCrumb.ImageTransparentColor;
                        childMenu.Click                += new EventHandler(OnChildCrumbClick);

                        items.Items.Add(childMenu);
                    }
                }

                // Create a new menu item to represent each of the roots children
                bool firstRoot = true;
                foreach (KryptonBreadCrumbItem childCrumb in _kryptonBreadCrumb.RootItem.Items)
                {
                    // The first time we add an entry
                    if (firstRoot)
                    {
                        // Add a separator if entries already exist
                        if (items.Items.Count > 0)
                        {
                            items.Items.Add(new KryptonContextMenuSeparator());
                        }

                        firstRoot = false;
                    }

                    KryptonContextMenuItem childMenu = new KryptonContextMenuItem();

                    // Store 1-to-1 association
                    _menuItemToCrumb.Add(childMenu, childCrumb);

                    // Copy across the display details of the child crumb item
                    childMenu.Text                  = childCrumb.ShortText;
                    childMenu.ExtraText             = childCrumb.LongText;
                    childMenu.Image                 = childCrumb.Image;
                    childMenu.ImageTransparentColor = childCrumb.ImageTransparentColor;
                    childMenu.Click                += new EventHandler(OnChildCrumbClick);

                    items.Items.Add(childMenu);
                }

                // Allow the user a chance to alter the menu contents or cancel it entirely
                ContextPositionMenuArgs cpma = new ContextPositionMenuArgs(kcm, KryptonContextMenuPositionH.Left, KryptonContextMenuPositionV.Below);
                _kryptonBreadCrumb.OnOverflowDropDown(cpma);

                // Is there still the need to show a menu that is not empty?
                if (!cpma.Cancel &&
                    (cpma.KryptonContextMenu != null) &&
                    CommonHelper.ValidKryptonContextMenu(cpma.KryptonContextMenu))
                {
                    // Cache the controller for use in menu close processing, prevents the need to
                    // store anything in the KryptonContextMenu tag and so free up its use to the user.
                    _pressedButtonController = controller;

                    // Show the context menu so user can select the next item for selection
                    cpma.KryptonContextMenu.Closed += new ToolStripDropDownClosedEventHandler(OnKryptonContextMenuClosed);
                    cpma.KryptonContextMenu.Show(_kryptonBreadCrumb, _kryptonBreadCrumb.RectangleToScreen(new Rectangle(viewButton.ClientRectangle.X,
                                                                                                                        viewButton.ClientRectangle.Y,
                                                                                                                        viewButton.ClientRectangle.Width * 2,
                                                                                                                        viewButton.ClientRectangle.Height)),
                                                 cpma.PositionH,
                                                 cpma.PositionV);

                    // do not show another context menu whilst this one is visible
                    _showingContextMenu = true;
                }
                else
                {
                    // Button gives a fixed appearance when pressed, without a context menu that is not necessary
                    controller.RemoveFixed();

                    // Clicking item makes it become the selected crumb
                    _kryptonBreadCrumb.SelectedItem = _kryptonBreadCrumb.RootItem;
                }
            }
        }
예제 #13
0
        private void OnButtonClick(object sender, MouseEventArgs e)
        {
            // Only allow a single context menu at a time
            if (!_showingContextMenu)
            {
                // Get access to the controller, view and crumb item
                ViewDrawButton        viewButton = sender as ViewDrawButton;
                ButtonController      controller = viewButton.MouseController as ButtonController;
                KryptonBreadCrumbItem breadCrumb = controller.Tag as KryptonBreadCrumbItem;

                // Do we need to show a drop down menu?
                if (viewButton.DropDown && viewButton.SplitRectangle.Contains(e.Location))
                {
                    // Create a context menu with a items collection
                    KryptonContextMenu kcm = new KryptonContextMenu();

                    // Use same palette settings for context menu as the main control
                    kcm.Palette = _kryptonBreadCrumb.Palette;
                    if (kcm.Palette == null)
                    {
                        kcm.PaletteMode = _kryptonBreadCrumb.PaletteMode;
                    }

                    // Add an items collection as the root item of the context menu
                    KryptonContextMenuItems items = new KryptonContextMenuItems();
                    kcm.Items.Add(items);

                    // Store lookup between each menu item and the crumb it represents. Prevents
                    // needing to use the menu item tag for remembering association. Leaving the
                    // tag free for use by the user.
                    _menuItemToCrumb = new MenuItemToCrumb();

                    // Create a new menu item to represent each child crumb
                    foreach (KryptonBreadCrumbItem childCrumb in breadCrumb.Items)
                    {
                        KryptonContextMenuItem childMenu = new KryptonContextMenuItem();

                        // Store 1-to-1 association
                        _menuItemToCrumb.Add(childMenu, childCrumb);

                        // Copy across the display details of the child crumb item
                        childMenu.Text                  = childCrumb.ShortText;
                        childMenu.ExtraText             = childCrumb.LongText;
                        childMenu.Image                 = childCrumb.Image;
                        childMenu.ImageTransparentColor = childCrumb.ImageTransparentColor;
                        childMenu.Click                += new EventHandler(OnChildCrumbClick);

                        items.Items.Add(childMenu);
                    }

                    // Allow the user a chance to alter the menu contents or cancel it entirely
                    BreadCrumbMenuArgs bcma = new BreadCrumbMenuArgs(breadCrumb, kcm, KryptonContextMenuPositionH.Left, KryptonContextMenuPositionV.Below);
                    _kryptonBreadCrumb.OnCrumbDropDown(bcma);

                    // Is there still the need to show a menu that is not empty?
                    if (!bcma.Cancel &&
                        (bcma.KryptonContextMenu != null) &&
                        CommonHelper.ValidKryptonContextMenu(bcma.KryptonContextMenu))
                    {
                        // Cache the controller for use in menu close processing, prevents the need to
                        // store anything in the KryptonContextMenu tag and so free up its use to the user.
                        _pressedButtonController = controller;

                        // Show the context menu so user can select the next item for selection
                        bcma.KryptonContextMenu.Closed += new ToolStripDropDownClosedEventHandler(OnKryptonContextMenuClosed);
                        bcma.KryptonContextMenu.Show(_kryptonBreadCrumb, _kryptonBreadCrumb.RectangleToScreen(new Rectangle(viewButton.SplitRectangle.X - viewButton.SplitRectangle.Width,
                                                                                                                            viewButton.SplitRectangle.Y,
                                                                                                                            viewButton.SplitRectangle.Width * 2,
                                                                                                                            viewButton.SplitRectangle.Height)),
                                                     bcma.PositionH,
                                                     bcma.PositionV);

                        // do not show another context menu whilst this one is visible
                        _showingContextMenu = true;
                    }
                    else
                    {
                        // Button gives a fixed appearance when pressed, without a context menu that is not necessary
                        controller.RemoveFixed();
                    }
                }
                else
                {
                    // Button gives a fixed appearance when pressed, without a context menu that is not necessary
                    controller.RemoveFixed();

                    // Clicking item makes it become the selected crumb
                    _kryptonBreadCrumb.SelectedItem = breadCrumb;
                }
            }
        }