protected override bool OnRightMouseUp(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot) { IVwSelection sel = RootBox.MakeSelAt(pt.X, pt.Y, new Rect(rcSrcRoot.Left, rcSrcRoot.Top, rcSrcRoot.Right, rcSrcRoot.Bottom), new Rect(rcDstRoot.Left, rcDstRoot.Top, rcDstRoot.Right, rcDstRoot.Bottom), false); if (sel == null) { return(base.OnRightMouseUp(pt, rcSrcRoot, rcDstRoot)); // no object, so quit and let base handle it } var e = new ContextMenuRequestedEventArgs(sel); if (ContextMenuRequested != null) { ContextMenuRequested(this, e); } if (e.Handled) { return(true); } return(base.OnRightMouseUp(pt, rcSrcRoot, rcDstRoot)); }
private void ContextMenuRequested(object sender, ContextMenuRequestedEventArgs e) { e.Selection.Install(); ICmObject obj = CurrentObject; if (obj != null) { // we only bother to display the context menu if an item is selected using (var ui = new CmObjectUi(obj)) { e.Handled = ui.HandleRightClick(Mediator, this, true, ContextMenuID); } } }
private void ContextMenuRequested(object sender, ContextMenuRequestedEventArgs e) { SelectionHelper sh = SelectionHelper.Create(e.Selection, m_view); ComplexConcPatternNode node = GetNode(sh, SelectionHelper.SelLimitType.Anchor); HashSet<ComplexConcPatternNode> nodes = new HashSet<ComplexConcPatternNode>(CurrentNodes.SelectMany(GetAllNodes)); if (!nodes.Contains(node)) sh.Selection.Install(); if (nodes.Count > 0) { // we only bother to display the context menu if an item is selected XWindow window = (XWindow) m_mediator.PropertyTable.GetValue("window"); window.ShowContextMenu("mnuComplexConcordance", new Point(Cursor.Position.X, Cursor.Position.Y), new TemporaryColleagueParameter(m_mediator, this, true), null, null); } }
protected override bool OnRightMouseUp(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot) { IVwSelection sel = RootBox.MakeSelAt(pt.X, pt.Y, new Rect(rcSrcRoot.Left, rcSrcRoot.Top, rcSrcRoot.Right, rcSrcRoot.Bottom), new Rect(rcDstRoot.Left, rcDstRoot.Top, rcDstRoot.Right, rcDstRoot.Bottom), false); if (sel == null) return base.OnRightMouseUp(pt, rcSrcRoot, rcDstRoot); // no object, so quit and let base handle it var e = new ContextMenuRequestedEventArgs(sel); if (ContextMenuRequested != null) ContextMenuRequested(this, e); if (e.Handled) return true; return base.OnRightMouseUp(pt, rcSrcRoot, rcDstRoot); }