public virtual void SetFrameSize(NSSize newSize)
{
NSRect newFrame = _frame;
if (newSize.Width < 0)
{
//NSWarnMLog(@"given negative width", 0);
newSize.Width = 0;
}
if (newSize.Width < 0)
{
//NSWarnMLog(@"given negative height", 0);
newSize.Height = 0;
}
if (NS.EqualSizes(_frame.Size, newSize) == false)
{
NSSize old_size = _frame.Size;
if (_is_rotated_or_scaled_from_base)
{
if (_boundsMatrix == null)
{
double sx = _bounds.Size.Width / _frame.Size.Width;
double sy = _bounds.Size.Height / _frame.Size.Height;
newFrame.Size = newSize;
this._SetFrameAndClearAutoresizingError(newFrame);
_bounds.Size = NS.MakeSize(_frame.Size.Width * sx, _frame.Size.Height * sy);
//_bounds.Size.Width = _frame.Size.Width * sx;
//_bounds.Size.Height = _frame.Size.Height * sy;
}
else
{
NSAffineTransform matrix;
NSRect frame;
newFrame.Size = newSize;
this._SetFrameAndClearAutoresizingError(newFrame);
frame = _frame;
frame.Origin = NS.MakePoint(0, 0);
matrix = (NSAffineTransform)_boundsMatrix.Copy();
matrix.Invert();
matrix.BoundingRectFor(frame ,ref _bounds);
//RELEASE(matrix);
}
}
else
{
newFrame.Size = _bounds.Size = newSize;
this._SetFrameAndClearAutoresizingError(newFrame);
}
if (_coordinates_valid)
{
//FIXME
//(*invalidateImp)(self, invalidateSel);
}
this.ResetCursorRects();
this.ResizeSubviewsWithOldSize(old_size);
if (_post_frame_changes)
{
//FIXME
//[nc postNotificationName: NSViewFrameDidChangeNotification object: self];
}
}
}