private void OnContextMenu(object sender, MouseEventArgs e)
{
if ((_ribbonSeparator != null) &&
(_ribbonSeparator.Ribbon != null) &&
_ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator))
{
// Create the menu strip the first time around
if (_cms == null)
{
_cms = new ContextMenuStrip();
_toggleHelpersMenu = new ToolStripMenuItem("Design Helpers", null, new EventHandler(OnToggleHelpers));
_moveFirstMenu = new ToolStripMenuItem("Move Separator First", ComponentFactory.Krypton.Design.Properties.Resources.MoveFirst, new EventHandler(OnMoveFirst));
_movePreviousMenu = new ToolStripMenuItem("Move Separator Previous", ComponentFactory.Krypton.Design.Properties.Resources.MovePrevious, new EventHandler(OnMovePrevious));
_moveNextMenu = new ToolStripMenuItem("Move Separator Next", ComponentFactory.Krypton.Design.Properties.Resources.MoveNext, new EventHandler(OnMoveNext));
_moveLastMenu = new ToolStripMenuItem("Move Separator Last", ComponentFactory.Krypton.Design.Properties.Resources.MoveLast, new EventHandler(OnMoveLast));
_moveToGroupMenu = new ToolStripMenuItem("Move Separator To Group");
_deleteSeparatorMenu = new ToolStripMenuItem("Delete Separator", ComponentFactory.Krypton.Design.Properties.Resources.delete2, new EventHandler(OnDeleteSeparator));
_cms.Items.AddRange(new ToolStripItem[] { _toggleHelpersMenu, new ToolStripSeparator(),
_moveFirstMenu, _movePreviousMenu, _moveNextMenu, _moveLastMenu, new ToolStripSeparator(),
_moveToGroupMenu, new ToolStripSeparator(),
_deleteSeparatorMenu });
}
// Update verbs to work out correct enable states
UpdateVerbStatus();
// Update sub menu options available for the 'Move To Group'
UpdateMoveToGroup();
// Update menu items state from versb
_toggleHelpersMenu.Checked = _ribbonSeparator.Ribbon.InDesignHelperMode;
_moveFirstMenu.Enabled = _moveFirstVerb.Enabled;
_movePreviousMenu.Enabled = _movePrevVerb.Enabled;
_moveNextMenu.Enabled = _moveNextVerb.Enabled;
_moveLastMenu.Enabled = _moveLastVerb.Enabled;
_moveToGroupMenu.Enabled = (_moveToGroupMenu.DropDownItems.Count > 0);
// Show the context menu
if (CommonHelper.ValidContextMenuStrip(_cms))
{
Point screenPt = _ribbonSeparator.Ribbon.ViewRectangleToPoint(_ribbonSeparator.SeparatorView);
VisualPopupManager.Singleton.ShowContextMenuStrip(_cms, screenPt);
}
}
}