Exemplo n.º 1
0
        private void ShowMenu()
        {
            TerminalControl tc = _terminal.TerminalHost.TerminalControl;

            Debug.Assert(tc != null);
            TerminalDocument doc   = _terminal.GetDocument();
            SizeF            pitch = tc.GetRenderProfile().Pitch;
            Point            popup = new Point((int)(doc.CaretColumn * pitch.Width), (int)((doc.CurrentLineNumber - doc.TopLineNumber + 1) * pitch.Height));

            IPoderosaForm f = tc.FindForm() as IPoderosaForm;

            Debug.Assert(f != null);
            //EXTPにしてもいいんだけど
            f.ShowContextMenu(new IPoderosaMenuGroup[] { new PoderosaMenuGroupImpl(CreatePopupMenuItems()) },
                              (ICommandTarget)tc.GetAdapter(typeof(ICommandTarget)),
                              tc.PointToScreen(popup),
                              ContextMenuFlags.SelectFirstItem);
        }
Exemplo n.º 2
0
        public void ShowContextMenu(Point pt)
        {
            IPoderosaView view = (IPoderosaView)_control.GetAdapter(typeof(IPoderosaView));

            view.ParentForm.ShowContextMenu(TerminalEmulatorPlugin.Instance.ContextMenu, view, _control.PointToScreen(pt), ContextMenuFlags.None);
            //コマンド実行後自分にフォーカス
            if (!_control.Focused)
            {
                _control.Focus();
            }
        }