static void PositionParameterInfoWindow(Rectangle allocation) { lastW = allocation.Width; lastH = allocation.Height; wasVisi = CompletionWindowManager.IsVisible; var ctx = window.Widget.CurrentCodeCompletionContext; var md = methods [methods.Count - 1]; int cparam = window.Ext != null?window.Ext.GetCurrentParameterIndex(md.MethodProvider.StartOffset) : 0; X = md.CompletionContext.TriggerXCoord; if (CompletionWindowManager.IsVisible) { // place above Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - allocation.Height - 10; } else { // place below Y = ctx.TriggerYCoord; } var geometry = DesktopService.GetUsableMonitorGeometry(window.Screen, window.Screen.GetMonitorAtPoint(X, Y)); window.ShowParameterInfo(md.MethodProvider, md.CurrentOverload, cparam - 1, geometry.Width); if (X + allocation.Width > geometry.Right) { X = geometry.Right - allocation.Width; } if (Y < geometry.Top) { Y = ctx.TriggerYCoord; } if (wasAbove || Y + allocation.Height > geometry.Bottom) { Y = Y - ctx.TriggerTextHeight - allocation.Height - 4; wasAbove = true; } if (CompletionWindowManager.IsVisible) { var completionWindow = new Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height); if (completionWindow.IntersectsWith(new Rectangle(X, Y, allocation.Width, allocation.Height))) { X = completionWindow.X; Y = completionWindow.Y - allocation.Height - 6; if (Y < 0) { Y = completionWindow.Bottom + 6; } } } window.Move(X, Y); }
static async void PositionParameterInfoWindow(Rectangle allocation) { lastW = allocation.Width; lastH = allocation.Height; var isCompletionWindowVisible = wasCompletionWindowVisible = (CompletionWindowManager.Wnd?.Visible ?? false); var ctx = window.Widget.CurrentCodeCompletionContext; int cparam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex(currentMethodGroup.MethodProvider.StartOffset) : 0; X = currentMethodGroup.CompletionContext.TriggerXCoord; if (isCompletionWindowVisible) { // place above Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - allocation.Height - 10; } else { // place below Y = ctx.TriggerYCoord; } var geometry = DesktopService.GetUsableMonitorGeometry(window.Screen.Number, window.Screen.GetMonitorAtPoint(X, Y)); window.ShowParameterInfo(currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, cparam - 1, (int)geometry.Width); if (X + allocation.Width > geometry.Right) { X = (int)geometry.Right - allocation.Width; } if (Y < geometry.Top) { Y = ctx.TriggerYCoord; } if (wasAbove || Y + allocation.Height > geometry.Bottom) { Y = Y - ctx.TriggerTextHeight - allocation.Height - 4; wasAbove = true; } if (isCompletionWindowVisible) { var completionWindow = new Xwt.Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height); if (completionWindow.IntersectsWith(new Xwt.Rectangle(X, Y, allocation.Width, allocation.Height))) { X = (int)completionWindow.X; Y = (int)completionWindow.Y - allocation.Height - 6; if (Y < 0) { Y = (int)completionWindow.Bottom + 6; } } } window.Move(X, Y); }
internal static void UpdateWindow(ICompletionWidget widget) { // Updates the parameter information window from the information // of the current method overload if (window == null && methods.Count > 0) { window = new ParameterInformationWindow(); wasAbove = false; } if (methods.Count == 0) { if (window != null) { window.Hide(); wasAbove = false; } return; } var ctx = widget.CurrentCodeCompletionContext; MethodData md = methods[methods.Count - 1]; int cparam = md.MethodProvider.GetCurrentParameterIndex(widget, md.CompletionContext); Gtk.Requisition reqSize = window.ShowParameterInfo(md.MethodProvider, md.CurrentOverload, cparam - 1); X = md.CompletionContext.TriggerXCoord; if (CompletionWindowManager.IsVisible) { // place above Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - reqSize.Height - 10; } else { // place below Y = ctx.TriggerYCoord; } Gdk.Rectangle geometry = window.Screen.GetMonitorGeometry(window.Screen.GetMonitorAtPoint(X, Y)); if (X + reqSize.Width > geometry.Right) { X = geometry.Right - reqSize.Width; } if (Y < geometry.Top) { Y = ctx.TriggerYCoord; } if (wasAbove || Y + reqSize.Height > geometry.Bottom) { Y = Y - ctx.TriggerTextHeight - reqSize.Height - 4; wasAbove = true; } if (CompletionWindowManager.IsVisible) { Rectangle completionWindow = new Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height); if (completionWindow.IntersectsWith(new Rectangle(X, Y, reqSize.Width, reqSize.Height))) { X = completionWindow.X; Y = completionWindow.Y - reqSize.Height - 6; if (Y < 0) { Y = completionWindow.Bottom + 6; } } } window.Move(X, Y); window.Show(); }