public override void ShowTooltipWindow(Ide.Editor.TextEditor editor, Components.Window tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY) { base.ShowTooltipWindow(editor, tipWindow, item, modifierState, mouseX, mouseY); var info = (TaggedTooltipInformation <CodeActions.CodeActionContainer>)item.Item; var sourceEditorView = editor.GetContent <SourceEditorView> (); var codeActionEditorExtension = editor.GetContent <CodeActionEditorExtension> (); var loc = editor.OffsetToLocation(info.Tag.Span.Start); if (info.Tag?.FloatingWidgetShown == true) { var point = sourceEditorView.TextEditor.TextArea.LocationToPoint(loc.Line, loc.Column); point.Y += (int)editor.GetLineHeight(loc.Line); var window = (LanguageItemWindow)tipWindow; if (floatingWidget != null) { floatingWidget.Destroy(); floatingWidget = null; } floatingWidget = new FloatingQuickFixIconWidget(codeActionEditorExtension, window, sourceEditorView, info.Tag, point); sourceEditorView.TextEditor.GdkWindow.GetOrigin(out int ox, out int oy); floatingWidget.Move(ox + (int)point.X, oy + (int)(point.Y + 4)); window.Tag = floatingWidget; window.EnterNotifyEvent += delegate { floatingWidget.CancelDestroy(); }; window.LeaveNotifyEvent += delegate { floatingWidget.QueueDestroy(); }; } }
protected override Xwt.Point CalculateWindowLocation(Ide.Editor.TextEditor editor, TooltipItem item, Xwt.WindowFrame xwtWindow, int mouseX, int mouseY, Xwt.Point origin) { int w; double xalign; GetRequiredPosition(editor, xwtWindow, out w, out xalign); w += 10; var allocation = GetAllocation(editor); var info = (TaggedTooltipInformation <CodeActions.CodeActionContainer>)item.Item; var loc = editor.OffsetToLocation(info.Tag.Span.Start); var p = editor.LocationToPoint(loc); var view = editor.GetContent <SourceEditorView> (); int x = (int)(p.X + origin.X + allocation.X + xPadding); int y = (int)(p.Y + view.TextEditor.GetLineHeight(loc.Line) + origin.Y + allocation.Y + yPadding); Gtk.Widget widget = editor; var geometry = widget.Screen.GetUsableMonitorGeometry(widget.Screen.GetMonitorAtPoint(x, y)); if (x + w >= geometry.X + geometry.Width) { x = geometry.X + geometry.Width - w; } if (x < geometry.Left) { x = geometry.Left; } if (info.Tag?.FloatingWidgetShown == true) { x += windowSize; } int h = (int)xwtWindow.Size.Height; if (y + h >= geometry.Y + geometry.Height) { y = geometry.Y + geometry.Height - h; } if (y < geometry.Top) { y = geometry.Top; } return(new Xwt.Point(x, y)); }