Ejemplo n.º 1
0
            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;
                    }
                }
            }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 public static Point ToEtoPoint(this CGPoint point)
 {
     return(new Point((int)point.X, (int)point.Y));
 }
Ejemplo n.º 6
0
 public static PointF ToEto(this CGPoint point)
 {
     return(new PointF((float)point.X, (float)point.Y));
 }
Ejemplo n.º 7
0
 public static extern void void_objc_msgSend_NSRange_CGPoint(IntPtr receiver, IntPtr selector, NSRange arg1, CGPoint arg2);
Ejemplo n.º 8
0
 // not bound
 public static void DrawGlyphs(this NSLayoutManager layout, NSRange range, CGPoint point)
 {
     void_objc_msgSend_NSRange_CGPoint(layout.Handle, selDrawGlyphs, range, point);
 }
Ejemplo n.º 9
0
		// not bound
		public static void DrawGlyphs(this NSLayoutManager layout, NSRange range, CGPoint point)
		{
			Messaging.void_objc_msgSend_NSRange_CGPoint(layout.Handle, selDrawGlyphs, range, point);
		}
Ejemplo n.º 10
0
		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;
		}
Ejemplo n.º 11
0
		static extern void void_objc_msgSend_NSRange_CGPoint(IntPtr receiver, IntPtr selector, NSRange arg1, CGPoint arg2);
Ejemplo n.º 12
0
 CGPoint ConvertPointFromBacking(CGPoint point)
 {
     return(base.ConvertNSPointromBacking(point));
 }