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.CreateCodeCompletionContext();
            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();
        }
        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.CreateCodeCompletionContext();
            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 ();
        }