void DrawPattern(CGContext context) { var start = new CGPoint(0, 0); var end = start + sectionSize; context.ClipToRect(new CGRect(start, tileSize).Inset(-4, -4)); if (Wrap == GradientWrapMode.Reflect) { for (int i = 0; i < 2; i++) { context.DrawLinearGradient(Gradient, start, end, 0); context.DrawLinearGradient(InverseGradient, end, end + sectionSize, 0); start = start + sectionSize + sectionSize; end = end + sectionSize + sectionSize; } } else { for (int i = 0; i < 2; i++) { context.DrawLinearGradient(Gradient, start, end, 0); start = start + sectionSize; end = end + sectionSize; } } }
void SetPosition(Control control, PointF point, float frameHeight, bool flipped) { var offset = ((IMacViewHandler)control.Handler).PositionOffset; var childView = control.GetContainerView(); var preferredSize = control.GetPreferredSize(Control.Frame.Size.ToEtoSize()); CGPoint origin; if (flipped) { origin = new CGPoint( point.X + offset.Width, point.Y + offset.Height ); } else { origin = new CGPoint( point.X + offset.Width, frameHeight - (preferredSize.Height + point.Y + offset.Height) ); } var frame = new CGRect(origin, preferredSize.ToNS()); if (frame != childView.Frame) { childView.Frame = frame; } }
public override void Center() { // implement centering to parent if there is a parent window for this one.. if (ParentWindow != null) { var parentFrame = ParentWindow.Frame; var frame = Frame; var location = new CGPoint((parentFrame.Width - frame.Width) / 2 + parentFrame.X, (parentFrame.Height - frame.Height) / 2 + parentFrame.Y); SetFrameOrigin(location); } else { base.Center(); } }
public CGPoint TranslateView(CGPoint point, bool halfers = false, bool inverse = false) { if (halfers) { if (inverse) { point.X += inverseoffset; point.Y += inverseoffset; } else { point.X += offset; point.Y += offset; } } return(point); }
public static Point ToEtoPoint(this CGPoint point) { return(new Point((int)point.X, (int)point.Y)); }
public static PointF ToEto(this CGPoint point) { return(new PointF((float)point.X, (float)point.Y)); }
public static extern void void_objc_msgSend_NSRange_CGPoint(IntPtr receiver, IntPtr selector, NSRange arg1, CGPoint arg2);
// not bound public static void DrawGlyphs(this NSLayoutManager layout, NSRange range, CGPoint point) { void_objc_msgSend_NSRange_CGPoint(layout.Handle, selDrawGlyphs, range, point); }
// not bound public static void DrawGlyphs(this NSLayoutManager layout, NSRange range, CGPoint point) { Messaging.void_objc_msgSend_NSRange_CGPoint(layout.Handle, selDrawGlyphs, range, point); }
public CGPoint TranslateView(CGPoint point, bool halfers = false, bool inverse = false) { if (halfers) { if (inverse) { point.X += inverseoffset; point.Y += inverseoffset; } else { point.X += offset; point.Y += offset; } } return point; }
static extern void void_objc_msgSend_NSRange_CGPoint(IntPtr receiver, IntPtr selector, NSRange arg1, CGPoint arg2);
CGPoint ConvertPointFromBacking(CGPoint point) { return(base.ConvertNSPointromBacking(point)); }