Example #1
0
        private void SetSize(int x, int y, int width, int height)
        {
            Hadjustment.Upper = Math.Max(Allocation.Width, width);
            Vadjustment.Upper = Math.Max(Allocation.Height, height);

            bool xchange = scroll && (int)(Hadjustment.Value) != x;
            bool ychange = scroll && (int)(Vadjustment.Value) != y;

            // reset scroll
            scroll = false;

            if (IsRealized)
            {
                BinWindow.FreezeUpdates();
            }

            if (xchange || ychange)
            {
                if (IsRealized)
                {
                    BinWindow.MoveResize(-x, -y, (int)(Hadjustment.Upper), (int)(Vadjustment.Upper));
                }
                Vadjustment.Value = y;
                Hadjustment.Value = x;
            }

            if (this.Width != Allocation.Width || this.Height != Allocation.Height)
            {
                SetSize((uint)Allocation.Width, (uint)height);
            }

            if (xchange || ychange)
            {
                Vadjustment.ChangeValue();
                Hadjustment.ChangeValue();
            }

            if (IsRealized)
            {
                BinWindow.ThawUpdates();
                BinWindow.ProcessUpdates(true);
            }
        }