/// <summary>
        /// No text range returned from the language server so the tooltip will
        /// be shown based on the mouse cursor position. The arrow from the
        /// tooltip should be pointing to the mouse cursor.
        /// </summary>
        void ShowTooltipWindowAtMouseLocation(
            TextEditor editor,
            TooltipInformationWindow tooltipWindow,
            int mouseX,
            int mouseY)
        {
            // mouseX here does not seem to produce the correct text editor column
            // so only Point.Y is used from the TextEditor's LocationToPoint. Point.X
            // is incorrect and cannot be used to determine the tooltip rectangle
            // location.
            DocumentLocation location = editor.PointToLocation(mouseX, mouseY);

            Xwt.Point point = editor.LocationToPoint(location);

            // The target rectangle should be a segment of text in the text editor. Since
            // this does not exist the width of the tooltip window is used as the rectangle
            // width and the X position is taken from the mouseX but shifted to the left by
            // half the width of the tooltip window so the middle of the tooltip window
            // appears under the mouse position so the arrow from the tooltip should be
            // pointing to where the mouse cursor is. The mouseX and mouseY are captured by
            // the tooltip provider at the time the tooltip is initially requested and so
            // this is not necessarily the current mouse position.
            var targetRectangle = new Xwt.Rectangle(
                mouseX - (tooltipWindow.Width / 2), // Arrow from tooltip should point to mouse cursor.
                point.Y,                            // The top of the line where the mouse cursor is
                tooltipWindow.Width,
                editor.GetLineHeight(editor.CaretLine)
                );

            tooltipWindow.ShowPopup(editor, targetRectangle, PopupPosition.Top);
        }
Ejemplo n.º 2
0
        bool DelayedTooltipShow()
        {
            declarationviewwindow.ShowArrow = true;
            var rect = SelectedItemRectangle;

            declarationviewwindow.ShowPopup(this, new Gdk.Rectangle(0, (int)rect.Y, Allocation.Width, (int)rect.Height), PopupPosition.Right);
            if (declarationViewWindowOpacityTimer != 0)
            {
                GLib.Source.Remove(declarationViewWindowOpacityTimer);
            }
            declarationViewWindowOpacityTimer = GLib.Timeout.Add(50, new OpacityTimer(this).Timer);
            declarationViewTimer = 0;
            return(false);
        }
Ejemplo n.º 3
0
        async void ShowTooltip()
        {
            var currentSelectedItem = selectedItem;

            if (currentSelectedItem == null || currentSelectedItem.DataSource == null)
            {
                HideTooltip();
                return;
            }
            var i = currentSelectedItem.Item;

            if (i < 0 || i >= currentSelectedItem.DataSource.Count)
            {
                return;
            }

            if (tooltipSrc != null)
            {
                tooltipSrc.Cancel();
            }
            tooltipSrc = new CancellationTokenSource();
            var token = tooltipSrc.Token;

            try {
                currentTooltip = await currentSelectedItem.DataSource [i].GetTooltipInformation(token);
            } catch (OperationCanceledException) {
                HideTooltip();
                return;
            } catch (Exception e) {
                LoggingService.LogError("Error while creating search popup window tooltip", e);
                HideTooltip();
                return;
            }
            if (currentTooltip == null || string.IsNullOrEmpty(currentTooltip.SignatureMarkup) || token.IsCancellationRequested)
            {
                HideTooltip();
                return;
            }

            declarationviewwindow.Hide();
            declarationviewwindow.Clear();
            declarationviewwindow.AddOverload(currentTooltip);
            declarationviewwindow.CurrentOverload = 0;
            declarationviewwindow.ShowArrow       = true;
            var rect = SelectedItemRectangle;

            declarationviewwindow.ShowPopup(this, new Rectangle(0, (int)rect.Y - 5, Bounds.Width, (int)rect.Height), PopupPosition.Right);
        }
Ejemplo n.º 4
0
        void ShowTipInfoWindow(TextEditor editor, TooltipInformationWindow tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
        {
            Gtk.Widget editorWidget = editor;

            var startLoc = editor.OffsetToLocation(item.Offset);
            var endLoc   = editor.OffsetToLocation(item.EndOffset);
            var p1       = editor.LocationToPoint(startLoc);
            var p2       = editor.LocationToPoint(endLoc);

            int w = (int)(p2.X - p1.X);

            var caret = new Gdk.Rectangle(
                (int)p1.X,
                (int)p1.Y,
                (int)w,
                (int)editor.LineHeight
                );

            tipWindow.ShowPopup(editorWidget, caret, PopupPosition.Top);
        }