/// <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(); }
public static void NSShowAnimationEffect(int animationEffect, NSPoint centerLocation, NSSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo) { NativeMethods.NSShowAnimationEffect(animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo); }
public static void NSShowAnimationEffect(int animationEffect, NSPoint centerLocation) { NativeMethods.NSShowAnimationEffect(animationEffect, centerLocation, NSSize.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); }
internal extern static void Void_objc_msgSend(IntPtr receiver, IntPtr selector, NSPoint arg0);
/// <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); }
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); } }
/// <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) =>
private float CalculateMouseAngle(NSPoint aPtInView) { double radians = Math.Atan2(aPtInView.y - Centre.y, aPtInView.x - Centre.x); return((float)(radians * 180.0 / Math.PI)); }
public void ShowSelection(NSRange range) { m_length = -1; m_origin = NSPoint.Zero; m_selected = range; m_visible = range; m_deferred = range; }
public extern static IntPtr SendIntPtr(IntPtr receiver, IntPtr selector, IntPtr intPtr1, NSPoint point1);
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); }
// 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; } }
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)); }
public static extern void NSShowAnimationEffect(int animationEffect, NSPoint centerLocation, NSSize size, IntPtr animationDelegate, IntPtr didEndSelector, IntPtr contextInfo);
internal static extern CGError WarpMouseCursorPosition(NSPoint newCursorPosition);
public NSRect(float x, float y, float width, float height) { origin = new NSPoint(x, y); size = new NSSize(width, height); }
internal extern static IntPtr IntPtr_objc_msgSend(IntPtr receiver, IntPtr selector, IntPtr arg0, NSPoint arg1);
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);
public extern static void SendVoid(IntPtr receiver, IntPtr selector, NSPoint point1);
internal extern static sbyte SByte_objc_msgSend(IntPtr receiver, IntPtr selector, NSPoint arg0, NSRect arg1);
public void SetLoc(NSPoint loc) { m_loc = loc; }
/// <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; }