protected internal override void ResetState()
 {
     StartOffset   = 0;
     previousWidth = previousHeight = -1;
     yPosition     = WindowPositonY.None;
     base.ResetState();
 }
        void Reposition(bool force)
        {
            X = CodeCompletionContext.TriggerXCoord - TextOffset;
            Y = CodeCompletionContext.TriggerYCoord;

            int w, h;

            GetSize(out w, out h);

            if (!force && previousHeight != h && previousWidth != w)
            {
                return;
            }

            // Note: we add back the TextOffset here in case X and X+TextOffset are on different monitors.
            Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(X + TextOffset, Y));

            previousHeight = h;
            previousWidth  = w;

            if (X + w > geometry.Right)
            {
                X = geometry.Right - w;
            }
            else if (X < geometry.Left)
            {
                X = geometry.Left;
            }

            if (Y + h > geometry.Bottom || yPosition == WindowPositonY.Top)
            {
                // Put the completion-list window *above* the cursor
                Y         = Y - CodeCompletionContext.TriggerTextHeight - h;
                yPosition = WindowPositonY.Top;
            }
            else
            {
                yPosition = WindowPositonY.Bottom;
            }

            curXPos = X;
            curYPos = Y;
            Move(X, Y);
            UpdateDeclarationView();
            ParameterInformationWindowManager.UpdateWindow(CompletionWidget);
        }
        void Reposition(bool force)
        {
            X = CodeCompletionContext.TriggerXCoord - TextOffset;
            Y = CodeCompletionContext.TriggerYCoord;

            int w, h;

            GetSize(out w, out h);

            if (!force && previousHeight != h && previousWidth != w)
            {
                return;
            }

            Gdk.Rectangle geometry = Screen.GetMonitorGeometry(Screen.GetMonitorAtPoint(X, Y));

            previousHeight = h;
            previousWidth  = w;
            if (X + w > geometry.Right)
            {
                X = geometry.Right - w;
            }

            if (Y + h > geometry.Bottom || yPosition == WindowPositonY.Top)
            {
                Y         = Y - CodeCompletionContext.TriggerTextHeight - h;
                yPosition = WindowPositonY.Top;
            }
            else
            {
                yPosition = WindowPositonY.Bottom;
            }

            curXPos = X;
            curYPos = Y;
            Move(X, Y);
            UpdateDeclarationView();
            ParameterInformationWindowManager.UpdateWindow(CompletionWidget);
        }