Smartmobili.Cocoa.NSView.ResizeWithOldSuperviewSize C# (CSharp) Метод

ResizeWithOldSuperviewSize() публичный Метод

public ResizeWithOldSuperviewSize ( NSSize oldSize ) : void
oldSize NSSize
Результат void
        public virtual void ResizeWithOldSuperviewSize(NSSize oldSize)
        {
            NSSize superViewFrameSize;
            NSRect newFrame = _frame;
            NSRect newFrameRounded;

            if (_autoresizingMask == (uint)NSViewAutoresizingMasks.NSViewNotSizable)
                return;

            if (!NS.EqualRects(NS.ZeroRect, _autoresizingFrameError))
            {
                newFrame.Origin = NS.MakePoint(newFrame.Origin.X -_autoresizingFrameError.Origin.X,  newFrame.Origin.Y - _autoresizingFrameError.Origin.Y);
                //newFrame.Origin.X -= _autoresizingFrameError.Origin.X;
                //newFrame.Origin.Y -= _autoresizingFrameError.Origin.Y;

                newFrame.Size = NS.MakeSize(newFrame.Size.Width - _autoresizingFrameError.Size.Width, newFrame.Size.Height - _autoresizingFrameError.Size.Height);
                //newFrame.Size.Width -= _autoresizingFrameError.Size.Width;
                //newFrame.Size.Height -= _autoresizingFrameError.Size.Height;
            }

            superViewFrameSize = NS.MakeSize(0,0);
            if (_super_view != null)
                superViewFrameSize = _super_view.Frame.Size;

            double orgX = newFrame.Origin.X;
            double sizeW = newFrame.Size.Width;

            Autoresize(oldSize.Width,superViewFrameSize.Width,
                ref orgX,
                ref sizeW,
                (_autoresizingMask & (uint)NSViewAutoresizingMasks.NSViewMinXMargin) != 0,
                (_autoresizingMask & (uint)NSViewAutoresizingMasks.NSViewWidthSizable) != 0,
                (_autoresizingMask & (uint)NSViewAutoresizingMasks.NSViewMaxXMargin) != 0);

            newFrame.Origin = NS.MakePoint(orgX, newFrame.Origin.Y);
            newFrame.Size = NS.MakeSize(sizeW, newFrame.Size.Height);

            {
                bool flipped = ((_super_view != null) && _super_view.IsFlipped());

                double orgY = newFrame.Origin.Y;
                double sizeH = newFrame.Size.Height;

                Autoresize(oldSize.Height, superViewFrameSize.Height,
                    ref orgY,
                    ref sizeH,
                    flipped ? NS.IsBitSet(_autoresizingMask, (uint)NSViewAutoresizingMasks.NSViewMaxYMargin) : NS.IsBitSet(_autoresizingMask, (uint)NSViewAutoresizingMasks.NSViewMinYMargin),
                    NS.IsBitSet(_autoresizingMask, (uint)NSViewAutoresizingMasks.NSViewHeightSizable),
                    flipped ? NS.IsBitSet(_autoresizingMask, (uint)NSViewAutoresizingMasks.NSViewMinYMargin) : NS.IsBitSet(_autoresizingMask, (uint)NSViewAutoresizingMasks.NSViewMaxYMargin));
            }

            newFrameRounded = newFrame;

            /**
            * Perform rounding to pixel-align the frame if we are not rotated
            */
            if (!this.IsRotatedFromBase() && this.Superview != null)
            {
                newFrameRounded = ((NSView)this.Superview).CenterScanRect(newFrameRounded);
            }

            this.SetFrame(newFrameRounded);

            _autoresizingFrameError.Origin = NS.MakePoint(newFrameRounded.Origin.X - newFrame.Origin.X, newFrameRounded.Origin.Y - newFrame.Origin.Y);
            //_autoresizingFrameError.Origin.X = (newFrameRounded.Origin.X - newFrame.Origin.X);
            //_autoresizingFrameError.Origin.Y = (newFrameRounded.Origin.Y - newFrame.Origin.Y);

            _autoresizingFrameError.Size = NS.MakeSize(newFrameRounded.Size.Width - newFrame.Size.Width, newFrameRounded.Size.Height - newFrame.Size.Height);
            //_autoresizingFrameError.Size.Width = (newFrameRounded.Size.Width - newFrame.Size.Width);
            //_autoresizingFrameError.Size.Height = (newFrameRounded.Size.Height - newFrame.Size.Height);
        }
NSView