예제 #1
0
        /// <exclude/>
        public void appendBezierPathWithPointsCount(NSPoint[] points)
        {
            float[] values = new float[2*points.Length];

            for (int i = 0; i < points.Length; ++i)
            {
                values[2*i] = points[i].x;
                values[2*i + 1] = points[i].y;
            }

            GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned);
            Unused.Value = Call("appendBezierPathWithPoints:count:", handle.AddrOfPinnedObject(), points.Length);
            handle.Free();
        }
예제 #2
0
 public static void NSShowAnimationEffect(int animationEffect, NSPoint centerLocation, NSSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo)
 {
     NativeMethods.NSShowAnimationEffect(animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo);
 }
예제 #3
0
 public static void NSShowAnimationEffect(int animationEffect, NSPoint centerLocation)
 {
     NativeMethods.NSShowAnimationEffect(animationEffect, centerLocation, NSSize.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
 }
예제 #4
0
 internal extern static void Void_objc_msgSend(IntPtr receiver, IntPtr selector, NSPoint arg0);
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <c>NSRect</c> struct using the supplied coordinates, width, and height.
 /// </summary>
 /// <param name="x">The x coordinate of the top left corner of the rectangle.</param>
 /// <param name="y">The y coordinate of the top left corner of the rectangle.</param>
 /// <param name="width">The width of the rectangle.</param>
 /// <param name="height">The height of the rectangle.</param>
 public NSRect(double x, double y, double width, double height)
 {
     location = new NSPoint(x, y);
     size     = new NSSize(width, height);
 }
예제 #6
0
        public new void mouseUp(NSEvent theEvent)
        {
            if (Draggable)
            {
                NSRect currentFrame = frame();
                NSRect content = m_parent.contentRectForFrameRect(m_parent.frame());
                if (content.Intersects(currentFrame))
                {
                    NSRect baseFrame = DoGetFrame(currentFrame.size);
                    m_offset = currentFrame.origin - baseFrame.origin;

                    SuperCall(NSWindow.Class, "mouseUp:", theEvent);
                }
                else
                {
                    Close();

                    NSPoint centerPt = currentFrame.Center;
                    Functions.NSShowAnimationEffect(Enums.NSAnimationEffectPoof, centerPt);
                }
            }
            else
            {
                SuperCall(NSWindow.Class, "mouseUp:", theEvent);
            }
        }
예제 #7
0
 /// <summary>
 /// Sends a message to <paramref name="receiver"/>.
 /// </summary>
 /// <param name="receiver">The target of the message.</param>
 /// <param name="selector">The selector identifying the message.</param>
 /// <param name="arg0">An <see cref="Id"/>.</param>
 /// <param name="arg1">An <see cref="NSPoint"/>.</param>
 /// <returns>An <see cref="Id"/>.</returns>
 public static Id Get(this IReceiver receiver, SEL selector, Id arg0, NSPoint arg1) =>
예제 #8
0
        private float CalculateMouseAngle(NSPoint aPtInView)
        {
            double radians = Math.Atan2(aPtInView.y - Centre.y, aPtInView.x - Centre.x);

            return((float)(radians * 180.0 / Math.PI));
        }
예제 #9
0
 public void ShowSelection(NSRange range)
 {
     m_length = -1;
     m_origin = NSPoint.Zero;
     m_selected = range;
     m_visible = range;
     m_deferred = range;
 }
예제 #10
0
 public extern static IntPtr SendIntPtr(IntPtr receiver, IntPtr selector, IntPtr intPtr1, NSPoint point1);
예제 #11
0
 public void ShowLine(int begin, int end, int count)
 {
     m_length = -1;
     m_origin = NSPoint.Zero;
     m_selected = new NSRange(begin, 0);
     m_visible = new NSRange(begin, end - begin);
     m_deferred = new NSRange(begin, count);
 }
예제 #12
0
    // This method simply computes the new layout, and calls setFrame: on all subview
    // with their locations. Since the calls are made to the subviews' animators, the
    // subview animate to their new locations.
    private void DoLayout()
    {
        NSArray subviews = Subviews;

        NSPoint curPoint;
        switch (m_layout)
        {
            case Layout.Column:
                curPoint = new NSPoint(Bounds.size.width / 2.0f, 0.0f);            	// Starting point: center bottom of view
                for (int i = 0; i < subviews.Length; ++i)
                {
                    NSRect frame = new NSRect(curPoint.x - BoxWidth / 2.0f, curPoint.y, BoxWidth, BoxHeight);   // Centered horizontally, stacked higher
                    frame = DoGetIntegralRect(frame);
                    DoAnimate(subviews[i], frame);
                    curPoint.y += frame.size.height + Separation;                // Next view location; we're stacking higher
                }
                break;

            case Layout.Row:
                curPoint = new NSPoint(0.0f, Bounds.size.height / 2.0f);	      	 // Starting point: center left edge of view
                for (int i = 0; i < subviews.Length; ++i)
                {
                    NSRect frame = new NSRect(curPoint.x, curPoint.y - BoxHeight / 2.0f, BoxWidth, BoxHeight);    // Centered vertically, stacked left to right
                    frame = DoGetIntegralRect(frame);
                    DoAnimate(subviews[i], frame);
                    curPoint.x += frame.size.width + Separation;                // Next view location
                }
                break;

            case Layout.Grid:
                int viewsPerSide = (int) Math.Ceiling(Math.Sqrt(subviews.Length));       // Put the views in a roughly square grid
                int index = 0;
                curPoint = NSPoint.Empty;                                 // Starting at the bottom left corner
                for (int i = 0; i < subviews.Length; ++i)
                {
                    NSRect frame = new NSRect(curPoint.x, curPoint.y, BoxWidth, BoxHeight);
                    frame = DoGetIntegralRect(frame);
                    DoAnimate(subviews[i], frame);

                    curPoint.x += BoxWidth + Separation;                 // Stack them horizontally
                    if ((++index) % viewsPerSide == 0)
                    {                       							 // And if we have enough on this row, move up to the next
                        curPoint.x = 0;
                        curPoint.y += BoxHeight + Separation;
                    }
                }
                break;
        }
    }
예제 #13
0
	private NSRect DoCreateSelectionRect(NSPoint point1, NSPoint point2)
	{
		return new NSRect(((point1.x <= point2.x) ? point1.x : point2.x),
			((point1.y <= point2.y) ? point1.y : point2.y),
			((point1.x <= point2.x) ? point2.x - point1.x : point1.x - point2.x),
			((point1.y <= point2.y) ? point2.y - point1.y : point1.y - point2.y));
	}
예제 #14
0
 public static extern void NSShowAnimationEffect(int animationEffect, NSPoint centerLocation, NSSize size, IntPtr animationDelegate, IntPtr didEndSelector, IntPtr contextInfo);
예제 #15
0
파일: CG.cs 프로젝트: wj-wong/OutsideTheBox
 internal static extern CGError WarpMouseCursorPosition(NSPoint newCursorPosition);
예제 #16
0
 public NSRect(float x, float y, float width, float height)
 {
     origin = new NSPoint(x, y);
     size   = new NSSize(width, height);
 }
예제 #17
0
 internal extern static IntPtr IntPtr_objc_msgSend(IntPtr receiver, IntPtr selector, IntPtr arg0, NSPoint arg1);
예제 #18
0
 public NSRect(float x, float y, float width, float height)
 {
     origin = new NSPoint(x, y);
     size = new NSSize(width, height);
 }
예제 #19
0
 internal extern static IntPtr IntPtr_objc_msgSend(IntPtr receiver, IntPtr selector, ulong arg0, NSPoint arg1, ulong arg2, double arg3,
                                                   long arg4, IntPtr arg5, short arg6, long arg7, long arg8);
예제 #20
0
 public extern static void SendVoid(IntPtr receiver, IntPtr selector, NSPoint point1);
예제 #21
0
 internal extern static sbyte SByte_objc_msgSend(IntPtr receiver, IntPtr selector, NSPoint arg0, NSRect arg1);
예제 #22
0
 public void SetLoc(NSPoint loc)
 {
     m_loc = loc;
 }
예제 #23
0
 /// <summary>
 /// Initializes a new instance of the <c>NSRect</c> struct using the supplied location and size.
 /// </summary>
 /// <param name="location">The location of the top left corner of the rectangle.</param>
 /// <param name="size">The size of the rectangle.</param>
 public NSRect(NSPoint location, NSSize size)
 {
     this.location = location;
     this.size     = size;
 }